\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumerate}
\usepackage{ifthen}
\usepackage{ulem} % for strikethrough \sout{...} command
\usepackage{color}
\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0.0in}
\setlength{\headsep}{0.0in}
\setlength{\topskip}{0.0in}
\setlength{\textheight}{9.5in}
\setlength{\textwidth}{7.5in}

\usepackage{tikz,pgfplots}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{arrows.meta}

\newcommand{\bdot}{\, {\scriptstyle{\bullet}} \,}
\newcommand{\B}[1]{{\bf {#1}}}
\newcommand{\la}{\langle}
\newcommand{\ra}{\rangle}

\newcommand{\myspace}{\parbox[c][0.2in]{0.2in}{\hfill}}
\newcommand{\varspace}[2]{\mbox{\parbox[c][#1]{#2}{\hfill}}}
\newcommand{\force}{{\noindent{}$\mbox{\,\!}$}}

\begin{document}

%\pagestyle{empty}

\noindent
\parbox{2in}{\bf Math 2130}
\hfill {\Large \bf Test \#3} \hfill
\parbox{2in}{\bf \hfill April $14^\mathrm{th}$\!,\  2021}

\vspace{0.05in}

\noindent {\large\bf Name:} \underline{\large\sc\color{red}\quad Answer Key\quad}
\hfill {\bf Be sure to show your work!}

\vspace{0.05in}

\noindent {\bf\large 1. (12 points)} The following are plots of several vector fields. Please note that all of the vectors have been scaled down so they do not overlap each other. Write A, B, and C next to the appropriate vector field's formula. Put an X next to the formula whose vector field is {\bf not} shown. Also, for each vector field \underline{is $\B F$ conservative}? Circle ``Yes'' or ``No''.

\force
\hfill
\begin{tikzpicture}[scale=0.5]
\begin{axis}[
    axis lines=middle,
    view={0}{90},
    domain=-4:4,
    y domain=-4:4,
    xmax=5, ymax=5,
    samples=6,
    color=gray
]
\addplot3 [black, quiver={u={-y}, v={x}, scale arrows=0.25, every arrow/.append style={-latex}}] (x,y,0);
\end{axis}
\end{tikzpicture}
\hfill
\hfill
\begin{tikzpicture}[scale=0.5]
\begin{axis}[
    axis lines=middle,
    view={0}{90},
    domain=-4:4,
    y domain=-4:4,
    xmax=5, ymax=5,
    samples=6,
    color=gray
]
\addplot3 [black, quiver={u={-x}, v={-y}, scale arrows=0.25, every arrow/.append style={-latex}}] (x,y,0);
\end{axis}
\end{tikzpicture}
\hfill \hfill
\begin{tikzpicture}[scale=0.5]
\begin{axis}[
    axis lines=middle,
    view={0}{90},
    domain=-4:4,
    y domain=-4:4,
    xmax=5, ymax=5,
    samples=6,
    color=gray
]
\addplot3 [black, quiver={u={y}, v={1}, scale arrows=0.25, every arrow/.append style={-latex}}] (x,y,0);
\end{axis}
\end{tikzpicture}
\hfill
\force

\vspace{0.05in}

\force
\hspace{1.05in}
{\LARGE\bf A}
\hfill
{\LARGE\bf B\ }
\hfill
{\LARGE\bf C}
\hspace{1.05in}
\force

\vspace{0.1in}

\force %\hspace{-0.25in}
\quad
\fbox{\LARGE\bf C} $\B F(x,y) = \la y, 1 \ra$ \hfill
\fbox{\LARGE\bf X} $\displaystyle \B F(x,y) = \left\la x, y \right\ra$ \hfill
\fbox{\LARGE\bf B} $\B F(x,y) = \la -x, -y \ra$ \hfill
\fbox{\LARGE\bf A} $\B F(x,y) = \la -y, x \ra$ 
\quad
\force

\vspace{0.05in}

\force \qquad
\qquad
Yes / \fbox{No} \hfill
\fbox{Yes} / No \hfill
\fbox{Yes} / No \hfill
Yes / \fbox{No}
\qquad \force

\vspace{0.05in}

To match up formulas, notice that in the first plot the arrow around $(1,1)$ points up and left. Plugging $(1,1)$ into the formulas yields: $\langle 1,1 \rangle$, $\langle 1,1 \rangle$, $\langle -1,-1 \rangle$, and $\langle -1,1 \rangle$ respectively. Only the last formula matches. The middle plot's vector at $(1,1)$ points down and left. Only the third formula matches. Finally, the last plot's arrows are all tilted upward (at least a little). This would be true of $\B F = \langle y,1 \rangle$ but not of $\B F=\langle x,y \rangle$ (since this second formula would yield arrows pointing downward when $y<0$). Thus the last plot goes with the first formula. The second formula's vector field was not plotted (although it looks like plot B with the arrows reversed).

Next, recall that for a vector field, $\B F=\langle M,N \rangle$ defined on all of $\mathbb{R}^2$, $\B F$ is conservative if and only if $M_y=N_x$. If we have $\B F=\langle y,1 \rangle$, then $M=y$ and $N=1$ so $M_y=1 \not= 0=N_x$. Thus $\B F=\langle y,1 \rangle$ is not conservative. For the remaining formulas out calculations are: $M_y=0=N_x$, $M_y=0=N_x$, and $M_y=-1\not=1=N_x$ respectively. Thus the middle vector fields are conservative but the last one is not.

\vspace{0.05in}

\noindent {\bf\large 2. (10 points)} Use a double Riemann sum to approximate $\iint\limits_R y\cos(x^2+1)\,dA$ where $R=[-8,8] \times [0,4]$. 

Use midpoint rule and a $2 \times 2$ grid of rectangles ($2$ across and $2$ up) to partition $R$. \hfill (Don't worry about simplifying.)

\vspace{0.05in}

\begin{minipage}{2.5in}
\begin{tikzpicture}
\begin{axis}[
  %axis x line=middle, axis y line=middle,
  axis x line = none,
  axis y line = none,
  ticks = none,
  width=8cm, height=5.5cm,     % size of the image = rigged to keep scaling=constrained
  ymin=-1.5, ymax=4.5, % ytick={0}, ylabel=$y$,
  xmin=-8.75, xmax=9.8, % xtick={0}, xlabel=$x$,
]

\addplot[domain=-8:8] ({x},{0});
\addplot[domain=-8:8] ({x},{2});
\addplot[domain=-8:8] ({x},{4});

\addplot[domain=-8.2:-7.75] ({x},{1});
\addplot[domain=-8.2:-7.75] ({x},{3});

\addplot[domain=0:4] ({-8},{x});
\addplot[domain=0:4] ({0},{x});
\addplot[domain=0:4] ({8},{x});

\addplot[domain=-0.1:0.15] ({-4},{x});
\addplot[domain=-0.1:0.15] ({4},{x});

\node at (axis cs:-8.45,0) {$0$};
\node at (axis cs:-8.45,2) {$2$};
\node at (axis cs:-8.45,4) {$4$};

\node at (axis cs:-8.45,1) {$1$};
\node at (axis cs:-8.45,3) {$3$};

\node at (axis cs:-8,-0.4) {$-8$};
\node at (axis cs:0,-0.4) {$0$};
\node at (axis cs:8,-0.4) {$8$};

\node at (axis cs:-4,-0.4) {$-4$};
\node at (axis cs:4,-0.4) {$4$};


\addplot[domain=-8:0] ({x},{-0.9});
\addplot[domain=-1.05:-0.75] ({-8},{x});
\addplot[domain=-1.05:-0.75] ({0},{x});

\node at (axis cs:-4,-1.3) {$\Delta x=8$};

\addplot[domain=0:2] ({8.75},{x});
\addplot[domain=8.55:8.9] ({x},{0});
\addplot[domain=8.55:8.9] ({x},{2});

\node [rotate=90] at (axis cs:9.4,0.95) {$\Delta y=2$};

\node [fill=black, shape=circle, inner sep=1pt, label=below:{$(-4,1)$}] at (axis cs: -4,1) {};
\node [fill=black, shape=circle, inner sep=1pt, label=below:{$(4,1)$}] at (axis cs: 4,1) {};
\node [fill=black, shape=circle, inner sep=1pt, label=below:{$(-4,3)$}] at (axis cs: -4,3) {};
\node [fill=black, shape=circle, inner sep=1pt, label=below:{$(4,3)$}] at (axis cs: 4,3) {};


\end{axis}
\end{tikzpicture}
\end{minipage} \hfill
\begin{minipage}{4.5in}
Our rectangle $R$ is $8-(-8)=16$ units across so dividing up into two pieces gives us $\Delta x = 16/2= 8$. Likewise, $R$ is 4 units tall so $\Delta y =4/2=2$. It is easy then to specify partition points and mark down midpoints. Therefore,

\vspace{0.05in}

$\displaystyle \iint_R y\cos(x^2+1)\,dA \approx$ 

\vspace{0.05in}

\fbox{\!{}$\displaystyle 8 \cdot 2 \cdot \Big(1\cos((-4)^2+1)+1\cos(4^2+1)+3\cos((-4)^2+1)+3\cos(4^2+1)\Big)${}\!\!}

\end{minipage}

\vspace{0.05in}

\noindent {\bf\large 3. (7 points)} Let $\B F(x,y,z) = \la 10, xyz, e^x \ra$ and $C$ be the curve parameterized by $\B r(t) = \left\la t^2,t^4,t^6 \right\ra$ where $-7 \leq t \leq 9$.

Set up but {\bf do not} evaluate the line integral: $\displaystyle \int_C \B F \bdot d\B r$.

\vspace{0.05in}

Notice that $\B r'(t) =\langle 2t,4t^3,6t^5 \rangle$. Our parameterization $\B r(t)$ tells us that $x=t^2$, $y=t^4$, and $z=t^6$. Therefore, 

$\displaystyle \int_C \B F \bdot d\B r = \int_{-7}^9 \B F(\B r(t)) \bdot \B r'(t)\,dt = \int_{-7}^9 \langle 10, t^2 \cdot t^4 \cdot t^6, e^{t^2} \rangle \bdot \langle 2t, 4t^3, 6t^5 \rangle \,dt =$ \fbox{$\displaystyle \int_{-7}^9 \left(20t+4t^{15}+6t^5e^{t^2}\right)\,dt$}

\vspace{0.05in}

\noindent {\bf\large 4. (13 points)} Let $R$ be the annular region between $x^2+y^2=1$ and $x^2+y^2=4$ where $y \geq 0$ (pictured below).\\ 
\force \hfill [{\it Warning:} One of the integrals below will have to be split into {\it several} pieces.]

\vspace{0.1in}

\begin{minipage}{4in}
\begin{enumerate}[(a)]
%\item Sketch the region $R$.
\item Set up the integral $\displaystyle\iint\limits_R y\,dA$ in polar coordinates.
\item Set up the integral $\displaystyle\iint\limits_R y\,dA$ rectangular coordinates.
\end{enumerate}
\end{minipage}
\hfill
\begin{minipage}{2.5in}
% plot of wedge of circle as in Fall 2016's test #3 problem 3
%
%\begin{tikzpicture}
%\begin{axis}[
%  axis x line=middle, axis y line=middle,
%  width=5cm, height=2.5/3*5cm,     % size of the image = rigged to keep scaling=constrained
%  ymin=-0.5, ymax=2, ytick={0}, ylabel=$y$,
%  xmin=-0.5, xmax=2.5, xtick={0}, xlabel=$x$,
%]
%
%% fix glitchy fill 
%\addplot[name path=C,black!15, domain=0:1, smooth] ({2*x}, {0});
%\addplot[name path=D,black!15, domain=0:1, smooth] ({sqrt(2)*(1-x)}, {sqrt(2)*(1-x)});
%\addplot[black!15] fill between[of=C and D];
%\addplot[black, domain=0:1, smooth] ({2*x},{0});
%
%\addplot[name path=A,black, thick, domain=0:45, smooth] ({2*cos(x)}, {2*sin(x)});
%\addplot[name path=B,black, thick, domain=0:sqrt(2), smooth] ({x}, {x});
%
%\addplot[black!15] fill between[of=A and B];
%
%\node at (axis cs:1,0.4) {$R$};
%
%\end{axis}
%\end{tikzpicture}
%
\begin{tikzpicture}[scale=0.7]
\begin{axis}[
  %axis x line=middle, axis y line=middle,
  axis x line = none,
  axis y line = none,
  ticks = none,
  width=8cm, height=5.5cm,     % size of the image = rigged to keep scaling=constrained
  ymin=-0.5, ymax=2.5, % ytick={0}, ylabel=$y$,
  xmin=-2.5, xmax=2.5, % xtick={0}, xlabel=$x$,
]

\addplot[name path=A,black, thick, domain=0:180, smooth] ({2*cos(x)}, {2*sin(x)});
\addplot[name path=B,black, thick, domain=0:180, smooth] ({cos(x)}, {sin(x)});

\addplot[thick, domain=-2:-1] ({x},{0});
\addplot[thick, domain=1:2] ({x},{0});

\addplot[yellow!50] fill between[of=A and B];

% redraw wiped out portion of axes
%\addplot[black, domain=-4:5, smooth] ({0}, {x});
%\addplot[black, domain=-3:2, smooth] ({x}, {0});

\node at (axis cs:0.4,1.35) {$2$};
\node at (axis cs:0.4,0.35) {$1$};

\addplot[blue, dashed, thick, domain=0:2, smooth] ({x*cos(80)}, {x*sin(80)});
\addplot[blue, dashed, thick, domain=0:1, smooth] ({x*cos(60)}, {x*sin(60)});

\addplot[red, ultra thick, domain=0:1.73, smooth] ({-1}, {x});
\addplot[red, ultra thick, domain=0:1.73, smooth] ({1}, {x});

\node [label=below:{$-2$}] at (axis cs:-2,0) {};
\node [label=below:{$-1$}] at (axis cs:-1,0) {};
\node [label=below:{$1$}] at (axis cs:1,0) {};
\node [label=below:{$2$}] at (axis cs:2,0) {};

\node at (axis cs:-1.5,0.5) {$R_1$};
\node at (axis cs:-0.35,1.45) {$R_2$};
\node at (axis cs:1.5,0.5) {$R_3$};
\end{axis}
\end{tikzpicture}
\end{minipage}

\newpage

For polar coordinates, imagine a ray emanating from the origin. We enter the region when $r^2=x^2+y^2=1$ and exit when $r^2=x^2+y^2=4$. Thus $1 \leq r \leq  2$. Also, since $y \geq 0$, we need to restrict our angle: $0 \leq \theta \leq \pi$ (from the positive $x$-axis to the negative $x$-axis). Keeping in mind $y=r\sin(\theta)$ and the Jacobian $J=r$, we get that

\vspace{-0.1in}

$$\text{Answer (a):} \quad \iint_R y\,dA = \int_0^\pi \int_1^2 r\sin(\theta) \cdot r\,dr\,d\theta $$

\vspace{-0.05in}

For rectangular coordinates, while $R$ is a $y$-simple region, it is not an $x$-simple region (because of the notch cut out of the bottom). Now, even though the region is $y$-simple, to set up the integral in rectangular coordinates we need to break up $R$ into 3 pieces. Why? The bottom of the region changes formulas a few times. First, we have the $x$-axis: $y=0$, then the upper half of the unit circle: $y=\sqrt{1-x^2}$, and finally the $x$-axis: $y=0$ again. The top of $R$ is easier. It is just the upper half of $x^2+y^2=4$ (i.e., $y=\sqrt{4-x^2}$). Notice that the first piece corresponds to $-2\leq x \leq -1$, the second piece to $-1\leq x \leq 1$, and the third piece to $1 \leq x \leq 2$. Why? Just consider the radii of the circles.

\vspace{-0.1in}

$$\text{Answer (b):} \quad \iint_R y\,dA = \int_{-2}^{-1}\int_0^{\sqrt{4-x^2}} y\,dy\,dx + \int_{-1}^1 \int_{\sqrt{1-x^2}}^{\sqrt{4-x^2}} y\,dy\,dx + \int_1^2\int_0^{\sqrt{4-x^2}} y\,dy\,dx$$

\vspace{-0.05in}

Alternatively, we could integrate over the upper half disk: $x^2+y^2 \leq 4$, $y \geq 0$ and remove the upper half unit disk: $x^2+y^2 \leq 1$, $y \geq 0$. Therefore,

\vspace{-0.2in}

$$\text{Alternate answer (b):} \quad \iint_R y\,dA = \int_{-2}^2\int_0^{\sqrt{4-x^2}} y\,dy\,dx - \int_{-1}^1\int_0^{\sqrt{1-x^2}} y\,dy\,dx$$

\vspace{-0.1in}

(c) Find the centroid of $R$.

\vspace{0.05in}

Since $R$ is symmetric across the $y$-axis (i.e., $x=0$), we have that $\bar{x}=0$. Also, $m=\iint_R 1\,dA$ is just the area of our annular region. Thus $m = \frac{\pi 2^2 - \pi 1^2}{2} = \frac{3\pi}{2}$. Therefore, we only need to compute $M_x=M_{y=0}=\iint_R y\,dA$. Obviously, part (a)'s set up is the best way to go:

\vspace{-0.15in}

\force \hfill
$\displaystyle M_x=\iint_R y\,dA = \int_0^\pi\int_1^2 r^2\sin(\theta)\,dr\,d\theta = \int_0^\pi \sin(\theta)\,d\theta \int_1^2 r^2\,dr = 2 \cdot \dfrac{r^3}{3}\Big|_1^2 = \dfrac{2}{3}(8-1) = \dfrac{14}{3}$

\noindent
Thus $\bar{y}=\dfrac{M_x}{m} = \dfrac{14/3}{3\pi/2} = \dfrac{28}{9\pi}$. Therefore, \fbox{$(\bar{x},\bar{y}) = \left(0,\dfrac{28}{9\pi}\right)$}.

\noindent {\bf\large 5. (11 points)} Consider $\displaystyle \int_0^2 \int_{3x}^6 \sin(y^2)\,dy\,dx$. 

\begin{enumerate}[(a)]
\item Sketch the corresponding region of integration.
\item Compute the iterated integral. \qquad {\it Hint:} You cannot integrate $\int \sin(y^2)\,dy$ in terms of elementary functions.
\end{enumerate}

\vspace{0.15in}

\begin{minipage}{2in}
\begin{tikzpicture}[scale=0.8]
\begin{axis}[
  %axis x line=middle, axis y line=middle,
  axis x line = none,
  axis y line = none,
  ticks = none,
  width=8cm, height=5.5cm,     % size of the image = rigged to keep scaling=constrained
  ymin=-1, ymax=6.5, % ytick={0}, ylabel=$y$,
  xmin=-0.75, xmax=2.75, % xtick={0}, xlabel=$x$,
]

\addplot[name path=A,yellow!10, domain=0:6, smooth] ({0}, {x});
\addplot[name path=B,yellow!10, domain=0:6, smooth] ({x/3}, {x});
\addplot[yellow!50] fill between[of=A and B];

\addplot[<->, black, domain=-1:6.5] ({0},{x});
\addplot[<->, black, domain=-0.75:2.75] ({x},{0});

\addplot[blue, ultra thick, domain=-0.5:2.5] ({x},{3*x});
\addplot[blue, ultra thick, domain=-0.75:2.75] ({x},{6});
\addplot[blue, ultra thick, dashed, domain=-1:6.5] ({2},{x});
\addplot[blue, ultra thick, dashed, domain=-1:6.5] ({0},{x});

\node at (axis cs:0.5,3.5) {$R$};
\node at (axis cs:2.35,2.5) {$x=2$};
\node at (axis cs:1.4,2.65) {$y=3x$};
\node at (axis cs:-0.4,5.4) {$y=6$};

\end{axis}
\end{tikzpicture}
\end{minipage}
\hfill
\begin{minipage}{4.75in}
Our bounds of integration are: $3x \leq y \leq 6$ and $0 \leq x \leq 2$. So we integrate from the line $y=3x$ up to the horizontal line $y=6$. This is done for $x$'s ranging from $x=0$ over to $x=2$. Notice that $(x,y)=(2,6)$ is where our lines intersect. 

Now we cannot integrate with respect to $y$ first since $\sin(y^2)$ has no elementary anti-derivative. Thus we must {\it reverse the order of integration}. Notice that as an $x$-simple region, we go from the $y$-axis (i.e., $x=0$) over to the line $y=3x$ (i.e., $x=y/3$). Then we range from $y=0$ up to $y=6$. Thus our bounds are $0 \leq x \leq y/3$ and $0 \leq y \leq 6$. Our integral is:
\end{minipage}

$$=\iint_R \sin(y^2)\,dA = \int_0^6 \int_0^{y/3} \sin(y^2)\,dx\,dy = \int_0^6 x\sin(y^2)\Bigg|_0^{y/3} \,dy = \int_0^6 \dfrac{y}{3}\sin(y^2)-0\,dy = \dfrac{-\cos(y^2)}{6}\Bigg|_0^6$$

where we used a simple $u$-substitution to integrate $y\sin(y^2)$ (i.e., $u=y^2$ and $du/2=y\,dy$). Therefore, our integral evaluates to $\dfrac{-\cos(6^2)}{6}-\dfrac{-\cos(0^2)}{6} =$ \fbox{$\dfrac{1-\cos(36)}{6}$}.

\vspace{0.1in}

\noindent {\bf\large 6. (11 points)} {\bf Set up} the integral $\displaystyle\iint\limits_{R} e^{(x-y)^2}\,dA$ where $R$ is the region bounded by the lines $y=x-3$, $y=x-4$, $y=-2x$, and $x=0$. {\it Note:} Use the change of coordinates: \fbox{$u=2x+y$ and $v=x-y$}. {\bf DO NOT} evaluate this integral.

\vspace{0.05in}

We need to transform our function (this is easy since $v=x-y$ so that $e^{(x-y)^2}=e^{v^2}$), transform our bounds, and compute our Jacobian. We have $\dfrac{\partial(u,v)}{\partial(x,y)} = \det \begin{bmatrix} u_x & u_y \\ v_x & v_y \end{bmatrix} = \det \begin{bmatrix} 2 & 1 \\ 1 & -1 \end{bmatrix} = 2(-1)-1(1)=-3$. But this is backwards since we should compute old variables in terms of new variables. Thus our Jacobian is $J = \dfrac{\partial(x,y)}{\partial(u,v)} = 1\Big/\dfrac{\partial(u,v)}{\partial(x,y)} = -1/3$.

Next, we need to transform our bounds: $x-y=3$, $x-y=4$, $2x+y=0$, and $x=0$. Since $u=2x+y$ and $v=x-y$, the first three are easy to transform: $v=3$, $v=4$, $u=0$. Our last bound says $x=0$ so that $u=2(0)+y$ and $v=0-y$. Thus $u=y=-v$. We can sketch these bounds and find that our integral is most easily set up as a $u$-simple region.

\vspace{0.05in}

\noindent
\begin{minipage}{4.75in}
Thus our region has bounds $-v \leq u \leq 0$ and $3 \leq v \leq 4$. Don't forget to take the absolute value of the Jacobian! We get that\dots

\vspace{-0.15in}

$$\iint_R e^{(x-y)^2}\,dA = \mbox{\fbox{$\displaystyle \int_3^4 \int_{-v}^0 e^{v^2}\cdot \dfrac{1}{3}\,du\,dv$}} = \int_3^4 \dfrac{1}{3}ue^{v^2}\Bigg|_{-v}^0\,dv = \int_3^4 0-\dfrac{1}{3}(-v)e^{v^2}\,dv$$

\vspace{-0.1in}

$$=\int_3^4 \dfrac{1}{3}ve^{v^2}\,dv = \dfrac{1}{6}e^{v^2}\Bigg|_3^4 = \dfrac{e^{16}-e^{9}}{6}$$

{}{\it Note:} I went ahead and integrated, but we only needed to set this up. The official answer is the boxed one.
\end{minipage}
\hfill
\begin{minipage}{2in}
\begin{tikzpicture}[scale=0.8]
\begin{axis}[
  %axis x line=middle, axis y line=middle,
  axis x line = none,
  axis y line = none,
  ticks = none,
  width=8cm, height=5.5cm,     % size of the image = rigged to keep scaling=constrained
  ymin=-1, ymax=5, % ytick={0}, ylabel=$y$,
  xmin=-5, xmax=1.15, % xtick={0}, xlabel=$x$,
]

\addplot[name path=A,yellow!10, domain=-3:0, smooth] ({x}, {3});
\addplot[name path=B,yellow!10, domain=-3:0, smooth] ({x}, {4});
\addplot[yellow!50] fill between[of=A and B];
\addplot[name path=AB,yellow!10, domain=-4:-3, smooth] ({x}, {-x});
\addplot[name path=BB,yellow!10, domain=-4:-3, smooth] ({x}, {4});
\addplot[yellow!50] fill between[of=AB and BB];

\addplot[blue, ultra thick, domain=-5:1] ({x},{3});
\addplot[blue, ultra thick, domain=-5:1] ({x},{4});
\addplot[blue, ultra thick, domain=-1:5] ({0},{x});
\addplot[blue, ultra thick, domain=-5:1] ({x},{-x});

\node at (axis cs:-1.65,3.5) {$R$};
\node at (axis cs:0.6,2) {$u=0$};
\node at (axis cs:-0.85,2.65) {$v=3$};
\node at (axis cs:-0.85,4.35) {$v=4$};
\node at (axis cs:-2.75,1.5) {$v=-u$};
\end{axis}
\end{tikzpicture}
\end{minipage}

\vspace{0.05in}

\noindent {\bf\large 7. (10 points)} Let $E$ be the region bounded by $z=x^2+y^2+1$ and $z=5$. Compute the integral $\displaystyle\iiint_E \dfrac{1}{\sqrt{x^2+y^2}}\,dV$.

\noindent
\begin{minipage}{1.45in}
\pgfplotsset{
  /pgfplots/colormap={mypink}{%
    color(0cm) = (purple);
    color(1cm) = (pink!80!purple);
    color(2cm) = (pink!90);
    color(3cm) = (pink) }
}
\pgfplotsset{
  /pgfplots/colormap={myblue}{%
    color(0cm) = (blue!55);
    color(1cm) = (blue!60);
    color(2cm) = (blue!65);
    color(3cm) = (blue!70) }
}
\pgfplotsset{
  /pgfplots/colormap={mygreen}{%
    color(0cm) = (green!40);
    color(1cm) = (green!60);
    color(2cm) = (green!80);
    color(3cm) = (green) }
}
\begin{tikzpicture}
    \begin{axis}[%
        axis equal,
        width=7cm,
        height=7cm,
        axis lines = none,  % vs. center
%        xlabel = {$x$},
%        ylabel = {$y$},
%        zlabel = {$z$},
        ticks=none,
%        enlargelimits=0.3,
%        view/h=15,
         view={35}{15},
%        colormap = {whiteblack}{color(0cm)  = (white);color(1cm) = (black)},
        scale uniformly strategy=units only,
    ]
    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 16,
        colormap name=myblue,
        variable = \u,
        variable y = \v,
        domain = 0:360,
        y domain = 0:2,
    ]
    ({v*cos(u)}, {v*sin(u)}, {v^2+1});
    
    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 16,
        colormap name=mygreen,
        variable = \u,
        variable y = \v,
        domain = 0:360,
        y domain = 0:2,
    ]
    ({v*cos(u)}, {v*sin(u)}, {5});

    \end{axis}
\end{tikzpicture}
\end{minipage}
\hfill
\begin{minipage}{5.25in}
This region is bounded below by the circular paraboloid $z=x^2+y^2+1$ and above by the horizontal plan $z=5$. Considering our integrand (i.e., $1/\sqrt{x^2+y^2}$) and the bounds for this region, switching to cylindrical coordinates is an obvious choice. To that end we get bounds $z=r^2+1$ and $z=5$. Intersecting these bounds yields $r^2+1=5$ so that $r^2=4$ and thus $r=2$. Therefore, if we project out the $z$-direction, we are left with a disk of radius $2$ centered at the origin. Therefore, $E$'s bounds are $r^2+1\leq z \leq 5$, $0 \leq r \leq 2$, and $0 \leq \theta \leq 2\pi$. Our integrand becomes $1/r$ in cylindrical coordinates since $r=\sqrt{x^2+y^2}$. Finally, don't forget the Jacobian: $r$.

$$\iiint_E \dfrac{1}{\sqrt{x^2+y^2}}\,dV = \int_0^{2\pi}\int_0^2\int_{r^2+1}^5 \dfrac{1}{r}\cdot r\,dz\,dr\,d\theta = \int_0^{2\pi}\,d\theta \int_0^2\int_{r^2+1}^5 1\,dz\,dr$$
\end{minipage} 

$$=2\pi \int_0^2 z\Bigg|_{r^2+1}^5\,dr = 2\pi \int_0^2 5-(r^2+1)\,dr = 2\pi \int_0^2 4-r^2\,dr = 2\pi\left(4r-\dfrac{r^3}{3}\right)\Bigg|_0^2 = 2\pi\left(8-\dfrac{8}{3}\right) = \mbox{\fbox{$\dfrac{32}{3}\pi$}}$$

\noindent {\bf\large 8. (12 points)} Consider the integral: $\displaystyle I = \int_{-7}^0 \int_{-\sqrt{49-x^2}}^{\sqrt{49-x^2}} \int_{-\sqrt{49-x^2-y^2}}^0 \sqrt{x^2+y^2+z^2} \,dz\,dy\,dx$.   

\vspace{-0.4in}

\force\hfill
\pgfplotsset{
  /pgfplots/colormap={mypink}{%
    color(0cm) = (purple);
    color(1cm) = (pink!80!purple);
    color(2cm) = (pink!90);
    color(3cm) = (pink) }
}
\pgfplotsset{
  /pgfplots/colormap={myblue}{%
    color(0cm) = (blue!55);
    color(1cm) = (blue!60);
    color(2cm) = (blue!65);
    color(3cm) = (blue!70) }
}
\pgfplotsset{
  /pgfplots/colormap={mygreen}{%
    color(0cm) = (green!40);
    color(1cm) = (green!60);
    color(2cm) = (green!80);
    color(3cm) = (green) }
}
\begin{tikzpicture}[scale=0.7]
    \begin{axis}[%
        axis equal,
        width=7cm,
        height=7cm,
        axis lines = none,
%        xlabel = {$x$},
%        ylabel = {$y$},
%        zlabel = {$z$},
        ticks=none,
%        enlargelimits=0.3,
%        view/h=15,
         view={35}{15},
%        colormap = {whiteblack}{color(0cm)  = (white);color(1cm) = (black)},
        scale uniformly strategy=units only,
    ]
    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 16,
        colormap name=myblue,
        variable = \u,
        variable y = \v,
        domain = 90:270,
        y domain = 90:180,
    ]
    ({cos(u)*sin(v)}, {sin(u)*sin(v)}, {cos(v)});

    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 16,
        colormap name=mypink,
        variable = \u,
        variable y = \v,
        domain = 90:270,
        y domain = 90:180,
    ]
    ({0}, {sin(u)*sin(v)}, {cos(v)});

    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 16,
        colormap name=mygreen,
        variable = \u,
        variable y = \v,
        domain = 90:270,
        y domain = 90:180,
    ]
    ({cos(u)*sin(v)}, {sin(u)*sin(v)}, {0});

\end{axis}
\end{tikzpicture}
\quad\force

\vspace{-0.3in}

\noindent
\begin{minipage}{4.3in}
\begin{enumerate}[(a)]
   \item Rewrite $I$ in the following order of integration: $\iiint \quad \,dy\,dx\,dz$.

$$I=\int_{-7}^0 \int_{-\sqrt{49-z^2}}^0 \int_{-\sqrt{49-x^2-z^2}}^{\sqrt{49-x^2-z^2}} \sqrt{x^2+y^2+z^2}\,dy\,dx\,dz$$
   
   \item Rewrite $I$ in terms of cylindrical coordinates.
   
$$I=\int_{\pi/2}^{3\pi/2} \int_0^7 \int_{-\sqrt{49-r^2}}^0 \sqrt{r^2+z^2}\cdot r\,dz\,dr\,d\theta$$

   \item Rewrite $I$ in terms of spherical coordinates.
   
$$I=\int_{\pi/2}^{3\pi/2} \int_{\pi/2}^\pi \int_0^7 \rho\cdot \rho^2\sin(\varphi)\,d\rho\,d\varphi\,d\theta$$

\end{enumerate}

\end{minipage} \hfill
\begin{minipage}{3in}


We have a portion of the ball $x^2+y^2+z^2 \leq 49$. In particular, $-\sqrt{49-x^2-y^2}\leq z \leq 0$ so we are dealing with the lower half (in cylindrical coordinates we have $-\sqrt{49-r^2} \leq z \leq 0$ and in spherical coordinates this means $\pi/2 \leq \varphi \leq \pi$). Next, $-\sqrt{49-x^2} \leq y \leq \sqrt{49-x^2}$ and $-7 \leq x \leq 0$. This is the left half of the disk centered at the origin of radius $7$ (in cylindrical coordinates this says that $\pi/2 \leq \theta \leq 3\pi/2$ and $0 \leq r \leq 7$). Imagine a ray emanating from the origin. You start off in this region and then exit when you hit the sphere: $x^2+y^2+z^2=49$ ($\rho^2=49$). Thus $0 \leq \rho \leq 7$.
\end{minipage}

\vspace{0.05in}

To get the bounds for part (a), consider that we are working inside the sphere $x^2+y^2+z^2=49$. Solving for $y$, we get $y = \pm\sqrt{49-x^2-z^2}$. We keep both of these bounds since our original integral indicates the $y$-direction is not cut down. Squishing out $y$, we get (part of) a disk bounded by $x^2+z^2 =49$. Solving for $x$, we get $x= \pm\sqrt{49-z^2}$. But our original integral has bounds forces $x \leq 0$. Thus $-\sqrt{49-z^2} \leq x \leq 0$. Finally, our original integral also forces $z \leq 0$, so we have $-7 \leq z \leq 0$. 

\newpage

\noindent {\bf\large 9. (14 points)} Let $E$ be the region above the cone $z=2\sqrt{x^2+y^2}$, below $z=18$, and where $y \geq 0$. 

\begin{minipage}{4.5in}
\begin{enumerate}[(a)]
\item Set up $\displaystyle\iiint_E x+z \,dV$ in rectangular coordinates.
\item Set up $\displaystyle\iiint_E x+z \,dV$ in cylindrical coordinates.
\item Set up $\displaystyle\iiint_E x+z \,dV$ in spherical coordinates.
\end{enumerate}
\vfill
\force
\end{minipage} \hfill
\begin{minipage}{2.75in}
\pgfplotsset{
  /pgfplots/colormap={mypink}{%
    color(0cm) = (purple);
    color(1cm) = (pink!80!purple);
    color(2cm) = (pink!90);
    color(3cm) = (pink) }
}
\pgfplotsset{
  /pgfplots/colormap={myblue}{%
    color(0cm) = (blue!55);
    color(1cm) = (blue!60);
    color(2cm) = (blue!65);
    color(3cm) = (blue!70) }
}
\pgfplotsset{
  /pgfplots/colormap={mygreen}{%
    color(0cm) = (green!40);
    color(1cm) = (green!60);
    color(2cm) = (green!80);
    color(3cm) = (green) }
}
\begin{tikzpicture}
    \begin{axis}[%
        axis equal,
        width=7cm,
        height=7cm,
        axis lines = none,  % vs. center
%        xlabel = {$x$},
%        ylabel = {$y$},
%        zlabel = {$z$},
        ticks=none,
%        enlargelimits=0.3,
%        view/h=15,
         view={35}{15},
%        colormap = {whiteblack}{color(0cm)  = (white);color(1cm) = (black)},
        scale uniformly strategy=units only,
    ]
    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 16,
        colormap name=mypink,
        variable = \u,
        variable y = \v,
        domain = -90:90,
        y domain = 0:3,
    ]
    ({0}, {v*sin(u)}, {2*v});
    
    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 16,
        colormap name=mygreen,
        variable = \u,
        variable y = \v,
        domain = -90:90,
        y domain = 0:3,
    ]
    ({v*cos(u)}, {v*sin(u)}, {2*v});

    \addplot3[%
        opacity = 0.5,
        surf,
        z buffer = sort,
        samples = 16,
        colormap name=myblue,
        variable = \u,
        variable y = \v,
        domain = -90:90,
        y domain = 0:3,
    ]
    ({v*cos(u)}, {v*sin(u)}, {6});
    \end{axis}
\end{tikzpicture}
\end{minipage}


Notice that the cone $z=2\sqrt{x^2+y^2}$ is the bottom of our region and the horizontal plane $z=18$ is the top. Intersecting these will help determine the bounds for $x$ and $y$. We get that $2\sqrt{x^2+y^2}=18$ and so $\sqrt{x^2+y^2}=9$. Thus projecting out the $z$-direction we are left with a half-disk (because $y \geq 0$) determined by $x^2+y^2=9^2$.
Solving for $y$ we get $y =\pm\sqrt{81-x^2}$ and thus our $y$-bounds are $0 \leq y \leq \sqrt{81-x^2}$ (keeping in mind that $y \geq 0$). Finally, $x$ should range from $-9$ to $9$ (the radius of the disk.

$$ \text{Answer (a):} \quad \int_{-9}^9 \int_0^{\sqrt{81-x^2}} \int_{2\sqrt{x^2+y^2}}^{18} (x+z)\,dz\,dy\,dx$$

Alternatively, we could use $-\sqrt{81-y^2} \leq x \leq \sqrt{81-y^2}$ and $0 \leq y \leq 9$ for $x$ and $y$ bounds and get:

$$\text{Alternate answer (a):} \quad \int_0^9 \int_{-\sqrt{81-y^2}}^{\sqrt{81-y^2}} \int_{2\sqrt{x^2+y^2}}^{18} (x+z)\,dz\,dx\,dy$$

We could also have started with $x$ or $y$ bounds. For example, in the $y$-direction, $E$ is bounded by $y=0$ and the cone: $z=2\sqrt{x^2+y^2}$. Solving the cone's equation for $y$ yields $z^2=4(x^2+y^2)$ so $y^2=z^2/4-x^2$ and thus $y = \pm\sqrt{z^2/4-x^2}$ (where only the positive solution matters to us). Then collapsing out $y$, we are left with a region determined by where the cone intersects with $y=0$: $z=2\sqrt{x^2+0^2}$ so $z=2|x|$ and $z=18$. Intersecting these we have $2|x|=18$ and again get $x$-bounds $-9 \leq x \leq 9$. Thus another possible answer is:

$$\text{Alternate answer (a):} \quad \int_{-9}^9 \int_{2|x|}^{18} \int_{-\sqrt{z^2/4-x^2}}^{\sqrt{z^2/4-x^2}} (x+z)\,dy\,dx\,dz$$

Although we {\it could} set this up in the other 3 orders of integration, I will stop here.

Next, for cylindrical coordinates, we change the $z$ bounds already found to our new coordinate system: $2r \leq z \leq 18$ since $\sqrt{x^2+y^2}=r$. Then we are left with a half disk in the $xy$-plane: $x^2+y^2 \leq 81$ and $y \geq 0$. Thus $r^2 \leq 81$ so $0 \leq r \leq 9$ and $y\geq 0$ indicates $\theta$ should sweep from the positive $x$-axis to the negative $x$-axis: $0 \leq \theta \leq \pi$. Converting $x=r\cos(\theta)$ and including the Jacobian $J=r$, we get:

$$\text{Answer (b):} \quad \int_0^{\pi} \int_0^9 \int_{2r}^{18} (r\cos(\theta)+z)\cdot r\,dz\,dr\,d\theta$$

Finally, for spherical coordinates, consider a ray emanating from the origin. We start off in this region (so our lower $\rho$ bound is $0$) and exit when we hit the horizontal plane. Notice that $z=18$ means $\rho\cos(\varphi)=18$ so that $\rho=18/\cos(\varphi)=18\sec(\varphi)$ is our upper $\rho$ bound. Next, for $\varphi$, image sweeping out from the positive $z$-axis. We start off in the region (so the lower bound for $\varphi$ is $0$) and exit when we sweep out to the cone: $z=2\sqrt{x^2+y^2}$. In spherical coordinates the cone's equation is $\rho\cos(\varphi)=2\sqrt{x^2+y^2}=2r=2\rho\sin(\varphi)$ so $\cos(\varphi)=2\sin(\varphi)$ and thus $\tan(\varphi)=1/2$. Therefore, our upper $\varphi$ bound is $\varphi=\mathrm{arctan}(1/2)$. Alternatively we could draw a profile picture of the region $E$ and invertigate the right triangle determined by the cone. We would have a triangle whose adjacent side is 18 units tall (determined by the top $z=18$) and the opposite side is 9 units long (determined by the radius of our half disk top). This again tells us that the angle determining the cone is $\varphi=\mathrm{arctan}(9/18) = \mathrm{arctan}(1/2)$. Finally, we already know $\theta$ bounds from the previous part, use our spherical coordinate formulas to transform $x$ and $z$, and include our Jacobian $J=\rho^2\sin(\varphi)$ to get:

$$\text{Answer (c):} \quad \int_0^{\pi} \int_0^{\mathrm{arctan}(1/2)} \int_0^{18\sec(\varphi)} (\rho\cos(\theta)\sin(\varphi)+\rho\cos(\varphi))\cdot \rho^2\sin(\varphi)\,d\rho\,d\varphi,d\theta$$


\end{document}

%\fi %%%%%%%%%%%%%%%%%%%%%%%% end block comment %%%%%%%%%%%%%%%%%%%%%%%%%%



