Multivariable calculus

Triple Integral of x^2 + y^2 + z^2 over a Box

The triple integral of x squared plus y squared plus z squared, over the box where x runs 0 to 1, y runs 0 to 2 and z runs 0 to 1, equals 4. The three terms contribute 2/3, 8/3 and 2/3. The box has volume 2, so the average squared distance from the origin over the solid is 2.

f(x,y,z)=x2+y2+z2f(x,y,z) = x^2 + y^2 + z^2
010201(x2+y2+z2)dzdydx=4\int_0^1 \int_0^2 \int_0^1 \left(x^2 + y^2 + z^2\right) \,dz\,dy\,dx = 4

Numerically 4.000000, confirmed by quadrature on every build.

Three separable pieces, each with its own edge factors

The integrand is r2\lvert \mathbf{r} \rvert^2, the squared distance from the origin. Split it by linearity. Each term is separable, so it becomes one real integral times the two edge lengths belonging to the other variables.

Bx2dV=(01x2dx)(2)(1)=132=23\iiint_B x^2 \,dV = \left(\int_0^1 x^2 \,dx\right)(2)(1) = \frac{1}{3}\cdot 2 = \frac{2}{3}
By2dV=(1)(02y2dy)(1)=83,Bz2dV=(1)(2)(01z2dz)=23\iiint_B y^2 \,dV = (1)\left(\int_0^2 y^2 \,dy\right)(1) = \frac{8}{3}, \qquad \iiint_B z^2 \,dV = (1)(2)\left(\int_0^1 z^2 \,dz\right) = \frac{2}{3}

The total is 23+83+23=123=4\frac{2}{3} + \frac{8}{3} + \frac{2}{3} = \frac{12}{3} = 4. The yy term dominates because that edge is twice as long, and cubing 22 in 02y2dy=83\int_0^2 y^2 \,dy = \frac{8}{3} magnifies the difference.

Why this integral keeps appearing

Moment of inertia about an axis uses the squared distance to that axis, so the zz axis version integrates x2+y2x^2 + y^2 and the polar version integrates all three terms. Once you can evaluate one term over a box you can evaluate any of them.

  • About the zz axis: B(x2+y2)dV=23+83=103\iiint_B \left(x^2 + y^2\right) \,dV = \frac{2}{3} + \frac{8}{3} = \frac{10}{3}.
  • About the xx axis: B(y2+z2)dV=83+23=103\iiint_B \left(y^2 + z^2\right) \,dV = \frac{8}{3} + \frac{2}{3} = \frac{10}{3}.
  • About the origin, all three terms: 44.

With a variable density the terms stop being separable and the full iterated integral has to be worked, but the splitting by linearity still holds.

The mistake: attaching the wrong edges to a term

The frequent error is pairing 02y2dy\int_0^2 y^2 \,dy with the xx term, or reusing the same pair of edge lengths for all three pieces. Each term keeps its own variable live and borrows the lengths of the other two.

A second error is claiming x2+y2+z2x^2 + y^2 + z^2 is separable as a product. It is a sum, not a product, so the whole integral is not (x2)(y2)(z2)\left(\int x^2\right)\left(\int y^2\right)\left(\int z^2\right). That product would give 138313=827\frac{1}{3}\cdot\frac{8}{3}\cdot\frac{1}{3} = \frac{8}{27}, nowhere near 44.

Bound the answer to be safe. On this box the largest value of x2+y2+z2x^2 + y^2 + z^2 is 1+4+1=61 + 4 + 1 = 6 at the far corner and the smallest is 00, so with volume 22 the integral has to sit between 00 and 1212.

Frequently asked questions

What is the average squared distance from the origin here?

Divide by the volume: 42=2\frac{4}{2} = 2. So the typical point of the box sits at squared distance 22 from the origin, meaning a distance of about 1.411.41.

Can I integrate the terms in different orders?

Yes. Each term is handled independently and the box has constant limits, so any of the six orders works and no term interacts with another. Linearity and Fubini's theorem are doing the work together.