\section{Integration in Three Variables}
This section focuses on integration of functions $f(x,y,z)$ over regions $R \subset \mathbb{R}^3$:
$$
\iiint_{R} f(x,y,z) dV, 
$$
where $dV$ indicates the 3-dimensional volume element. 

The general theory is essentially the same as in $\mathbb{R}^2$. The integral above is again defined as a limit of Riemann sums, except that this time we approximate a 3-dimensional region by unions of small 3-dimensional rectangular boxes. Integrability conditions, iterated integrals, and improper integrals are also similar conceptually to the 2D case. (Please make sure to check your textbook for details.)

We will also use change of variables in 3D integrals. As in the 2-dimensional case, this multiplies the volume element by a Jacobian factor. The following is essentially a 3D version of polar coordinates.


\medskip
\noindent
\fbox{
\begin{minipage}{\textwidth}
\vspace{.3cm} 
\begin{center}
\textbf{Triple Integrals in Cylindrical Coordinates}
\end{center}

\medskip

Cylindrical coordinates in $\mathbb{R}^3$ are related to Cartesian coordinates $(x,y,z)$ by making the change of variables $(x,y) \mapsto (r, \theta)$ to polar coordinates and preserving the $z$-variable.  That is,
\begin{equation}\label{eq:54eq1}
(x,y,z) \mapsto (r,\theta, z) \textrm{ where } x = r \cos \theta,  \, y = r \sin \theta,  \, z = z.
\end{equation}
In this coordinate system, we have
$$
dV = dx dy dz = r dr d \theta dz
$$
where the extra $r$ factor comes from the change of variables $(x,y) \mapsto (r,\theta)$. 

\medskip

The name \textit{cylindrical coordinates} comes from the fact that, for fixed $z = z_0$, the variables $(x,y,z) = (r \cos \theta, r \sin \theta,z_0)$ parametrize a (two dimensional) circle of radius $r$ at ``height'' $z_0$ in $\mathbb{R}^3$.  Allowing $z$ to vary from $z_0$ to $z_1$ (so that $z_0 \leq z \leq z_1$) we obtain a circular cylinder of diameter $2r$ and height $z_1 - z_0 = \Delta z$,
\end{minipage}
\vspace{.3cm}

}

\medskip

What becomes significantly more difficult in 3 dimensions is setting up the limits of integration in iterated integrals. The Worked Problemss section includes several common types of regions. Whenever you need to write a 3D integral as an iterated integral, we recommend very strongly that you draw a picture of the region (or find some other way to visualize it). It is very difficult to guess the iterated limits of integration without such visualization. It can also be helpful to draw more than one picture. For example, if you start by writing the volume integral as 
$$\iiint_D f(x,y,z)dV= \iint_X \left( \int_{g(x,y)}^{h(x,y)} f(x,y,z)dz \right) dydx$$
for some planar region $X$, you might want to draw pictures of both $D$ and $X$. See Worked Problems for examples of this.



\section*{Worked Problems}
\begin{enumerate}[1.]
\item{\it Find $\iiint_{D} e^{-z} dV$ if $D$ is the tetrahedron bounded by the coordinate planes and the plane $x+y+2z = 2$.}

\begin{figure}[h]
\centering
  \includegraphics[width=.5\linewidth]{54fig1.png}
  \caption{The region $D$ in Worked Problem 1.}
  \label{55fig1:sub1}
\end{figure}

\begin{figure}
  \centering
  \includegraphics[width=.4\linewidth]{54fig2.png}
  \caption{$D$ intersected with the $xy$-plane.}
  \label{55fig1:sub2}
\end{figure}

From Figures \ref{55fig1:sub1} and \ref{55fig1:sub2}, we see that for $(x,y,z)$ in $D$ we must have
$$
z \geq 0 \textrm{ and also } 2z \leq 2 - x - y \Rightarrow 0 \leq z \leq 1 - \frac{x}{2} - \frac{y}{2};
$$
the second condition follows since our segment begins at the $xy$ plane and terminates at the plane with equation $x + y + 2z = 2$.  For bounds on $y$ in terms of $x$, we use Figure  \ref{55fig1:sub2} to determine that
$$
0 \leq y \leq 2 -x,
$$
since our segment begins at the line $y = 0$ and terminates at the line $y = 2 - x$.  This also implies that $0 \leq x \leq 2$.  So, we write the volume integral as an iterated integral
$$
\iiint_{D} e^{-z} d V = \int_0^2 \int_0^{2 - x} \int_{0}^{1 - \frac{x}{2} - \frac{y}{2}} e^{-z} dz dy dx.
$$

