3D Integration: Why does the shadow method work? In the link http://mathinsight.org/triple_integral_shadow_method, the shadow method for calculating triple integrals is described. The procedure is given as
$$\iiint_Df(x_1,x_2,x_3)\text{d}V=\iint_R \left(\int_{x_1=g(x_2,x_3)}^{x_1=h(x_2,x_3)}f(x_1,x_2,x_3)\text{d}x_1\right)\text{d}A$$
where $D$ is a 3D-object, $R$ is the shadow of $D$ in the $x_2x_3$-plane
Could someone please describe/give a proof for why this method works? Could we for instance change the order of integration (i.e first d$A$ and then d$x_1$)?
 A: This method works as written when the 3D region $D$ is between two surfaces which are given by the images of two functions $h$ and $g$ over a 2D region $R$. Otherwise it doesn't. As for exchanging the integration, as written you cannot simply swap them, because the limits in $x_1$ depend on $x_2$ and $x_3$, so the integration in $dA$ must be on the outside. Now in principle you could describe $D$ in a different way and thereby achieve a different order of integration, but that is more problem-specific (i.e. we would need to know what $R,g$ and $h$ are).
A: Remember that the triple integral is really defined as a Riemann sum.
Unlike a Riemann sum of a one-variable function, where you partition
a line segment into subintervals 
and measure the function within each subinterval,
for the triple integral you have some region in three-dimensional space
that you are going to "partition" into many tiny three-dimensional boxes.
(In general, you can't really partition the region into boxes; for example,
if the region is a pyramid with sloping sides the closest approximation
you can make with little boxes is a pyramid with steps up all sides,
but the idea is to "cover" the region as well as you can with as little
"sticking out" as you can.)
Once you have your "partition" of boxes, you find the value of the function
somewhere inside each box, multiply by the volume of the box, and add
up all the results. That's your integral.
The purpose of methods such as the "shadow" method is simply to give you
a methodical way to visit each of the tiny boxes so that you will find
all of them and count all of them in your integral.
The "shadow" method takes rows of boxes one at a time;
the integral from $x_1$ to $x_2$ goes from one end of the row to the other.
The integral over $A$ ensures that you include every row of boxes
in the region.
