# Double integrals - how are the boundaries chosen?

I was looking at the proof of the theorem stating that for two independent rv's $$X,Y$$ with density functions $$f,g$$ the density function of the rv $$X+Y$$ is the convolution of $$f$$ and $$g$$.

After having defined $$A_z=\{(x,y) \in \mathbb R^2 : x+y \leq z\}$$ for $$z \in \mathbb R$$ we get

$$P(X+Y \leq z) = P((X,Y) \in A_z) = \int_{A_z}f(x)g(y)\,dxdy=\int_{-\infty}^{\infty}\, dx \,f(x) \int_{-\infty}^{z-x}\, dy \, g(y)\, = \, ...$$

Can someone please explain the last equality $$\int_{A_z}f(x)g(y)\,dxdy=\int_{-\infty}^{\infty}\, dx \,f(x) \int_{-\infty}^{z-x}\, dy \, g(y)$$? I don't understand how the boundaries have been chosen and why we can just take the functions out of the integrals. Thank you.

For fixed $$x$$ the inequality $$x+y \leq z$$ is same as $$y \leq z-x$$ so $$y$$ ranges from $$-\infty$$ to $$z-x$$. Once the inequality $$x+y \leq z$$ has been taken care of, there is no further restriction on $$x$$ so $$x$$ ranges from $$-\infty$$ to $$\infty$$. (You can also do it the other way around: keep $$y$$ fixed, integrate w.r.t. $$x$$ from $$-\infty$$ to $$z-y$$ and then integrate w.r.t $$y$$).
• When you are integrating w.r.t. $y$, $f(x)$ acts like a constant, so you can pull it out. – Kavi Rama Murthy Nov 19 '18 at 10:24