\section{Change of Variables}

\subsection{Polar coordinates}
We now consider change of variables in double integration.  One of the more common changes of variables is the following.

\medskip
\noindent
\fbox{
\begin{minipage}{\textwidth}
\vspace{.2cm}

\begin{center}
\textbf{Polar Coordinates in $\mathbb{R}^2$}
\end{center}

\medskip

For $(x,y)$ in $\mathbb{R}^2$, let
\begin{equation}\label{eq:53eq1}
x = x(r,\theta) = r \cos \theta \quad \quad y = y(r, \theta) = r \sin \theta,
\end{equation} 
where
\begin{eqnarray*}
r = r(x,y) = \sqrt{x^2 + y^2}  & \quad & \textrm{(Distance to origin)} \\
\theta = \theta(x,y)  & \quad & \textrm{(Angle with horizontal axis)}
\end{eqnarray*}

\vspace{.2cm}
\end{minipage}
}



\medskip

\begin{figure}[h]
\centering
\includegraphics[width = .4\linewidth]{53fig1.pdf}
\caption{A point $(x,y)$ given in Cartesian coordinates can be rewritten in terms of its distance to the origin $r \geq 0$ and its angular orientation relative to the horizontal axis $0 \leq \theta < 2 \pi$.}
\end{figure}

We will always assume that $r=\sqrt{x^2+y^2}\geq 0$; the usual range of $\theta$ is $[0,2\pi]$, but it can be more convenient sometimes to use other intervals, for example $[-\pi,\pi]$.
Expressing $\theta$ in terms of $x$ and $y$ is a little bit tricky. We have $\tan\theta=y/x$, but this does not determine $\theta$ uniquely since $\tan\theta=\tan(\theta+\pi)$. We just have to work back from the $x=r\cos\theta$ and $y=\sin\theta$ formulas.

Many domains (e.g. discs) and functions (e.g. radially symmetric functions) have simple representations in polar coordinates, meaning that our calculations can be much simpler if we make the change of variables $(x,y) \mapsto (r \cos \theta, r \sin \theta)$. As such, we want to develop a formula for integration in polar coordinates.

\medskip

\subsection{Riemann Sums and Integrals in Polar Coordinates}
Assume that $f$ is continuous on a compact domain $D$, so that integrability is guaranteed.

\medskip

\begin{center}
\includegraphics[scale=.4]{53fig3.pdf}
\end{center}

\medskip

From the diagram, we see that
\begin{eqnarray*}
\textrm{(Area element)} & \quad & \Delta A_{ij} \approx \Delta r_j \cdot (r_j \Delta \theta_i) = r_j \Delta \theta_j \Delta r_j.
\end{eqnarray*}
Hence, if $P_{ij}^*$ is any element taken from the associated region, then we have
\begin{eqnarray*}
\textrm{(Riemann Sum)} & \quad & \sum_{i,j} f(P_{ij}^*) \Delta A_{ij} \approx \sum_{ij} f(P_{ij}^*) \underbrace{r_j \Delta \theta_i \Delta r_j}_{\textrm{Area element}}
\end{eqnarray*}
Taking an associated limit over partitions (as in Section 5.1 in Cartesian coordinates) we get
$$
\boxed{
\textrm{(Integral in Polar Coordinates)} = \iint_{D} f(r, \theta) r d \theta dr.}
$$
The term $r d \theta d r$ in the integral comes from the term $r_j \Delta \theta_i \Delta r_j$ in the Riemann sum.



\medskip
The Worked Problems below show how to use the above conversion formula in practice. In addition to evaluating proper integrals, 
we often use polar coordinates to evaluate improper integrals and/or to determine their convergence. Examples of that are also given below.


