Double integration over two random variables order Suppose that $f(x,y) = 1$ with $0 \leq x \leq 1$ and $0 \leq y \leq 1$ for simplicity. You want to find $P(X \geq 3Y)$ where $X$ and $Y$ are some random variable.
I don't understand why changing the order of integrals gives me a different answer (I am likely missing something fundamental). I proceed the way that supposedly is the right answer:
$$\int_{0}^{1} \int_{0}^{x/3} 1\,dydx = \int_{0}^{1} \frac{x}{3} = \frac{x^2}{6} \biggr\rvert_{0}^{1} = \frac{1}{6}$$
Then I try and see what happens if I do it the other way where instead of isolating the value to the right of the inequality, I just go ahead with the integration and solve for $P(X \geq 3Y)$ as follows:
$$\int_{0}^{1} \int_{0}^{3y} 1\, dxdy = \int_{0}^{1} 3y\,dy = \frac{3y^2}{2} \biggr\rvert_{0}^{1} = \frac{3}{2}$$
I suspect I'm doing some invalid order changing and don't understand why. It has been a long time since I've had to do integrals.

The problem is with the limits of integration in the second case. What happend? You integrate $f(x,y)$ for $$0\le y \le 1, \quad \text{and}\quad 0\le x\le 3y$$ But this means that you allow $x$ to grow up to $3$ when $y=1$ which of course is not correct. If $x$ exceeds $1$ then $f$ is zero. The correct limits would be $$0\le y \le \frac13, \quad \text{and}\quad 0\le x\le 3y$$ To see it in more detail, let's start with the limits you have, but be careful at the point where $f$ changes its type \begin{align}\int_{0}^{1}\int_{0}^{3y}f(x,y)dxdy&=\int_{0}^{\frac13}\int_{0}^{3y}f(x,y)dxdy+\int_{\frac13}^{1}\int_{0}^{3y}f(x,y)dxdy\\&=\int_{0}^{\frac13}\int_{0}^{3y}1dxdy+\int_{\frac13}^{1}\int_{0}^{3y}0dxdy=\frac3{18}+0=\frac16\end{align} as in the first case. In the first case you avoided the mistake accidentally.
