How can I integrate $\sqrt{x^2+y^2+z^2}$ over the region $x^2+y^2+z^2 \le 1$?
The problem is I do not know how to set up the triple integral. I guess that I can integrate with respect to $x$ first, then with respect to $y$ and finally with respect to $z$.

However, I am unsure as to how to proceed with the limits. Do I solve for $x$ to get $L(y,z)=\sqrt{1-y^2-z^2}$ as the upper limit of the innermost integral ($-L(y,z)$ as the lower one) and for the limits of the middle integral I use $L(0,z)$ and for the outermost integral $L(0,0)$?
Is this right? If it is, what does it mean for $x$ to be between its respective limits?


Use the spherical coordinates $(r,\theta,\varphi)$. In order to integrate a function $f(r,\theta,\varphi)$ on the unit sphere centred at the origin you have to calculate: $$\int_{r=0}^1\int_{\theta=0}^{\pi}\int_{\varphi=0}^{2\pi} f(r,\theta,\varphi) \cdot r^2\sin\theta\ d\varphi d\theta dr.$$

In your case $f(r,\theta,\varphi)=r$ and therefore $$\int_{r=0}^1\int_{\theta=0}^{\pi}\int_{\varphi=0}^{2\pi} r^3\sin\theta\ d\varphi d\theta dr=2\pi\cdot 2 \cdot \frac{1}{4}=\pi.$$

P.S. The same integral in cartesian coordinates is not so easy... $$\int_{x=-1}^1\left(\int_{y=-\sqrt{1-x^2}}^{\sqrt{1-x^2}}\left(\int_{z=-\sqrt{1-x^2-y^2}}^{\sqrt{1-x^2-y^2}} \sqrt{x^2+y^2+z^2}\ dz\right) dy\right) dx$$

  • $\begingroup$ I knew of spherical coordinates but I have never applied them. I can learn to use them, but my problem is at a more conceptual level. How do I set up the integral first in cartesian coordinates? $\endgroup$ Aug 31 '16 at 21:41
  • $\begingroup$ @Guacho Perez See my P.S. $\endgroup$
    – Robert Z
    Aug 31 '16 at 21:42
  • 2
    $\begingroup$ @Guacho Perez Don't be masochist! The choice of an adequate system of coordinates is at the basis of many theoretical and paractical activities. Treating a question about a sphere means in general using spherical coordinates. $\endgroup$
    – Jean Marie
    Aug 31 '16 at 21:45
  • $\begingroup$ @jeanmarie I am not being a masochist, I know spherical coordinates would be easier for this problem, I wanted to understand the integral at a more conceptual level, i.e. how to set it up, so that I can carry out this process in more complex scenarios $\endgroup$ Sep 1 '16 at 0:04

The question proposes that the bounds of the integral over the interior of the unit sphere can be written as follows: $$ \int_{-1}^1 \int_{-\sqrt{1-z^2}}^{\sqrt{1-z^2}} \int_{-\sqrt{1-y^2-z^2}}^{\sqrt{1-y^2-z^2}} \sqrt{x^2+y^2+z^2}\, dx\, dy\, dz $$ This is correct, although it is not to be recommended. (Integration over spherical coordinates, as shown in another answer, is much simpler in this instance.)

I'll attempt to answer the question of what it means for $x$ to be between the bounds of integration shown above. Consider the innermost integral, which is a single-variable integral over $x$: $$ \int_{-\sqrt{1-y^2-z^2}}^{\sqrt{1-y^2-z^2}} \sqrt{x^2+y^2+z^2}\, dx. $$

This has a fairly simple interpretation: if we choose any pair of real numbers as the values of $y$ and $z$, and hold each of $y$ and $z$ fixed to its respective value (in a sense, temporarily treating them as constants rather than as variables), we can consider $\sqrt{x^2+y^2+z^2}$ to be just a single-valued function of $x$, and write $f_{y,z}(x) = \sqrt{x^2+y^2+z^2}$; under the same conditions, we can treat $L_{y,z} = -\sqrt{1-y^2-z^2}$ as a constant. Then $$ \int_{-\sqrt{1-y^2-z^2}}^{\sqrt{1-y^2-z^2}} \sqrt{x^2+y^2+z^2}\, dx = \int_{-L_{y,z}}^{L_{y,z}} f_{y,z}(x)\, dx, \tag1 $$ which is just a single-valued definite integral of a function over $x$ defined in the usual way. When we choose any pair of real numbers $y$ and $z$ and treat them in this way, the integral on either side of Equation $(1)$ comes out to a certain value; it will always come out to the same value when we choose the same $y$ and $z$, although it may come out to a different value if we choose different real numbers $y$ and $z$. Therefore the integral is a function of $y$ and $z$, which we can write as $$ g(y,z) = \int_{-\sqrt{1-y^2-z^2}}^{\sqrt{1-y^2-z^2}} \sqrt{x^2+y^2+z^2}\, dx. $$