\medskip
The calculation is as follows:
\begin{eqnarray*}
\int_0^2 \int_0^{2 - x} \int_{0}^{1 - \frac{x}{2} - \frac{y}{2}} e^{-z} dz dy dx & = & \int_0^2 \int_0^{2-x} (-e^{-z}) \big\vert_{z = 0}^{1 - \frac{x}{2} - \frac{y}{2}} dy dx \\
\quad & = & \int_0^2 \int_0^{2-x} (1 - e^{\frac{x}{2} + \frac{y}{2} - 1}) dy dx \\
\quad & = & \int_0^2 \bigg[y - 2 e^{\frac{x}{2} + \frac{y}{2} - 1} \bigg]_{y = 0}^{2 - x} dx  \\
\quad & = & \int_0^2 (2 - x - 2[e^{(\frac{x}{2} + \frac{2 - x}{2} - 1)}] + 2 e^{\frac{x}{2} - 1}) dx \\
\quad & = & \int_0^2 (2 - x - 2 + 2 e^{\frac{x}{2} - 1}) dx = \int_0^2 (2 e^{\frac{x}{2}-1} - x) dx \\
\quad & = & \bigg[4 e^{\frac{x}{2} - 1} - \frac{x^2}{2} \bigg]_{x=0}^{2} \\
\quad & = & 2 - 4e^{-1}
\end{eqnarray*}


\bigskip

\item{\it Find $\iiint_D y dV$ if $D$ is the spatial region bounded by the parabolic cylinder $y = x^2$, the plane $y + z = 4$ and the $xy$-plane (defined by the equation $z = 0$).}

\begin{figure}[h]
\centering
\includegraphics[width=.65\linewidth]{54fig3.png}
  \caption{The region $D$ in Worked Problem 2.}
  \label{55fig2:sub1}
\end{figure}






\begin{figure}
\centering
\includegraphics[width=.45\linewidth]{54fig4.png}
\caption{$D$ intersected with the $xy$-plane.}
\label{55fig2:sub2}
\end{figure}


\medskip
For fixed $(x,y)$, we examine Figure \ref{55fig2:sub1} above, determining that $0 \leq z \leq 4 - y$.  Then, fixing $x$ and examining Figure \ref{55fig2:sub2}, we have $x^2 \leq y \leq 4$ and $-2 \leq x \leq 2$.  This leads us to evaluate the volume integral as the iterated integral
$$
\iiint_{D} y d V = \int_{-2}^{2} \int_{x^2}^{4} \int_0^{4 - y} y dz dy dz
$$

\medskip
The calculation follows:
\begin{eqnarray*}
\int_{-2}^{2} \int_{x^2}^{4} \int_0^{4 - y} y dz dy dz & = & \int_{-2}^{2} \int_{x^2}^{4} \big[yz \big]_{z = 0}^{z = 4-y} dy dx = \int_{-2}^2 \int_{x^2}^4 (4y - y^2) dy dx \\
\quad & = & \int_{-2}^2 \bigg[2 y^2 - \frac{y^3}{3} \bigg]_{y = x^2}^{y = 4} dx = \int_{-2}^{2} \bigg[ 32 - \frac{64}{3} - 2 x^4 + \frac{x^6}{3} \bigg] dx \\
\quad & = & \bigg[32x - \frac{64 x}{3} - \frac{2x^5}{5} + \frac{x^7}{21} \bigg]_{-2}^{2}
\end{eqnarray*}
You can use your calculator to find the precise answer; up to three decimal places, this gives
$$
\int_{-2}^{2} \int_{x^2}^{4} \int_0^{4 - y} y dz dy dz \approx 29.257
$$


\bigskip



\item{\it Evaluate $\iiint_{D} z dV$ if $D$ is the solid region bounded by the $xy$-plane and the paraboloid $z = 4 - x^2 - y^2$. }





\bigskip
In cylindrical coordinates, our region $D$ can be written as
$$
D = \{(r, \theta, z) :\  0 \leq r \leq 2, \  0 \leq \theta \leq 2 \pi, \  0 \leq z \leq 4 - r^2 \}
$$
Notice that this gives the region $D$ with two parameters $r$ and $\theta$ independent of any variables--a fact which makes the iterated triple integral much easier to calculate. We have
$$
\iiint_{D} z dv =\int_0^{2 \pi} d \theta \int_{0}^2 dr \int_0^{4 - r^2} z r dz 
$$
where the $r$ term comes from the Jacobian induced by our change of variables $(x,y,z) \mapsto (r,\theta, z)$. 
The calculation is:
\begin{align*}
 \int_0^{2 \pi} d \theta  &\int_{0}^2 dr \int_0^{4 - r^2} z r dz \\