In the calculation of the conversion formula, we used $r_j \Delta \theta_i \Delta r_j$ as an approximate value of the area element. Actually, the indicated area can be calculated exactly. If $\Delta r_j = r_j-r_{j-1}$, then the area of the angular segment of the annulus is
$$
\frac{\Delta\theta_i}{2\pi} (\pi r_j^2-\pi r_{j-1}^2)=\frac{1}{2}\Delta\theta_i (r_j+r_{j-1})(r_j-r_{j-1})
= \frac{r_j+r_{j-1}}{2} \Delta\theta_i \Delta r_j.
$$
This is the same as our approximate value, but with a factor of $(r_j+r_{j-1})/2$ instead of just $r_j$. If we made this change in the Riemann sum above, it would still approximate the same integral.




\subsection{More General Changes of Variables} We will also use more general changes of variables
$x = x(u,v)$, $y = y(u,v)$. We will assume that both $x$ and $y$ are $C^1$ in the  $u$ and $v$  variables. We will need the {\bf Jacobian} $|\frac{\partial (x,y)}{\partial (u,v)}|$ defined in
Section 3.4.

\medskip
\noindent
\fbox{
\begin{minipage}{\textwidth}
\vspace{.2cm}

\begin{center}
\textbf{More General Variable Changes}
\end{center}

\medskip
If we assume that
$$
\frac{\partial (x,y)}{\partial (u,v)} 
= \left| \begin{matrix}
x_u & x_v \\
y_u & u_v
\end{matrix} \right|\neq 0,
$$
then the conversion formula for area elements is
\begin{equation}\label{eq:53eq2}
dA = dx dy = \left\vert \frac{\partial (x,y)}{\partial (u,v)} \right\vert du dv
\end{equation}


\vspace{.2cm}
\end{minipage}
}



\medskip

The conversion formula for polar coordinates follows this scheme
 with $u = r$ and $v = \theta$. Both
$
x(r, \theta) = r \cos \theta
$
and
$
y (r, \theta) = r \sin \theta
$
are $C^1$, with Jacobian 
$$
\left\vert \frac{\partial (x,y)}{\partial (r, \theta)} \right\vert=
\left| \begin{matrix}
\cos \theta & -r \sin \theta \\
\sin \theta & r \cos \theta
\end{matrix} \right|= r \cos^2 \theta + r \sin^2 \theta = r \underbrace{(\cos^2 \theta + \sin^2 \theta)}_{=1} = r.
$$
so that the area element is $dA = r dr d \theta$ as discussed above.
Question 4 in the Worked Problems Section features an integral involving a more general change of variables.

The assumption that $\frac{\partial (x,y)}{\partial (u,v)} \neq 0$ can sometimes be relaxed a little bit. In particular, we will sometimes allow the Jacobian to be $0$ at isolated points or on the boundary of the domain of integration. Polar coordinates provide a good example of this: if we integrate in polar coordinates on any region containing the origin, then the Jacobian at $(x,y)=(0,0)$ is $r=0$. This is fine. However, we do not want ``degenerate'' changes of variables. For example, if we let $x=u+v$ and also $y=u+v$ (with Jacobian equal to $0$ everywhere), then that does not even define $u$ and $v$ uniquely in the first place.




\subsection{Geometric interpretation of the Jacobian} The Jacobian term appearing in the area element formula \eqref{eq:53eq2} has a geometric interpretation, which we now explore. For simplicity, let us assume that the change of variables $(x,y) \mapsto (u,v)$ is linear, so that
$$
\begin{pmatrix}
x \\
y
\end{pmatrix}
=
A
\begin{pmatrix}
u \\
v
\end{pmatrix}
,
\hbox{ where }A=
\begin{pmatrix}
a_{11} & a_{12} \\
a_{21} & a_{22}
\end{pmatrix}
$$
Differentiating in $u$ and $v$ gets us $\begin{pmatrix} x_u & x_v\\ y_u& y_v\end{pmatrix}=A$ (you should check this!), so that the conversion formula above gives $dxdy=|\det(A)|\,dudv$.

