Multiplying two integrals becomes a double integral?
I ran by this in a textbook:
\begin{align*} I^2 & =\left(\int_{-\infty}^\infty e^{-x^2/2}dx\right)\left(\int_{-\infty}^\infty e^{-y^2/2}dy\right)\\ & =\int_{-\infty}^\infty\int_{-\infty}^\infty e^{-x^2/2}e^{-y^2/2}dxdy=\int_{-\infty}^\infty\int_{-\infty}^\infty e^{-(x^2+y^2)/2}dxdy \end{align*}
How come this is valid? I assume it's not generally true because it doesn't seem like you can just go around mashing integrals together. Does it only work because they are independent variables? And therefore constants with respect to each other?
Yes:\begin{align}\int_a^b\int_c^df(x)g(y)\,\mathrm dx\,\mathrm dy&=\int_a^bg(y)\int_c^df(x)\,\mathrm dx\,\mathrm dy\\&=\left(\int_a^bg(y)\,\mathrm dy\right)\left(\int_c^df(x)\,\mathrm dx\right).\end{align}