This means the inner double integral (over $x$ and $y$) can be rewritten: $$ \int_{-\sqrt{1-z^2}}^{\sqrt{1-z^2}} \left( \int_{-\sqrt{1-y^2-z^2}}^{\sqrt{1-y^2-z^2}} \sqrt{x^2+y^2+z^2}\, dx\right)dy = \int_{-\sqrt{1-z^2}}^{\sqrt{1-z^2}} g(y,z)\, dy. \tag2 $$

Now if we pick a single real number and hold $z$ to that value, we can write $g_z(y) = g(y,z)$ and treat this as a single-variable function of $y$, we can treat $M_z = \sqrt{1-z^2}$ as a constant, and we can rewrite the integral on the right side of Equation $(2)$: $$ \int_{-\sqrt{1-z^2}}^{\sqrt{1-z^2}} g(y,z)\, dy = \int_{-M_z}^{M_z} g_z(y)\, dy, $$ so again we have a definite integral over one variable. Again, this integral always has the same value whenever we choose the same value of $z$, though it may have a different value for a different choice of $z$; in other word, it is a function of $z$: \begin{align} h(z) &= \int_{-\sqrt{1-z^2}}^{\sqrt{1-z^2}} g(y,z)\, dy \\ &= \int_{-\sqrt{1-z^2}}^{\sqrt{1-z^2}} \int_{-\sqrt{1-y^2-z^2}}^{\sqrt{1-y^2-z^2}} \sqrt{x^2+y^2+z^2}\, dx\, dy. \end{align}

So the entire triple integral comes down to this: $$ \int_{-1}^1 \int_{-\sqrt{1-z^2}}^{\sqrt{1-z^2}} \int_{-\sqrt{1-y^2-z^2}}^{\sqrt{1-y^2-z^2}} \sqrt{x^2+y^2+z^2}\, dx\, dy\, dz = \int_{-1}^1 h(z)\, dz. $$

In short, the meaning of $x$ varying between two bounds that are given by functions of $y$ and $z$ is that for any particular values of $y$ and $z$, we just have a definite integral over $x$ between the bounds determined by those values of $y$ and $z$; and therefore the value of the integral itself is a function of $y$ and $z$. It's all not much different from saying that $$ \int_{-L}^L u^2\, du = \frac23 L^3, $$ where we can just as easily integrate $u^2$ between the bounds $u=-L$ and $u=L$ as between the bounds $u=-5$ and $u=5$, and the resulting expression $\frac23 L^3$ is clearly a function of $L$, so the integral is a function of $L$ as well.

  • $\begingroup$ I understand now, thank you. Just one more questiom, how would I go about changing the integrating limits methodically? I understand that this change from cartesian to spherical is really helpful, but there is an infinite number of variable changes that could occur. Is there a systematic method for determining the new limits given a change of variables $f(x,y,z)=(u,v,w)$? $\endgroup$ Sep 1 '16 at 3:16
  • $\begingroup$ In a triple integral over $du\,dv\,dw$ (with $u$ on the "inside"), in general for the middle and outer integrals you have to project the whole region of integration onto the $w$-axis to find the $w$ bounds and onto the $v,w$ axis to find the $v$ bounds (which then are a function of $w$). The $u$ bounds are in some sense simpler: given a $w$ and $v$ satisfying those variables' bounds, what values of $u$ are in the region? But watch out for "holes", for example when integrating over a torus in Cartesian coordinates. $\endgroup$
    – David K
    Sep 1 '16 at 12:33
  • $\begingroup$ To deal with "holes" or with regions bounded by a combination of surfaces with different formulas, often you might have to subdivide the region into pieces that don't have these problems and take the sum of the integrals over the pieces. How many pieces you need can depend greatly on which coordinates you use and in what order. I don't think there is any simple "do this then that" algorithm to give the best choice of coordinates and their sequence (or even a near-best choice) in all situations. Like the choice of variable substitutions in single-variable calculus, there's an art to it. $\endgroup$
    – David K
    Sep 1 '16 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.