Now, let us see what this means geometrically. In Cartesian coordinates, the area element corresponds to a rectangle, with sides parallel to the $\mathbf{i}$ and $\mathbf{j}$ directions, and with dimensions $\Delta u \times \Delta v$.  Applying the linear transformation gives
$$
A(\Delta u \mathbf{i}) = \Delta u (A\ii)= \Delta u (a_{11} \mathbf{i} + a_{21} \mathbf{j}), \, A(\Delta v) \mathbf{j} =\Delta v (A\jj) =\Delta v (a_{12} \mathbf{i} + a_{22} \mathbf{j})
$$
so that the image of our rectangle under the linear transformation $A$ is a parallelogram spanned by the two vectors above.


\begin{figure}[h]
  \centering
  \includegraphics[height=4cm]{53fig6.pdf}
  \captionof{figure}{In a linear change of variables, rectangles become parallelograms}
  \label{fig:test2}
\end{figure}



\begin{figure}[h]
\centering
\includegraphics[height=10cm]{53fig5.pdf}
\captionof{figure}{A more general change of variables}
\label{fig:test1}
\end{figure}





We have a formula for the area of a parallelogram in terms of the cross product:
\begin{eqnarray*}
\textrm{(Area of Parallelogram)} & = & \big\vert A(\Delta u \mathbf{i}) \times A (\Delta v \mathbf{j}) \big\vert = \left|  \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ a_{11} & a_{21} & 0 \\ a_{12} & a_{22} & 0 \end{vmatrix}  \right| \Delta u \Delta v \\
\quad & = &  \big\vert \det (A) \big \vert \Delta u \Delta v
\end{eqnarray*}
So, we see that the area element satisfies \eqref{eq:53eq2} in the special case when the change of variables $(x,y) \mapsto (u,v)$ is given by the linear transformation $A$. 


For general $C^1$ changes of variables,  we use the linear approximation of $x = x(u,v)$ and $y = y(u,v)$ near some point $P_{i,j}^* = (x_i, y_j)$. Let $(x,y)={\bf F}(u,v)$, then
$$
\begin{pmatrix}
x \\
y
\end{pmatrix}
\approx
\begin{pmatrix}
x_i \\
y_j
\end{pmatrix}
+
D{\bf f}
\begin{pmatrix}
\Delta u \\
\Delta v
\end{pmatrix}.
$$
where $D{\bf f}= \begin{pmatrix}
x_u & x_v \\
y_u & y_v
\end{pmatrix}$ is the derivative matrix evaluated at $(x_i, y_j)$ (see Section 3.4). Then the argument is as above, with $D{\bf f}$ playing the role of $A$, and the $C^1$ assumption guarantees that the error terms do not spoil the picture.

\subsection{A remark on computing the Jacobian}
It will often be to our advantage to define the new variables $u,v$ in terms of $x,y$ (as in Worked Problem 4 below). Instead of solving for $x,y$ in terms of $u,v$ and then computing the derivatives to find the Jacobian, we can proceed more directly by using the Implicit Function Theorem! Going back to Section 3.4, we can write formulas (3.4.4) and (3.4.5) together as 
$$
 \begin{vmatrix} u_x & u_y \\ v_x & v_y \end{vmatrix}
  \begin{vmatrix} x_u & x_v \\ y_u & y_v \end{vmatrix}=I,
  $$
the identity matrix. Taking the determinants, we get
$$
 \frac{\partial (x,y)}{\partial (u,v)} = \bigg(\frac{\partial (u,v)}{\partial (x,y)} \bigg)^{-1} .
 $$



\section*{Worked Problems}

\begin{enumerate}[1.]
\item{\it Find the volume under the paraboloid $z = 4 - x^2 - y^2$ and above the $xy$-plane.}

\begin{figure}[h]
\centering
\includegraphics[width = .6\linewidth]{53fig2.pdf}
\caption{The region and its intersection with the $xy$-axis.}
\end{figure}