\ \ & =  \int_0^{2 \pi} d \theta \int_{0}^2 dr \bigg[\frac{z^2r}{2} \bigg]_{z = 0}^{z = 4 - r^2} = \int_0^{2 \pi} d \theta \int_{0}^2 \frac{1}{2}(4 - r^2)^2 r \, dr\\
\quad & =  \int_0^{2 \pi} d \theta \int_{0}^2 \frac{1}{2}(16r - 8r^3 + r^5) dr = \frac{1}{2} \int_0^{2\pi} \bigg[8 r^2 - 2 r^4 + \frac{r^6}{6} \bigg]_0^2 d \theta \\
\quad & =  \frac{1}{2} \int_0^{2 \pi} \big[ 32 - 32 + \frac{64}{6} \big] d \theta = \frac{1}{2} \int_0^{2 \pi} \frac{32}{3} d \theta \\[1ex]
\quad & =  \frac{32 \pi}{3}
\end{align*}

\item{\it Find $\iiint_D xz dV$ if $D$ is bounded by the planes $z = 0$, $z = 2$, $x = y$, $y = 0$ and also the cylinder $x^2 + y^2 \leq 1$ with $x,y > 0$.}

\begin{figure}[h]
\centering
\includegraphics[width=.30\linewidth]{54fig6.png}
\caption{The region $D$ in Worked Problem 4.}

\label{55fig4:sub1}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=.4\linewidth]{54fig7.png}
\caption{$D$ intersected with the $xy$-plane.}
\label{55fig4:sub2}
\end{figure}

In cylindrical coordinates, our region has a simple description:
$$
D : = \{ (r,\theta, z) : \ 0 \leq \theta \leq \frac{\pi}{4}, \ 0 \leq r \leq 1, \ 0 \leq z \leq 2 \}
$$
so that the bounds on $r$, $\theta$ and $z$ in our region $D$ do not involve any of the other variables. Using $x = r \cos \theta$, and multiplying by the Jacobian factor $r$, we have
$$
\iiint_{D} xz dV = \int_0^{\frac{\pi}{4}} \int_0^1 \int_0^2  (r \cos \theta) z r dz d r d \theta = \int_0^{\frac{\pi}{4}} d \theta \int_0^1 d r \int_0^2 
z r^2 \cos \theta dz$$

\medskip
Notice that, since $f(r, \theta, z) = f_1 (r) f_2 (\theta) f_3 (z)$, where $f_1(r) = r^2$, $f_2(\theta) = \cos \theta$, and $f_3 (z) = z$, we obtain
\begin{eqnarray*}
\int_0^{\frac{\pi}{4}} d \theta \int_0^1 d r \int_0^2 
z r^2 \cos \theta dz & = & \bigg( \int_0^{\frac{\pi}{4}} \cos \theta d\theta \bigg) \bigg(\int_0^1 r^2 dr \bigg) \bigg(\int_0^2 z dz \bigg).
\end{eqnarray*}
This equality \textit{only makes sense} because both the function $f(r,\theta, z)$ \textit{and also} the region $D$ can be written in such a way that our variables $r$, $\theta$ and $z$ are independent of one another.  Evaluating each of these three integrals separately gives
$$
\iiint_{D} xz dV = \bigg( \sin \theta \Big\vert_0^{\frac{\pi}{4}} \bigg) \cdot \bigg(\frac{r^3}{3} \Big\vert_0^1 \bigg) \cdot \bigg(\frac{z^2}{2}\Big\vert_0^2 \bigg) = \frac{\sqrt{2}}{3}
$$
\end{enumerate}

\section*{Practice Problems}
\begin{enumerate}[1.]
\item
{Let $R$ be the solid region in $\rr^3$ bounded by the planes
$x=0$, $y=0$, $z=0$, and $x+2y+z=6$.
Write 
$$\displaystyle{\iiint_R  f(x,y,z)dV}$$ as iterated integrals
where the order of integration is (a) $dzdydx$, (b) $dydxdz$.}

\medskip



\item {Evaluate the integral
$\displaystyle \iiint_D y\, dV,$
 if $D$ is the tetrahedron with vertices $(0,0,0)$, $(4,2,0)$, $(0,2,0)$, and $(0,2,4)$.
}
 
\medskip


\item{Let $D$ be the spatial region above the $xy$-plane, inside the cylinder $x^2+y^2=1$,
and inside the sphere $x^2+y^2+ z^2 = 4$. Evaluate the integral $\iiint_D z dV$. }


\item 
Evaluate the integral
$\displaystyle \iiint_{R} x \, dV$,
if 
$R=\{(x,y,z):\ 0\leq z\leq y\leq x,\ x^2+y^2\leq 1\}$. 



\end{enumerate}