\medskip
The volume is given by the integral
$$
\iint_{D} (4 - x^2 - y^2) d A, \,  \, \, D : = \{(x,y) : x^2 + y^2 \leq 4 \}.
$$
The key observation is that both the function $f(x,y) = 4 - x^2 - y^2$ and the region $D$ are \textit{radially symmetric}. This means that they only depend upon the distance $r = \sqrt{x^2 + y^2}$ from $(x,y)$ to the origin.  
So, we convert the integral to polar coordinates:
$$
f(x(r, \theta), y(r, \theta)) = f(r, \theta) = 4 - r^2
$$
$$
D : = \{(r, \theta) : r^2 \cos^2 \theta + r^2 \sin^2 \theta \leq 4 \} = \{(r, \theta) : 0 \leq r \leq 2, 0 \leq \theta < 2 \pi \}
$$
The associated area element is given by $dA = r dr d \theta$. Evaluating the integral, we have
\begin{eqnarray*}
\iint_D (4 - x^2 - y^2) d A & = & \int_0^2 dr \int_0^{2 \pi} d \theta \underbrace{(4 - r^2)}_{f(r, \theta)} \underbrace{r}_{\textrm{Jacobian}} = \int_0^2 \int_0^{2 \pi} (4r - r^3 )d \theta d r \\
\quad & = & 2 \pi \int_0^2 (4r - r^3) dr = 2 \pi \bigg[2 r^2 - \frac{r^4}{4} \bigg]_{r = 0}^{2} \\
\quad & = & 8 \pi
\end{eqnarray*}

\bigskip

\item{\it Evaluate the improper integral
$$
\iint_{\mathbb{R}^2} \frac{dA}{(1 + x^2 + y^2)^3}
$$
}

\medskip

We convert to polar coordinates, since
$$
\mathbb{R}^2 = \{(r,\theta) : 0 \leq r < \infty, 0 \leq \theta < 2 \pi \}
$$
$$
f(x(r,\theta), y(r,\theta)) = f(r, \theta) = \frac{1}{(1 + r^2)^3}
$$
so that both the integrand $f(x,y)$ and region $D = \mathbb{R}^2$ are radially symmetric.  We have
\begin{eqnarray*}
\iint_{\mathbb{R}^2} \frac{dA}{(1 + x^2 + y^2)^3} & = & \int_0^{2 \pi} d \theta \int_0^{\infty} \frac{r dr}{(1 + r^2)^3} = \int_0^{2 \pi} \bigg[\frac{-1}{4 (1 + r^2)^2} \bigg]_{r = 0}^{\infty} d \theta \\[1ex]
\quad  & = & \frac{1}{4} \int_0^{2 \pi}d \theta \\[1ex]
\quad & = &  \frac{\pi}{2}.
\end{eqnarray*}

\bigskip

\item{\it For which value(s) of $a \in \mathbb{R}$ is the integral $\iint_{D} (x^2 + y^2)^{-a} dA$ convergent, assuming that $D : = \{(x,y) : x^2 + y^2 \leq 1\}$?}

\medskip

Again, since our integrand and domain are both radially symmetric, we evaluate the associated (improper) integral in polar coordinates. We have
\begin{eqnarray*}
\iint_D (x^2 + y^2)^{-a} d A & = & \int_0^1 \int_0^{2 \pi} r^{-2 a} \cdot r d \theta d r \\
\quad & = & 2 \pi \int_0^1 r^{1 - 2 a} dr.
\end{eqnarray*}
Now, we have three cases depending upon the value of $a$
\begin{equation*}
 2 \pi \int_0^1 r^{1 - 2 a} dr =
 \begin{cases}
 2 \pi \frac{r^{2 - 2a}}{2 - 2a}\big\vert_{0}^{1} = \frac{\pi}{1 - a}, \textrm{ if } a < 1 \\[2ex]
 2 \pi \ln r \big\vert_{0}^1 = \infty, \textrm{ if } a = 1 \\[2ex]
 2 \pi \frac{r^{2 - 2a}}{2 - 2a}\big\vert_{0}^{1} = \infty, \textrm{ if } a > 1
 \end{cases}
\end{equation*}
In the first and third cases above, we used that if $a < 1$, then $2 - 2a > 0 $, so that $r^{2 - 2a} \vert_{r = 0} = 0$, whereas if $a > 1$, then $2 - 2a < 0$ and $r^{2 - 2a} \rightarrow \infty$ as $r \rightarrow 0$.  Hence, we see that the integral converges if and only if $a < 1$.

\bigskip

\item{\it Find the area of the region $D$ bounded by the curves $y = x$, $y = 4x$, $xy = 1$ and $xy = 2$.}

\begin{figure}[h]
\centering
\includegraphics[width = .5\linewidth]{53fig4.pdf}
\caption{The region bounded by the four curves. The dotted/dashed lines correspond to the non-linear coordinates introduced below.}
\end{figure}

\medskip
The area of $D$ is
$$
\textrm{Area of } D = \iint_{D} 1 d A.
$$
To evaluate the area integral, we will introduce ``non-linear'' coordinates adjusted to the shape of $D$. 
Specifically, let $u = xy$ and $v = \frac{y}{x}$.  Then we can rewrite $D$ in the new coordinates:
$$
\textrm{Bounded by } xy = 1, xy = 2 \Rightarrow 1 \leq u \leq 2,
$$
$$
\textrm{Bounded by } y = x, y = 4x \Rightarrow 1 \leq v \leq 4,
$$
\smallskip

so that $
D = \{(u,v) : 1 \leq u \leq 2, 1 \leq v \leq 4 \}.$

\medskip

Let us compute the Jacobian of the change of variables $(x,y) \mapsto (u,v)$. 
\begin{eqnarray*}
\quad & \, & \frac{\partial (u,v)}{\partial (x,y)} = \begin{vmatrix} u_x & u_y \\ v_x & v_y \end{vmatrix} = \begin{vmatrix} y & x \\ - \frac{y}{x^2} & \frac{1}{x} \end{vmatrix} = \frac{2y}{x} = 2 v \\[1ex]
\quad & \Rightarrow & \frac{\partial (x,y)}{\partial (u,v)} = \bigg(\frac{\partial (u,v)}{\partial (x,y)} \bigg)^{-1} = \frac{1}{2v}
\end{eqnarray*}
Now, by \eqref{eq:53eq2}, we have
\begin{eqnarray*}
\iint_{D} 1 d A & = & \int_{1}^{2} \int_{1}^{4} \frac{dv}{2 v} du = \frac{1}{2} \int_{1}^{2} \ln v \big\vert_{v = 1}^{v = 4} d u = \frac{1}{2} \ln 4 \int_{1}^{2} d u  \\[1ex]
\quad & = & \ln 2
\end{eqnarray*}



\end{enumerate}












\section*{Practice Problems}
\begin{enumerate}[1.]


\item Evaluate the double integrals:

\medskip

(a) $\displaystyle \iint_D y\, dA$, where $D=\{(x,y):\ y\geq 0,\ 1\leq x^2+y^2\leq 9\}$.


\medskip

(b) $\displaystyle \iint_{\mathbb{R}^2} \frac{dA}{(4+x^2+y^2)^5}$

\bigskip







\item {Evaluate the integral $\iint_D (\frac{x}{y}-1)dA$, if $D$ is the region in the first
quadrant bounded by the hyperbolas $x^2-y^2=1$, $x^2-y^2=4$, and the
lines $x=2y$, $x=3y$.  }

\medskip

\item {Use a change of variables to evaluate the integral ${\iint_D (x-y)dxdy}$,
where $D$ is the region in the first quadrant bounded by the hyperbolas $x^2-y^2=1$, 
$x^2-y^2=4$, and the lines $x+y=3$, $x+y=6$.}

\medskip

\item {Evaluate the area of the region in the first
quadrant bounded by the hyperbolas $xy=1$, $xy=5$, and the
parabolas $y=x^2$, $y=4x^2$.  (Hint: introduce new coordinates in which the region
of integration is a rectangle.)}

\medskip

\item {Determine whether the integral
$\displaystyle \iint_{\rr^2} \frac{|y| }{(1+ x^2+y^2)^3 }\, dA$ is convergent.}
\end{enumerate}




