\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.6in}
\setlength{\textwidth}{7.5in}


\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usepackage{tikz}
\usepgfplotslibrary{fillbetween}

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

\newcommand{\LEMMA}{\vspace{0.05in} \noindent \fbox{\large\bf Lemma:}  }
\newcommand{\COR}{\vspace{0.05in} \noindent \fbox{\large\bf Corollary:}  }
\newcommand{\PROP}{\vspace{0.05in} \noindent \fbox{\large\bf Proposition:}  }
\newcommand{\DEF}{\vspace{0.05in} \noindent \fbox{\large\bf Definition:}  }
\newcommand{\THM}{\vspace{0.05in} \noindent \fbox{\large\bf Theorem:}  }
\newcommand{\EX}{\vspace{0.05in} \noindent \fbox{\large\bf Example:}  }
\newcommand{\bproof}{\vspace{0.1in} \noindent {\bf Proof:} }
\newcommand{\eproof}{$\blacksquare$ \vspace{0.05in}}

\newcommand{\force}{{$\mbox{\;}$}}

\newcommand{\myspace}{\mbox{\parbox[c][0.4in]{0.4in}{\hfill}}}  % height then width
\newcommand{\varspace}[2]{\mbox{\parbox[c][#1]{#2}{\hfill}}}

\begin{document}

%\pagestyle{empty}

\noindent
\parbox{2in}{\bf Math 1120}
\hfill {\Large \bf Separation of Variables} \hfill
\parbox{2in}{\bf \hfill Examples}

\vspace{0.15in}

\EX Find the general solution of $y'=x^3y^2$.

First, rewrite $y'=\frac{dy}{dx}$ and separate variables: $\frac{dy}{dx}=x^3y^2$ becomes $\frac{dy}{y^2}=x^3\,dx$ (divide by $y^2$ and multiply by $dx$). 

Next, after noting that $\frac{1}{y^2}=y^{-2}$, integrate both sides: $\displaystyle \int y^{-2}\,dy = \int x^3\,dx$ becomes $\frac{y^{-1}}{-1}+C_1=\frac{x^4}{4}+C_2$ so that $-\frac{1}{y}=\frac{1}{4}x^4+C_2-C_1$. But since $C_1$ and $C_2$ are arbitrary constants we can relabel $C_2-C_1=C_3$. At this point, $-\frac{1}{y}=\frac{1}{4}x^4+C_3$ is an implicit general solution. 

We seek an {\it explicit} solution. To this end, negate both side and once again rename the constant: $\frac{1}{y}=-\frac{1}{4}x^4-C_3 = -\frac{1}{4}x^4+C_4$. Now take reciprocals and get $y=\dfrac{1}{C_4-\frac{x^4}{4}}$. We can simplify the fraction a bit more by multiplying by $1=\frac{4}{4}$ to get: $y=\dfrac{4}{4C_4-x^4}$. Finally, rename our constant ($4C_4=C$) one last time to get: \fbox{$y=\dfrac{4}{C-x^4}$}.

\vspace{0.05in}

\EX Solve the initial value problem (IVP): $y'=\frac{2x+1}{y}$ where $y(0)=-5$. 

First, rewrite $y'=\frac{dy}{dx}$ and separate variables: $\frac{dy}{dx} = \frac{2x+1}{y}$ becomes $y\,dy = (2x+1)\,dx$. Then integrate: $\frac{y^2}{2} = \int y\,dy = \int (2x+1)\,dx = x^2+x+C_1$. Now solve for $y$ (renaming the constant along the way): $y^2=2x^2+2x+C$ and so $y = \pm \sqrt{2x^2+2x+C}$ (this is an explicit general solution of our differential equation). 

Now we consider the initial value: $-5=y(0) = \pm \sqrt{2(0^2)+2(0)+C} = \pm \sqrt{C}$. We see that we must choose the minus sign in $\pm$. We have $-5=-\sqrt{C}$ so that $25=C$. Therefore, the solution of our IVP is \fbox{$y=-\sqrt{2x^2+2x+25\strut}$}.

\vspace{0.05in}

\EX A certain population grows at a rate proportional to its size. It doubles in size every 5 years and there are initially 123 people. Find a formula for $P(t)$, the population after $t$ years have gone by.

If $P(t)$ is our population $t$ years from now, $P'(t)$ is its growth rate (in people per year). Therefore, if $P(t)$ grows at a rate proportional to its size, we have $P'(t) \propto P(t)$. In other words, there is some constant $k$ (called a {\it growth constant}) such that $P' = kP$. We can solve this separably variable equation: $\frac{dP}{dt} = kP$ becomes $\frac{dP}{P}=k\,dt$ so $\ln|P| = \int \frac{1}{P}\,dP = \int k\,dt = kt+C_1$. Exponentiate and get $|P| = e^{\ln|P|} = e^{kt+C_1} = e^{kt}e^{C_1}$. Thus $P(t) = \pm e^{C_1}e^{kt}$. Now we acknowledge that since $e^{C_1}$ can be any positive real number, $\pm e^{C_1}$ can be any nonzero real number. We also, note that $P(t)=0$ is a solution of our differential equation (we lost this solution when separating variables and dividing by $P$). Long story short we can rename $\pm e^{C_1}$ (along with $0$) with $C$. Therefore, $P(t)=Ce^{kt}$ is a general solution of our differential equation (DE). 

Next, let's see what the doubling population tells us. Notice that $P(0)=Ce^{k(0)}=Ce^0=C$ and we should have twice that population in 5 years, so $2C = P(5) = Ce^{k5}$. Therefore, $2=e^{5k}$ and so $\ln(2)=5k$. Thus our growth constant is $k=\frac{1}{5}\ln(2)$. Plugging this into our general solution, we have 
$P(t) = Ce^{\frac{1}{5}\ln(2) \cdot t} = Ce^{\ln(2) \cdot \frac{t}{5}} = C(e^{\ln(2)})^{t/5}$. Therefore, $P(t)=C2^{t/5}$. 

We also know that the initial population is $P(0)=123$ people. Thus $123=P(0)=C2^{0/5} = C2^0=C$. Therefore, the solution of our IVP is \fbox{$P(t)=123 \cdot 2^{t/5}$}.

\vspace{0.05in}

\EX Newton's Law of Cooling: Suppose we pour a cup of coffee and it is $150^\circ$F initially and then $100^\circ$F after 10 minutes in a $75^\circ$F room. Find a formula for the temperature of the coffee, $T(t)$, in degrees Fahrenheit $t$ minutes after it was poured. 

Newton's law of cooling says that an object will heat up or cool at a rate proportional to the difference between its temperature and the ambient temperature. In other words: $T'(t) \propto T(t)-R$ if $R$ is our ambient room temperature. Thus there is a heating/cooling constant $k$ such that $T' = k(T-R)$. In our situation, $R=75$. 

We can separate $\frac{dT}{dt}=k(T-75)$ and solve as follows: $\frac{dT}{T-75}=k\,dt$ so that $\ln|T-75| = \int \frac{dT}{T-75} = \int k\,dt = kt +C_1$.\footnote{The integration on the left is done with a simple substitution. Let $u=T-75$ so that $du=dT$. Thus $\int \frac{dT}{T-75} = \int \frac{du}{u} = \ln|u|+C = \ln|T-75|+C$.} Exponentiate, drop absolute values, acknowledge a lost solution ($T(t)=75$), and rename our constant: $T(t) = 75+Ce^{kt}$. 

Next, we have initially $150=T(0)=75+Ce^{k\cdot 0} = 75+C$ so that $C=75$. Also, after 10 minutes $100=T(10)=75+75e^{k10}$. Thus $25=75e^{10k}$ so $\frac{1}{3}=e^{10k}$ and so $\ln(1/3) = 10k$. Therefore, $k=\frac{1}{10}\ln(1/3) = \frac{1}{10}\ln(3^{-1}) = -\frac{1}{10}\ln(3)$. We now have $T(t) = 75+75e^{-\frac{1}{10}\ln(3) \cdot t}$
$=75+75(e^{\ln(3)})^{-t/10} = 75+75\cdot 3^{-t/10}$. Therefore, the solution of our IVP is \fbox{$T(t) = 75(1+3^{-t/10})$}.


\end{document}

\noindent {\bf \large 1. (15 points)} Approximations

\vspace{-0.05in}

\begin{enumerate}[(a)]
\item Approximate $\displaystyle \int_{-1}^5 \sin(x^2+1)\,dx$ using $n=3$ trapezoids (i.e., compute $T_3$). {\bf Don't bother simplifying}.

\force 
\hspace*{-0.45in}
\begin{minipage}{2.5in}
\begin{tikzpicture}[
%  declare function={
%    f(\x)= (\x-3.25)^4/9+2;      
%  }
]
\begin{axis}[
  %axis x line=middle, axis y line=middle,
  axis x line = none, axis y line = none,
  width=8cm, height=8cm,     % size of the image
  ymin=-2, ymax=6, ytick={0}, ylabel=$y$,
  xmin=-1.25, xmax=5.25, xtick={0}, xlabel=$x$,
]

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

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

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

\addplot[black, ultra thick, domain=-0.2:0.2]({-1},{x-1});
\addplot[black, ultra thick, domain=-0.2:0.2]({ 1},{x-1});

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

\node at (axis cs: 0,-1.35) {$\Delta x = 2$};
\end{axis}
\end{tikzpicture} 
\end{minipage}
\hfill
\begin{minipage}{4.75in}
We partition $I=[-1,5]$ into $n=3$ pieces. We have that $\Delta = \dfrac{5-(-1)}{3}=\dfrac{6}{3}=2$. Then $x_0=-1$, $x_1=-1+\Delta x=1$, $x_2=1+\Delta x=3$, and $x_4=3+\Delta x=5$ are our partition points. 
\end{minipage}


Left hand rule uses sample points $-1$, $1$, and $3$ while right hand rule uses $1$, $3$, and $5$. We get:

\vspace{-0.25in}

$$L_3 = 2 \cdot \left(\sin((-1)^2+1)+\sin(1^2+1)+\sin(3^2+1)\right) \qquad \text{and} \qquad R_3 = 2 \cdot \left(\sin(1^2+1)+\sin(3^2+1)+\sin(5^2+1)\right)$$

\vspace{-0.15in}

Then \quad \fbox{$T_3 = \dfrac{L_3+R_3}{2}$} \quad or directly: \quad $T_3 = \dfrac{2}{2}\cdot \left( \sin((-1)^2+1)+2\sin(1^2+1)+2\sin(3^2+1)+\sin(5^2+1)\right)$.


\force
\hfill
\begin{tikzpicture}[
  declare function={
    f(\x)= (\x-3.25)^4/9+2;      
  }
]
\begin{axis}[
  axis x line=middle, axis y line=middle,
  width=6cm, height=6cm,     % size of the image
  ymin=-0.8, ymax=12, ytick={0}, ylabel=$y$,
  xmin=-0.1, xmax=2.5, xtick={0}, xlabel=$x$,
]

\addplot[blue, ultra thick, domain=0.25:2.25, smooth]{f(x)};

\draw[fill=green,opacity=0.25] (axis cs:0.25,0) rectangle (axis cs:1.25,{(0.75-3.25)^4/9+2});
\draw[fill=green,opacity=0.25] (axis cs:1.25,0) rectangle (axis cs:2.25,{(1.75-3.25)^4/9+2});

\addplot[black, ultra thick, domain=-0.2:0.3]({0.25},{x});
\addplot[black, ultra thick, domain=-0.2:0.3]({1.25},{x});
\addplot[black, ultra thick, domain=-0.2:0.3]({2.25},{x});

\draw[dotted, blue, thick] (axis cs:0.75,0)--(axis cs:0.75,{(0.75-3.25)^4/9+2});
\draw[blue, ultra thick] (axis cs:0.75,-0.2)--(axis cs:0.75,0.2);

\draw[dotted, blue, thick] (axis cs:1.75,0)--(axis cs:1.75,{(1.75-3.25)^4/9+2});
\draw[blue, ultra thick] (axis cs:1.75,-0.2)--(axis cs:1.75,0.2);

\node at (axis cs:0.25,-0.6) {$a$};
\node at (axis cs:2.25,-0.6) {$b$};
\end{axis}
\end{tikzpicture} 

\vspace{-1.75in}

\item A graph of $y=f(x)$ where $a \leq x \leq b$ is shown to the right. Draw the \underline{\bf midpoint} rule\\ approximation of $I=\displaystyle \int_a^b f(x)\,dx$ using \underline{\bf $n=2$ rectangles}.

\vspace{-0.15in}

\item Using the same graph to the right, rank the integral $I=\displaystyle \int_a^b f(x)\,dx$ as well as $L_n$, $R_n$,\\ $M_n$, and $T_n$ (the left, right, midpoint, and trapezoid rule) approximations from smallest\\ to largest. 
\quad For example: $I \leq L_n \leq R_n \leq M_n \leq T_n$ is definitely wrong.

\vspace{0.05in}

\qquad\qquad\qquad \fbox{$R_n$} \  $\leq$ \  \fbox{$M_n$}  \  $\leq$ \  \fbox{$I$} \  $\leq$ \  \fbox{$T_n$} \  $\leq$ \  \fbox{$L_n$}

\vspace{0.05in}

Since our function is decreasing, left hand rule gives an over estimate and right hand\\ rule an underestimate. Since the function is concave up, trapezoid rule gives an overestimate and midpoint rule gives an underestimate. Finally, since the function is {\it both} decreasing {\it and} concave up, the midpoint and trapezoid rule estimates are better than left and right hand rule estimates. We could also see that this it the correct order after drawing a good picture of each estimate.

% Remove for time:
% d) Error bound for X when $n=5$ is Y. What is error bound for X when $n=15$?
% e) $L_n=3$, $R_n=7$, $M_n=2$. What are $T_n$ and $S_{2n}$?

\end{enumerate}

%\vspace{0.1in}

\noindent {\bf \large 2. (14 points)} Compute the following integrals. Please simplify answers.

\vspace{-0.15in}

\begin{enumerate}[(a)]
\item $\displaystyle \int (x^2-2x+4)\sin(x^3-3x^2+12x+1)\,dx = \int \sin(u)\,\dfrac{1}{3}\,du = -\dfrac{1}{3}\cos(u)+C =$ \fbox{$-\dfrac{1}{3}\cos(x^3-3x^2+12x+1)+C$}

Here we used the substitution: $u=x^3-3x^2+12x+1$ so that $du=(3x^2-6x+12)\,dx = 3(x^2-2x+4)\,dx$ and thus $\frac{1}{3}\,du = (x^2-2x+4)\,dx$.

\vspace{-0.05in}

\item $\displaystyle \int \dfrac{2\ln(x)}{x}\,dx = \int 2u\,du = u^2+C =$ \fbox{$(\ln(x))^2+C$}

Here we used the substitution: $u=\ln(x)$ so that $du=\dfrac{1}{x}\,dx$.

\vspace{-0.1in}

\item $\displaystyle \int_1^2 3x^2e^{x^3-1}\,dx = \int_0^7 e^u\,du = e^u\Big|_0^7=e^7-e^0=$ \fbox{$e^7-1$}

Here we used the substitution: $u=x^3-1$ so that $du=3x^2\,dx$. We also need to change the limits of integration: $x=1 \mapsto u=1^3-1=0$ and $x=2 \mapsto u=2^3-1=7$. Alternatively, we could use that substitution to figure out that $\displaystyle\int 3x^2e^{x^3-1}\,dx = \int e^u\,du =  e^{u}+C = e^{x^3-1}+C$ and then calculate: $e^{x^3-1}\Big|_1^2 = e^{2^3-1}-e^{1^3-1} = e^7-1$ (as before).

\end{enumerate}

\vspace{-0.1in}

\noindent {\bf \large 3. (14 points)} Differential Equations. Please simplify your answers.

\vspace{-0.05in}

\begin{enumerate}[(a)]
\item Find a general solution of $\dfrac{dy}{dx} = (\cos(x)+1)y$.

We separate variables (divide by $y$ and multiply by $dx$) and find that $\dfrac{dy}{y}=(\cos(x)+1)\,dx$. Integrate both sides: $\int \dfrac{dy}{y}=\int (\cos(x)+1)\,dx$ and get that $\ln|y|=\sin(x)+x+C_1$. Now exponentiate both sides: $e^{\ln|y|} = e^{\sin(x)+x+C_1}$. Thus $|y|=e^{C_1}e^{\sin(x)+x}$ and so $y = \pm e^{C_1}e^{\sin(x)+x}$. Notice that $\pm e^{C_1}$ can be any positive or negative number (and we lost the $y=0$ solution when we divided by $y$), so we relabel $\pm e^{C_1}$ as a new arbitrary constant $C$ and get that 
\fbox{$y=Ce^{\sin(x)+x}$}.

\item Solve the following initial value problem: $\dfrac{dy}{dx} = \dfrac{e^x+3x^2}{2y}$ where $y(0)=-5$ (i.e., $y=-5$ when $x=0$).

Again, separate variables (multiply by $2y$ and by $dx$) and integrate: $\int 2y\,dy = \int (e^x+3x^2)\,dx$. Thus $y^2=e^x+x^3+C$ and so $y = \pm\sqrt{e^x+x^3+C\strut}$. Our initial condition states that $y=-5$ when $x=0$. In particular, we need $y$ to take on a negative value and thus choose the negative square root branch. Plugging in our numbers, we find that $-5=-\sqrt{e^0+0^3+C}=-\sqrt{1+C}$. Thus $25=1+C$ and so $C=24$. Therefore, \fbox{$y=-\sqrt{e^x+x^3+24\strut}$}.
\end{enumerate}

\vspace{-0.15in}

\noindent {\bf \large 4. (10 points)} Find the area between $x=y^2$ and $x=2-y^2$.

\vspace{0.05in}

\begin{minipage}{2in}
\begin{tikzpicture}
\begin{axis}[
  axis x line=none, axis y line=none,
  width=6cm, height=6cm,     % size of the image
  ymin=-1.5, ymax=1.5, ytick={0}, ylabel=$y$,
  xmin=-0.5, xmax=2.5, xtick={0}, xlabel=$x$,
]

\addplot[blue, ultra thick, domain=-1.5:1.5, smooth]({x^2},{x});
\addplot[blue, ultra thick, domain=-1.5:1.5, smooth]({2-x^2},{x});

\draw[fill=green,opacity=0.25] (axis cs:{0.75^2-0.2},0.75) rectangle (axis cs:{2-0.5^2-0.1},0.5);

\node at (axis cs:-0.15,-1) {$y=-1$};
\node at (axis cs:-0.15,1) {$y=1$};

\draw[dotted,->] (axis cs:0.25,1)--(axis cs:0.8,1);
\draw[dotted,->] (axis cs:0.35,-1)--(axis cs:0.8,-1);

\addplot[ultra thick, domain={0.75^2-0.2}:{2-0.5^2-0.1}]({x},{0.35});
\addplot[thick, domain=-0.075:0.075]({0.75^2-0.2},{x+0.35});
\addplot[thick, domain=-0.075:0.075]({2-0.5^2-0.1},{x+0.35});

\node at (axis cs:1,0.1) {$(2-y^2)-y^2$};

\addplot[ultra thick, domain=0.5:0.75]({1.9},{x});
\addplot[thick, domain=-0.065:0.065]({x+1.9},{0.5});
\addplot[thick, domain=-0.065:0.065]({x+1.9},{0.75});

\node at (axis cs:2.15,0.6) {$dy$};
\end{axis}
\end{tikzpicture} 
\end{minipage}
\hfill
\begin{minipage}{5in}
To find the area between these parabolas, we need to figure out where they intersect: $y^2=x=2-y^2$ so that $2y^2=2$ and so $y^2=1$. Thus these parabolas intersect when $y=\pm 1$. We can slice this area into horizontal strips that are $(2-y^2) - y^2$ units wide and $dy$ units tall. The area between our curves is the sum of the area of all of these strips as $y$ goes from $y=-1$ to $y=1$: Area $\displaystyle = \int_{-1}^1 [(2-y^2)-y^2]\,dy = \int_{-1}^1 (2-2y^2)\,dy$. Notice that $2-2y^2$ is an even function (since $2-2(-y)^2=2-2y^2$) on a symmetric interval ($I=[-1,1]$), so we can instead compute Area $\displaystyle =2\int_0^1 (2-2y^2)\,dy = 2\left[2y-\dfrac{2}{3}y^3\right]\Bigg|_0^1 = 2\left[2(1)-\dfrac{2}{3}1^3\right] - 2\left[2(0)-\dfrac{2}{3}0^3\right] = 2\left(2-\dfrac{2}{3}\right) =$ \fbox{$\dfrac{8}{3}$}.
\end{minipage}

\vspace{0.05in}

\noindent {\bf \large 5. (14 points)} Consider the region bounded by $y=\sqrt{x}$, the $x$-axis, and $x=4$. We rotate this region about some axis to obtain a solid of revolution.

\begin{enumerate}[(a)]
\item Find the volume of the solid obtained when rotating our region about the $x$-axis.

\vspace{-0.4in}

\begin{minipage}{5in}
We should slice our region into disks of width $dx$ and radius $y=\sqrt{x}$. So the volume of a disk is $\pi(\sqrt{x})^2\,dx = \pi x\,dx$. We have disk slices as $x$ goes from $x=0$ to $x=4$. Adding the volumes of these disks up, we find the the total volume of our solid of revolution is $\displaystyle \int_0^4 \pi x\,dx = \dfrac{\pi}{2}x^2\Bigg|_0^4 = \dfrac{\pi}{2}\cdot 2^4 - \dfrac{\pi}{2}\cdot 0^4 =$ \fbox{$8\pi$}.
\end{minipage}
\qquad
\begin{minipage}{2.5in}
\begin{tikzpicture}
\begin{axis}[
  axis x line=none, axis y line=none,
  width=6.5cm, height=6cm,     % size of the image
  ymin=-2.5, ymax=2.5, ytick={0}, ylabel=$y$,
  xmin=-0.65, xmax=7.75, xtick={0}, xlabel=$x$,
]

\addplot[gray, thick, domain=-0.65:5,<->]({x},0);

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

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

\node at (axis cs:0.4,1.35) {$y=\sqrt{x}$};

\addplot[name path=B, blue, ultra thick, domain=0:4]({x},0);
\addplot[blue, ultra thick, domain=0:2](4,{x});

\addplot[name path=A, blue, ultra thick, domain=0:2, smooth]({x^2},{x});

\addplot[blue!10] fill between[of=A and B];


\addplot[gray, thick, domain=0.4:2, smooth]({x^2},{-x});

\addplot[gray, thick, domain=0:360, smooth]({0.25*cos(x)+4},{2*sin(x)});


\addplot[name path=E, black, thick, domain=-90:90, smooth]({0.175*cos(x)+2.65},{sqrt(2.65)*sin(x)});
\addplot[black, thick, domain=-90:90, smooth]({0.175*cos(x)+2.35},{sqrt(2.65)*sin(x)});
\addplot[black, thick, domain=2.35:2.65]({x},{sqrt(2.65)});
\addplot[black, thick, domain=2.35:2.65]({x},{-sqrt(2.65)});

\addplot[name path=C, black, thick, domain=90:270, smooth]({0.175*cos(x)+2.65},{sqrt(2.65)*sin(x)});
\addplot[name path=D, black, thick, domain=90:270, smooth]({0.175*cos(x)+2.35},{sqrt(2.65)*sin(x)});
\addplot[black!80] fill between[of=C and D];
\addplot[gray!60] fill between[of=C and E];

\addplot[red, ultra thick, domain=30:210,->, smooth]({0.2*cos(x)+1.2},{0.7*sin(x)-0.1});


\addplot[name path=EE, black, thick, domain=-90:90, smooth]({0.175*cos(x)+2.65+3.5},{sqrt(2.65)*sin(x)});
\addplot[black, thick, domain=-90:90, smooth]({0.175*cos(x)+2.35+3.5},{sqrt(2.65)*sin(x)});
\addplot[black, thick, domain=2.35:2.65]({x+3.5},{sqrt(2.65)});
\addplot[black, thick, domain=2.35:2.65]({x+3.5},{-sqrt(2.65)});

\addplot[name path=CC, black, thick, domain=90:270, smooth]({0.175*cos(x)+2.65+3.5},{sqrt(2.65)*sin(x)});
\addplot[name path=DD, black, thick, domain=90:270, smooth]({0.175*cos(x)+2.35+3.5},{sqrt(2.65)*sin(x)});
\addplot[black!80] fill between[of=CC and DD];
\addplot[gray!60] fill between[of=CC and EE];

\addplot[thick, domain=0:{sqrt(2.65)}]({3.1+3.5},{x});
\addplot[thick, domain=-0.15:0.15]({x+3.1+3.5},{sqrt(2.65)});
\addplot[thick, domain=-0.15:0.15]({x+3.1+3.5},{0});

\node at (axis cs:3.65+3.5,0.75) {$\sqrt{x}$};

\addplot[thick, domain=-0.2:0.2]({x+2.5+3.5},{1.85});
\addplot[thick, domain=-0.1:0.1]({-0.2+2.5+3.5},{1.85+x});
\addplot[thick, domain=-0.1:0.1]({ 0.2+2.5+3.5},{1.85+x});

\node at (axis cs:{2.5+3.5},2.2) {$dx$};
\end{axis}
\end{tikzpicture} 
\end{minipage}

\vspace{-0.35in}

\item Set up an integral that computes the volume of the solid obtained when rotating our\\ region about the line $y=3$. \qquad\qquad {\bf [Do not evaluate your integral.]}

\begin{minipage}{3.5in}
\begin{tikzpicture}
\begin{axis}[
  axis x line=none, axis y line=none,
  width=10cm, height=6cm,     % size of the image
  ymin=-1, ymax=7.2, ytick={0}, ylabel=$y$,
  xmin=-1.5, xmax=12, xtick={0}, xlabel=$x$,
]

\addplot[name path=H, gray!60, thick, domain=-90:90, smooth]({0.4*cos(x)},{3*sin(x)+3});

\addplot[black, thick, domain=-1.5:-0.4] ({x},{3});

\addplot[black!50, thick, domain=-0.4:3.85] ({x},{3});

\node at (axis cs:6.5,3) {$y=3$};

\addplot[gray, thick, domain=-1.5:5.5,<->]({x},0);

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

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

\node at (axis cs:0.8,1.75) {$y=\sqrt{x}$};

\addplot[name path=B, blue, ultra thick, domain=0:4]({x},0);
\addplot[blue, ultra thick, domain=0:2](4,{x});

\addplot[name path=A, blue, ultra thick, domain=0:2, smooth]({x^2},{x});


\addplot[gray!60, thick, domain=0:2, smooth]({x^2},{6-x});

\addplot[gray, thick, domain=0:4]({x},{0});
\addplot[gray, thick, domain=0:4]({x},{6});

\addplot[name path=C, gray, thick, domain=90:270, smooth]({0.4*cos(x)+4},{3*sin(x)+3});
\addplot[name path=D, gray, thick, domain=90:270, smooth]({0.15*cos(x)+4},{1*sin(x)+3});
\addplot[name path=E, gray, thick, domain=90:270, smooth]({0.4*cos(x)},{3*sin(x)+3});

\addplot[name path=F, gray, thick, domain=-90:90, smooth]({0.4*cos(x)+4},{3*sin(x)+3});
\addplot[name path=G, gray, thick, domain=-90:90, smooth]({0.15*cos(x)+4},{1*sin(x)+3});

\addplot[green!20] fill between[of=E and C];
\addplot[green!50] fill between[of=C and F];

\addplot[gray!50] fill between[of=D and G];

\addplot[black, thick, domain=3.85:5.4] ({x},{3});

\addplot[red, ultra thick, domain=30:210,->, smooth]({0.2*cos(x)+5.2},{0.7*sin(x)-0.1+3});


\addplot[name path=CC, gray, thick, domain=90:270, smooth]({0.4*cos(x)+8.5},{3*sin(x)+3});
\addplot[name path=DD, gray, thick, domain=90:270, smooth]({0.15*cos(x)+8.5},{1.45*sin(x)+3});
\addplot[name path=EE, gray, thick, domain=90:270, smooth]({0.4*cos(x)+8},{3*sin(x)+3});

\addplot[name path=FF, gray, thick, domain=-90:90, smooth]({0.4*cos(x)+8.5},{3*sin(x)+3});
\addplot[name path=GG, gray, thick, domain=-90:90, smooth]({0.15*cos(x)+8.5},{1.45*sin(x)+3});

\addplot[gray, thick, domain=8:8.5]({x},0);
\addplot[gray, thick, domain=8:8.5]({x},6);

\addplot[black!20] fill between[of=EE and CC];
\addplot[black!50] fill between[of=CC and FF];

\addplot[gray!50] fill between[of=DD and GG];


\addplot[thick, domain=0:3](9.25,{x});
\addplot[thick, domain=-0.15:0.15]({x+9.25},{3});
\addplot[thick, domain=-0.15:0.15]({x+9.25},{0});

\node at (axis cs:10.2,0.8) {$3-0$};

\addplot[thick, domain=1.55:3]({9.75},{x});
\addplot[thick, domain=-0.1:0.1]({9.75+x},{1.55});
\addplot[thick, domain=-0.1:0.1]({9.75+x},{3});

\node at (axis cs:{10.75},2.25) {$3-\sqrt{x}$};

\addplot[thick, domain=8:8.5]({x},6.35);
\addplot[thick, domain=-0.15:0.15](8,{x+6.35});
\addplot[thick, domain=-0.15:0.15](8.5,{x+6.35});

\node at (axis cs:8.25,6.8) {$dx$};


\end{axis}
\end{tikzpicture} 
\end{minipage}
\hfill
\begin{minipage}{4in}
We should slice our region into washers of width $dx$ whose inner radius is the distance from our line of rotation $y=3$ to the graph $y=\sqrt{x}$ (i.e., inner radius $=3-\sqrt{x}$) and whose outer radius is the distance from our line $y=3$ to the $x$-axis (i.e., outer radius $=3-0=3$). The volume of such a washer is $dx \cdot (\pi(3)^2-\pi(3-\sqrt{x})^2)$. To find the volume of the entire solid of revolution we need to add of the volumes of our washers as $x$ goes from $x=0$ to $x=4$. Thus the volume of revolution is \fbox{$\displaystyle \int_0^4 [\pi\,3^2 - \pi\,(3-\sqrt{x})^2]\,dx$}.
\end{minipage}

\vspace{-0.1in}

If we ignore the directive ``don't evaluate'', we would find that the volume is $\displaystyle \pi \int_0^4 (6\sqrt{x}-x)\,dx =\pi \Big[ 6\dfrac{x^{3/2}}{3/2}-\dfrac{x^2}{2}\Bigg|_0^4 = 24\pi$.
\end{enumerate}

\noindent {\bf \large 6. (12 points)} We have a pyramid that is 8 feet tall and has a square base that is 3 feet by 3 feet.\\ 
\begin{minipage}{4.25in}
\begin{enumerate}[(a)]
\item Sketch a picture of this pyramid. Sketch a horizontal slice. 
\item Give a formula for the volume of a horizontal slice of the\\ pyramid. Clearly label your variables.
\item Set up an integral that computes the volume of this pyramid.\\
\qquad {\bf You do not need to evaluate your integral.}\\ {\it Note:} The volume is 24 cubic feet.
\end{enumerate}
\end{minipage}
\begin{minipage}{3in}

\vspace{0.05in}

\begin{tikzpicture}
\begin{axis}[
  axis x line=none, axis y line=none,
  width=9cm, height=6cm,     % size of the image
  ymin=-1.75, ymax=10, ytick={0}, ylabel=$y$,
  xmin=-5, xmax=13, xtick={0}, xlabel=$x$,
]

\draw[thick,black!60] (axis cs:0,7)--(axis cs:-1,1);

\filldraw[fill=orange!60] (axis cs:0,7)--(axis cs:5,1)--(axis cs:2.8,0)--cycle;
\filldraw[fill=orange!60, thick] (axis cs:0,7)--(axis cs:-3.2,0)--(axis cs:2.8,0)--cycle;

\draw[thick,black!60] (axis cs:0,7)--(axis cs:-1,1);
\draw[thick,black!60] (axis cs:-3.2,0)--(axis cs:-1,1);
\draw[thick,black!60] (axis cs:5,1)--(axis cs:-1,1);

\draw (axis cs:0,7)--(axis cs:5,1)--(axis cs:2.8,0)--cycle;

% slice
\filldraw[fill=black!70, thick] (axis cs:1.7,3.5)--(axis cs:1.7,3)--(axis cs:3,3.4)--(axis cs:3,3.9)--cycle;
\draw[fill=black!70, thick] (axis cs:-1.85,3) rectangle (axis cs:1.7,3.5);
\filldraw[fill=red!50, opacity=0.5] (axis cs:-1.85,3.5)--(axis cs:-0.65,3.9)--(axis cs:3,3.9)--(axis cs:1.7,3.5)--cycle;

% slice shifted
\filldraw[fill=black!70, thick] (axis cs:1.7+8,3.5)--(axis cs:1.7+8,3)--(axis cs:3+8,3.4)--(axis cs:3+8,3.9)--cycle;
\draw[fill=black!70, thick] (axis cs:-1.85+8,3) rectangle (axis cs:1.7+8,3.5);
\filldraw[fill=red!50] (axis cs:-1.85+8,3.5)--(axis cs:-0.65+8,3.9)--(axis cs:3+8,3.9)--(axis cs:1.7+8,3.5)--cycle;

\draw[thick] (axis cs:-1.85+8,2.6)--(axis cs:1.7+8,2.6);
\draw[thick] (axis cs:-1.85+8,2.4)--(axis cs:-1.85+8,2.8);
\draw[thick] (axis cs:1.7+8,2.4)--(axis cs:1.7+8,2.8);
\node at (axis cs:8.1,2.05) {$w$};

\draw[thick] (axis cs:1.85+8,2.6)--(axis cs:3.15+8,3.1);
\draw[thick] (axis cs:1.85+8,2.4)--(axis cs:1.85+8,2.8);
\draw[thick] (axis cs:3.15+8,2.9)--(axis cs:3.15+8,3.3);
\node at (axis cs:2.8+8,2.4) {$w$};

\draw[thick] (axis cs:3.4+8,3.5)--(axis cs:3.4+8,3.9);
\draw[thick] (axis cs:3.25+8,3.5)--(axis cs:3.55+8,3.5);
\draw[thick] (axis cs:3.25+8,3.9)--(axis cs:3.55+8,3.9);
\node at (axis cs:4.2+8,3.7) {$dx$};

\node at (axis cs:-4.45,3.5) {$8$};
\draw[thick] (axis cs:-4,0)--(axis cs:-4,7);
\draw[thick] (axis cs:-4.15,0)--(axis cs:-3.85,0);
\draw[thick] (axis cs:-4.15,7)--(axis cs:-3.85,7);

\draw[thick] (axis cs:-4+0.5,7)--(axis cs:-4+0.5,3.25);
\draw[thick] (axis cs:-4.15+0.5,7)--(axis cs:-3.85+0.5,7);
\draw[thick] (axis cs:-4.15+0.5,3.25)--(axis cs:-3.85+0.5,3.25);
\node at (axis cs:-3.1,5.15) {$x$};

\draw[thick] (axis cs:-3.2,-0.75)--(axis cs:2.8,-0.75);
\draw[thick] (axis cs:-3.2,-0.95)--(axis cs:-3.2,-0.55);
\draw[thick] (axis cs:2.8,-0.95)--(axis cs:2.8,-0.55);
\node at (axis cs:-0.2,-1.45) {$3$};

\draw[thick] (axis cs:3.1,-0.6)--(axis cs:5.15,0.5);
\draw[thick] (axis cs:3.1,-0.8)--(axis cs:3.1,-0.4);
\draw[thick] (axis cs:5.15,0.3)--(axis cs:5.15,0.7);
\node at (axis cs:4.55,-0.5) {$3$};
\end{axis}
\end{tikzpicture} 
\end{minipage}

If we let $x$ be the distance from the top of the pyramid and $w$ be the width of a horizontal slice $x$ units down from the top, we have that $w=0$ when $x=0$ and $w=3$ when $x=8$. Thus $\Delta w/\Delta x = 3/8$ and so $w=\dfrac{3}{8}x$. Notice that the formula for the volume of a horizontal slice is \fbox{$w^2\,dx = \left(\dfrac{3}{8}x\right)^2\,dx$}. Finally, to compute the volume of the pyramid, we need to add up the volume of all of these slices as $x$ goes from $x=0$ (the top) to $x=8$ (the bottom): \fbox{$\displaystyle \int_0^8 \left(\dfrac{3}{8}x\right)^2\,dx$} (which equals $24$).

Alternatively, we could let $x$ be the distance from the bottom of the pyramid. Then $w=0$ when $x=8$ and $w=3$ when $x=0$. Thus $\Delta w/\Delta = -3/8$ and so $w=-\dfrac{3}{8}x+3$. Now the formula for the volume of a horizontal slice is $w^2\,dx = \left(-\dfrac{3}{8}x+3\right)^2\,dx$ and the volume of the pyramid (still summing up from $x=0$ to $x=8$ -- now bottom to top) is $\displaystyle \int_0^8 \left(-\dfrac{3}{8}x+3\right)^2\,dx$ (which still equals $24$).

\vspace{0.05in}

\noindent {\bf \large 7. (8 points)} %Arc Length
%
%\begin{enumerate}[(a)]
%\item Compute the arc length of the portion of the graph of $y=2x^{3/2}$ where $0 \leq x \leq 1$.
%
%\vfill
%
%\item 
Set up an integral which computes the arc length of $y=\sin(x)$ where $-\pi \leq x \leq 2\pi$.\\
\force \hfill {\bf Do not try to evaluate this integral.}

\vspace{-0.2in}

$$\text{Arc Length} = \int_a^b \sqrt{1+\left(\dfrac{dy}{dx}\right)^2}\,dx = \mbox{\fbox{$\displaystyle \int_{-\pi}^{2\pi} \sqrt{1+\cos^2(x)\strut}\,dx$}} \qquad \text{ since } \dfrac{dy}{dx}=\cos(x)$$

%\end{enumerate}

\noindent {\bf \large 8. (13 points)} We have a cylindrical tank with radius $2$ feet that is $10$ feet tall. The tank is half filled with a liquid which weights $5$  lbs. per cubic foot. Suppose we pump this liquid just over the rim of the top of the tank. Compute the work done.

\vspace{0.05in}

\noindent
\begin{minipage}{5.75in}
We slice the liquid horizontally. Let $x$ be the distance from the bottom of the tank. Then $10-x$ is the distance to the top of the tank -- this is how far a slice of liquid needs to be moved. Each slice has volume $\pi\,2^2\,dx$ cubic feet (since the tank has circular cross sections with radius $2$). The liquid weighs $5$ lbs. per cubic foot, so a slice weighs $5 \cdot \pi 2^2\,dx = 20\pi\,dx$ lbs. The work moving a slice is force $\times$ distance $= 20\pi\,dx \cdot (10-x)$ since weight is the force due to gravity. We then need to add up the work it takes to move each slice from the bottom of the tank (i.e., $x=0$) up to half of the height of the tank (i.e., $x=10/2=5$) since the tank is only half full. Therefore,

\vspace{-0.25in}

$$\text{Work} = \int_0^5 (10-x)20\pi\,dx = \pi \int_0^2 200-20x\,dx = \pi(200x-10x^2)\Big|_0^5=\pi(200(5)-10(5^2))-0$$

\vspace{-0.1in}

Thus the work done is $\pi(1000-250)=$ \fbox{750$\pi$ ft.-lbs.} \hfill [{\it Note:} A full tank be 1,000$\pi$ ft.-lbs.]
\end{minipage}
\hfill
\begin{minipage}{2in}
\force \hfill
\begin{tikzpicture}
\begin{axis}[
  %axis x line=middle, axis y line=middle,
  axis x line = none,
  axis y line = none,
  ticks = none,
  width=2in, height=2.5in,     % size of the image = rigged to keep scaling=constrained
  ymin=-1.1, ymax=10.6, % ytick={0}, ylabel=$y$,
  xmin=-5.55, xmax=4.25, % xtick={0}, xlabel=$x$,
]

\addplot[name path=A, domain=0:180, ultra thick, blue] ({2*cos(x)},{sin(x)/2+5});
\addplot[name path=B, domain=180:360, ultra thick] ({2*cos(x)},{sin(x)/2});

\addplot[domain=180:360, ultra thick, blue] ({2*cos(x)},{sin(x)/2+5});
\addplot[domain=0:180, ultra thick, blue] ({2*cos(x)},{sin(x)/2});
\addplot[domain=0:1, ultra thick, blue] ({1.78*x},{-0.227*x});

\addplot[blue!10] fill between[of=A and B];

\addplot[domain=0:360, ultra thick] ({2*cos(x)},{sin(x)/2+10});
\addplot[domain=180:360, ultra thick] ({2*cos(x)},{sin(x)/2});

\addplot[name path=C, domain=180:360, ultra thick, green] ({2*cos(x)},{sin(x)/2+3});
\addplot[name path=D, domain=0:180, ultra thick, green] ({2*cos(x)},{sin(x)/2+3});
\addplot[name path=E, domain=180:360, ultra thick, green] ({2*cos(x)},{sin(x)/2+2.7});
\addplot[green!20] fill between[of=C and D];
\addplot[green!50] fill between[of=C and E];

\addplot[domain=0:2.6, ultra thick] ({-2.65},{x});
\addplot[domain=3.1:10, ultra thick] ({-2.65},{x});
\addplot[domain=-0.2:0.2, ultra thick] ({x-2.65},{0});
\addplot[domain=-0.2:0.2, ultra thick] ({x-2.65},{10});
\addplot[domain=-0.2:0.2, ultra thick] ({x-2.65},{2.6});
\addplot[domain=-0.2:0.2, ultra thick] ({x-2.65},{3.1});

\addplot[domain=2.6:3.1, ultra thick] ({-3.2},{x});
\addplot[domain=-0.2:0.2, ultra thick] ({x-3.2},{2.6});
\addplot[domain=-0.2:0.2, ultra thick] ({x-3.2},{3.1});

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

\node at (axis cs:2.2,-0.8) {$2$ft.};

\addplot[domain=0:7, ultra thick] ({2.65},{x});
\addplot[domain=8:10, ultra thick] ({2.65},{x});
\addplot[domain=-0.2:0.2, ultra thick] ({x+2.65},{0});
\addplot[domain=-0.2:0.2, ultra thick] ({x+2.65},{10});

\node at (axis cs:3.25,7.5) {$10$ft.};

\node at (axis cs:-3.2,1.25) {$x$};
\node at (axis cs:-4.3,6.5) {$\mbox{\,}10-x$};
\node at (axis cs:-4.05,2.85) {$dx$};

\draw[dashed,->] (axis cs:-3.75,5)--(axis cs:-2.1,5);
\node at (axis cs:-4.7,5) {$5$ ft.};
\end{axis}
\end{tikzpicture}
\end{minipage}

\newpage

\noindent
\parbox{2in}{\bf Math 1120 Form B}
\hfill {\Large \bf Test \#1} \hfill
\parbox{2in}{\bf \hfill Sept. $13^\mathrm{th}$, 2021}

\vspace{0.05in}

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

\vspace{0.05in}

\noindent {\bf \large 1. (15 points)} Approximations

\vspace{-0.05in}

\begin{enumerate}[(a)]
\item Approximate $\displaystyle \int_{-4}^2 \cos(x^2+1)\,dx$ using $n=3$ trapezoids (i.e., compute $T_3$). {\bf Don't bother simplifying}.

\force 
\hspace*{-0.45in}
\begin{minipage}{2.5in}
\begin{tikzpicture}[
%  declare function={
%    f(\x)= (\x-3.25)^4/9+2;      
%  }
]
\begin{axis}[
  %axis x line=middle, axis y line=middle,
  axis x line = none, axis y line = none,
  width=8cm, height=8cm,     % size of the image
  ymin=-2, ymax=6, ytick={0}, ylabel=$y$,
  xmin=-1.25, xmax=5.25, xtick={0}, xlabel=$x$,
]
\addplot[black, ultra thick, domain=-1:5]({x},{0});

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

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

\addplot[black, ultra thick, domain=-0.2:0.2]({-1},{x-1});
\addplot[black, ultra thick, domain=-0.2:0.2]({ 1},{x-1});

\node at (axis cs:-1,-0.5) {$-4$};
\node at (axis cs: 1,-0.5) {$-2$};
\node at (axis cs: 3,-0.5) {$0$};
\node at (axis cs: 5,-0.5) {$2$};

\node at (axis cs: 0,-1.35) {$\Delta x = 2$};
\end{axis}
\end{tikzpicture} 
\end{minipage}
\hfill
\begin{minipage}{4.75in}
We partition $I=[-1,5]$ into $n=3$ pieces. We have that $\Delta = \dfrac{2-(-4)}{3}=\dfrac{6}{3}=2$. Then $x_0=-4$, $x_1=-4+\Delta x=-2$, $x_2=-2+\Delta x=0$, and $x_4=0+\Delta x=2$ are our partition points. 
\end{minipage}


Left hand rule uses sample points $-4$, $-2$, and $0$ while right hand rule uses $-2$, $0$, and $2$. We get:

\vspace{-0.25in}

$$L_3 = 2 \cdot \left(\cos((-4)^2+1)+\cos((-2)^2+1)+\cos(0^2+1)\right) \qquad \text{and} \qquad R_3 = 2 \cdot \left(\cos((-2)^2+1)+\cos(0^2+1)+\cos(2^2+1)\right)$$

\vspace{-0.15in}

Then \quad \fbox{$T_3 = \dfrac{L_3+R_3}{2}$} \quad or directly: \quad $T_3 = \dfrac{2}{2}\cdot \left(\cos((-4)^2+1)+2\cos((-2)^2+1)+2\cos(0^2+1)+\cos(2^2+1)\right)$.

\force
\hfill
\begin{tikzpicture}[
  declare function={
    f(\x)= 9-(\x+0.75)^4/9+2;    
  }
]
\begin{axis}[
  axis x line=middle, axis y line=middle,
  width=6cm, height=6cm,     % size of the image
  ymin=-0.8, ymax=12, ytick={0}, ylabel=$y$,
  xmin=-0.1, xmax=2.5, xtick={0}, xlabel=$x$,
]

\addplot[blue, ultra thick, domain=0.25:2.25, smooth]{f(x)};

\draw[fill=green,opacity=0.25] (axis cs:0.25,0) rectangle (axis cs:1.25,{f(0.75)});
\draw[fill=green,opacity=0.25] (axis cs:1.25,0) rectangle (axis cs:2.25,{f(1.75)});

\addplot[black, ultra thick, domain=-0.2:0.3]({0.25},{x});
\addplot[black, ultra thick, domain=-0.2:0.3]({1.25},{x});
\addplot[black, ultra thick, domain=-0.2:0.3]({2.25},{x});

\draw[dotted, blue, thick] (axis cs:0.75,0)--(axis cs:0.75,{f(0.75)});
\draw[blue, ultra thick] (axis cs:0.75,-0.2)--(axis cs:0.75,0.2);

\draw[dotted, blue, thick] (axis cs:1.75,0)--(axis cs:1.75,{f(1.75)});
\draw[blue, ultra thick] (axis cs:1.75,-0.2)--(axis cs:1.75,0.2);

\node at (axis cs:0.25,-0.6) {$a$};
\node at (axis cs:2.25,-0.6) {$b$};
\end{axis}
\end{tikzpicture} 

\vspace{-1.75in}

\item A graph of $y=f(x)$ where $a \leq x \leq b$ is shown to the right. Draw the \underline{\bf midpoint} rule\\ approximation of $I=\displaystyle \int_a^b f(x)\,dx$ using \underline{\bf $n=2$ rectangles}.

\vspace{-0.15in}

\item Using the same graph to the right, rank the integral $I=\displaystyle \int_a^b f(x)\,dx$ as well as $L_n$, $R_n$,\\ $M_n$, and $T_n$ (the left, right, midpoint, and trapezoid rule) approximations from smallest\\ to largest. 
\quad For example: $I \leq L_n \leq R_n \leq M_n \leq T_n$ is definitely wrong.

\vspace{0.05in}

\qquad\qquad\qquad \fbox{$R_n$} \  $\leq$ \  \fbox{$T_n$}  \  $\leq$ \  \fbox{$I$} \  $\leq$ \  \fbox{$M_n$} \  $\leq$ \  \fbox{$L_n$}

\vspace{0.05in}

Since our function is decreasing, left hand rule gives an over estimate and right hand\\ rule an underestimate. Since the function is concave down, trapezoid rule gives an underestimate and midpoint rule gives an overestimate. Finally, since the function is {\it both} decreasing {\it and} concave down, the midpoint and trapezoid rule estimates are better than left and right hand rule estimates. We could also see that this it the correct order after drawing a good picture of each estimate.

\end{enumerate}

%\vspace{0.1in}

\noindent {\bf \large 2. (14 points)} Compute the following integrals. Please simplify answers.

\vspace{-0.15in}

\begin{enumerate}[(a)]
\item $\displaystyle \int (x^2-2x+5)\cos(x^3-3x^2+15x+8)\,dx = \int \cos(u)\,\dfrac{1}{3}\,du = \dfrac{1}{3}\sin(u)+C =$ \fbox{$\dfrac{1}{3}\sin(x^3-3x^2+15x+8)+C$}

Here we used the substitution: $u=x^3-3x^2+15x+8$ so that $du=(3x^2-6x+15)\,dx = 3(x^2-2x+5)\,dx$ and thus $\frac{1}{3}\,du = (x^2-2x+5)\,dx$.

\vspace{-0.05in}

\item $\displaystyle \int \dfrac{2\ln(x)}{x}\,dx = \int 2u\,du = u^2+C =$ \fbox{$(\ln(x))^2+C$}

Here we used the substitution: $u=\ln(x)$ so that $du=\dfrac{1}{x}\,dx$.

\vspace{-0.1in}

\item $\displaystyle \int_0^1 3x^2e^{x^3-1}\,dx = \int_{-1}^0 e^u\,du = e^u\Big|_{-1}^0=e^0-e^{-1}=$ \fbox{$1-e^{-1}$}

Here we used the substitution: $u=x^3-1$ so that $du=3x^2\,dx$. We also need to change the limits of integration: $x=0 \mapsto u=0^3-1=-1$ and $x=1 \mapsto u=1^3-1=0$. Alternatively, we could use that substitution to figure out that $\displaystyle\int 3x^2e^{x^3-1}\,dx = \int e^u\,du =  e^{u}+C = e^{x^3-1}+C$ and then calculate: $e^{x^3-1}\Big|_0^1 = e^{1^3-1}-e^{0^3-1} = 1-e^{-1}$ (as before).

\end{enumerate}

\vspace{-0.1in}

\noindent {\bf \large 3. (14 points)} Differential Equations. Please simplify your answers.

\vspace{-0.05in}

\begin{enumerate}[(a)]
\item Find a general solution of $\dfrac{dy}{dx} = (\sin(x)+99)y$.

We separate variables (divide by $y$ and multiply by $dx$) and find that $\dfrac{dy}{y}=(\sin(x)+99)\,dx$. Integrate both sides: $\displaystyle\int \dfrac{dy}{y}=\int (\sin(x)+99)\,dx$ and get that $\ln|y|=-\cos(x)+99x+C_1$. Now exponentiate both sides: $e^{\ln|y|} = e^{-\cos(x)+99x+C_1}$. Thus $|y|=e^{C_1}e^{-\cos(x)+99x}$ and so $y = \pm e^{C_1}e^{-\cos(x)+99x}$. Notice that $\pm e^{C_1}$ can be any positive or negative number (and we lost the $y=0$ solution when we divided by $y$), so we relabel $\pm e^{C_1}$ as a new arbitrary constant $C$ and get that 
\fbox{$y=Ce^{-\cos(x)+99x}$}.

\item Solve the following initial value problem: $\dfrac{dy}{dx} = \dfrac{4x^3+e^x}{2y}$ where $y(0)=-2$ (i.e., $y=-2$ when $x=0$).

Again, separate variables (multiply by $2y$ and by $dx$) and integrate: $\int 2y\,dy = \int (4x^3+e^x)\,dx$. Thus $y^2=x^4+e^x+C$ and so $y = \pm\sqrt{x^4+e^x+C\strut}$. Our initial condition states that $y=-2$ when $x=0$. In particular, we need $y$ to take on a negative value and thus choose the negative square root branch. Plugging in our numbers, we find that $-2=-\sqrt{0^4+e^0+C}=-\sqrt{1+C}$. Thus $4=1+C$ and so $C=3$. Therefore, \fbox{$y=-\sqrt{x^4+e^x+3\strut}$}.
\end{enumerate}

\vspace{-0.15in}

\noindent {\bf \large 4. (10 points)} Find the area between $x=y^2$ and $x=2-y^2$.  \qquad {\color{red}\bf [Same as Form A].}

\vspace{0.05in}

\noindent {\bf \large 5. (14 points)} Consider the region bounded by $y=\sqrt{x}$, the $x$-axis, and $x=4$. We rotate this region about some axis to obtain a solid of revolution.

\vspace{-0.15in}

\begin{enumerate}[(a)] \setlength\itemsep{0pt}
\item Find the volume of the solid obtained when rotating our region about the $x$-axis. \qquad {\color{red}\bf [Same as Form A].}
\item Set up an integral that computes the volume of the solid obtained when rotating our\\ region about the line $y=3$. \qquad\qquad {\bf [Do not evaluate your integral.]} \qquad {\color{red}\bf [Same as Form A].}
\end{enumerate}

\noindent {\bf \large 6. (12 points)} We have a pyramid that is 8 feet tall and has a square base that is 5 feet by 5 feet.\\ 
\begin{minipage}{4.25in}
\begin{enumerate}[(a)] 
\item Sketch a picture of this pyramid. Sketch a horizontal slice. 
\item Give a formula for the volume of a horizontal slice of the\\ pyramid. Clearly label your variables.
\item Set up an integral that computes the volume of this pyramid.\\
\qquad {\bf You do not need to evaluate your integral.}\\ {\it Note:} The volume is 75 cubic feet.
\end{enumerate}
\end{minipage}
\begin{minipage}{3in}

\vspace{0.05in}

\begin{tikzpicture}
\begin{axis}[
  axis x line=none, axis y line=none,
  width=9cm, height=6cm,     % size of the image
  ymin=-1.75, ymax=10, ytick={0}, ylabel=$y$,
  xmin=-5, xmax=13, xtick={0}, xlabel=$x$,
]

\draw[thick,black!60] (axis cs:0,7)--(axis cs:-1,1);

\filldraw[fill=orange!60] (axis cs:0,7)--(axis cs:5,1)--(axis cs:2.8,0)--cycle;
\filldraw[fill=orange!60, thick] (axis cs:0,7)--(axis cs:-3.2,0)--(axis cs:2.8,0)--cycle;

\draw[thick,black!60] (axis cs:0,7)--(axis cs:-1,1);
\draw[thick,black!60] (axis cs:-3.2,0)--(axis cs:-1,1);
\draw[thick,black!60] (axis cs:5,1)--(axis cs:-1,1);

\draw (axis cs:0,7)--(axis cs:5,1)--(axis cs:2.8,0)--cycle;

% slice
\filldraw[fill=black!70, thick] (axis cs:1.7,3.5)--(axis cs:1.7,3)--(axis cs:3,3.4)--(axis cs:3,3.9)--cycle;
\draw[fill=black!70, thick] (axis cs:-1.85,3) rectangle (axis cs:1.7,3.5);
\filldraw[fill=red!50, opacity=0.5] (axis cs:-1.85,3.5)--(axis cs:-0.65,3.9)--(axis cs:3,3.9)--(axis cs:1.7,3.5)--cycle;

% slice shifted
\filldraw[fill=black!70, thick] (axis cs:1.7+8,3.5)--(axis cs:1.7+8,3)--(axis cs:3+8,3.4)--(axis cs:3+8,3.9)--cycle;
\draw[fill=black!70, thick] (axis cs:-1.85+8,3) rectangle (axis cs:1.7+8,3.5);
\filldraw[fill=red!50] (axis cs:-1.85+8,3.5)--(axis cs:-0.65+8,3.9)--(axis cs:3+8,3.9)--(axis cs:1.7+8,3.5)--cycle;

\draw[thick] (axis cs:-1.85+8,2.6)--(axis cs:1.7+8,2.6);
\draw[thick] (axis cs:-1.85+8,2.4)--(axis cs:-1.85+8,2.8);
\draw[thick] (axis cs:1.7+8,2.4)--(axis cs:1.7+8,2.8);
\node at (axis cs:8.1,2.05) {$w$};

\draw[thick] (axis cs:1.85+8,2.6)--(axis cs:3.15+8,3.1);
\draw[thick] (axis cs:1.85+8,2.4)--(axis cs:1.85+8,2.8);
\draw[thick] (axis cs:3.15+8,2.9)--(axis cs:3.15+8,3.3);
\node at (axis cs:2.8+8,2.4) {$w$};

\draw[thick] (axis cs:3.4+8,3.5)--(axis cs:3.4+8,3.9);
\draw[thick] (axis cs:3.25+8,3.5)--(axis cs:3.55+8,3.5);
\draw[thick] (axis cs:3.25+8,3.9)--(axis cs:3.55+8,3.9);
\node at (axis cs:4.2+8,3.7) {$dx$};

\node at (axis cs:-4.45,3.5) {$9$};
\draw[thick] (axis cs:-4,0)--(axis cs:-4,7);
\draw[thick] (axis cs:-4.15,0)--(axis cs:-3.85,0);
\draw[thick] (axis cs:-4.15,7)--(axis cs:-3.85,7);

\draw[thick] (axis cs:-4+0.5,7)--(axis cs:-4+0.5,3.25);
\draw[thick] (axis cs:-4.15+0.5,7)--(axis cs:-3.85+0.5,7);
\draw[thick] (axis cs:-4.15+0.5,3.25)--(axis cs:-3.85+0.5,3.25);
\node at (axis cs:-3.1,5.15) {$x$};

\draw[thick] (axis cs:-3.2,-0.75)--(axis cs:2.8,-0.75);
\draw[thick] (axis cs:-3.2,-0.95)--(axis cs:-3.2,-0.55);
\draw[thick] (axis cs:2.8,-0.95)--(axis cs:2.8,-0.55);
\node at (axis cs:-0.2,-1.45) {$5$};

\draw[thick] (axis cs:3.1,-0.6)--(axis cs:5.15,0.5);
\draw[thick] (axis cs:3.1,-0.8)--(axis cs:3.1,-0.4);
\draw[thick] (axis cs:5.15,0.3)--(axis cs:5.15,0.7);
\node at (axis cs:4.55,-0.5) {$5$};
\end{axis}
\end{tikzpicture} 
\end{minipage}

If we let $x$ be the distance from the top of the pyramid and $w$ be the width of a horizontal slice $x$ units down from the top, we have that $w=0$ when $x=0$ and $w=5$ when $x=9$. Thus $\Delta w/\Delta x = 5/9$ and so $w=\dfrac{5}{9}x$. Notice that the formula for the volume of a horizontal slice is \fbox{$w^2\,dx = \left(\dfrac{5}{9}x\right)^2\,dx$}. Finally, to compute the volume of the pyramid, we need to add up the volume of all of these slices as $x$ goes from $x=0$ (the top) to $x=9$ (the bottom): \fbox{$\displaystyle \int_0^9 \left(\dfrac{5}{9}x\right)^2\,dx$} (which equals $75$).

Alternatively, we could let $x$ be the distance from the bottom of the pyramid. Then $w=0$ when $x=9$ and $w=5$ when $x=0$. Thus $\Delta w/\Delta = -5/9$ and so $w=-\dfrac{5}{9}x+5$. Now the formula for the volume of a horizontal slice is $w^2\,dx = \left(-\dfrac{5}{9}x+5\right)^2\,dx$ and the volume of the pyramid (still summing up from $x=0$ to $x=9$ -- now bottom to top) is $\displaystyle \int_0^9 \left(-\dfrac{5}{9}x+5\right)^2\,dx$ (which still equals $75$).

\vspace{0.05in}

\noindent {\bf \large 7. (8 points)} %Arc Length
%
%\begin{enumerate}[(a)]
%\item Compute the arc length of the portion of the graph of $y=2x^{3/2}$ where $0 \leq x \leq 1$.
%
%\vfill
%
%\item 
Set up an integral which computes the arc length of $y=\cos(x)$ where $-2\pi \leq x \leq 3\pi$.\\
\force \hfill {\bf Do not try to evaluate this integral.}

\vspace{-0.2in}

$$\text{Arc Length} = \int_a^b \sqrt{1+\left(\dfrac{dy}{dx}\right)^2}\,dx = \mbox{\fbox{$\displaystyle \int_{-2\pi}^{3\pi} \sqrt{1+\sin^2(x)\strut}\,dx$}} \qquad \text{ since } \dfrac{dy}{dx}=-\sin(x)$$

%\end{enumerate}

\noindent {\bf \large 8. (13 points)} We have a cylindrical tank with radius $1$ foot that is $6$ feet tall. The tank is half filled with a liquid which weights $20$  lbs. per cubic foot. Suppose we pump this liquid just over the rim of the top of the tank. Compute the work done.

\vspace{0.05in}

\noindent
\begin{minipage}{5.75in}
We slice the liquid horizontally. Let $x$ be the distance from the bottom of the tank. Then $6-x$ is the distance to the top of the tank -- this is how far a slice of liquid needs to be moved. Each slice has volume $\pi\,1^2\,dx$ cubic feet (since the tank has circular cross sections with radius $1$). The liquid weighs $20$ lbs. per cubic foot, so a slice weighs $20 \cdot \pi 1^2\,dx = 20\pi\,dx$ lbs. The work moving a slice is force $\times$ distance $= 20\pi\,dx \cdot (6-x)$ since weight is the force due to gravity. We then need to add up the work it takes to move each slice from the bottom of the tank (i.e., $x=0$) up to half of the height of the tank (i.e., $x=6/2=3$) since the tank is only half full. Therefore,

\vspace{-0.25in}

$$\text{Work} = \int_0^3 (6-x)20\pi\,dx = \pi \int_0^3 120-20x\,dx = \pi(120x-10x^2)\Big|_0^3=\pi(120(3)-10(3^2))-0$$

\vspace{-0.1in}

Thus the work done is $\pi(360-90)=$ \fbox{270$\pi$ ft.-lbs.} \hfill [{\it Note:} A full tank be 360$\pi$ ft.-lbs.]
\end{minipage}
\hfill
\begin{minipage}{2in}
\force \hfill
\begin{tikzpicture}
\begin{axis}[
  %axis x line=middle, axis y line=middle,
  axis x line = none,
  axis y line = none,
  ticks = none,
  width=2in, height=2.5in,     % size of the image = rigged to keep scaling=constrained
  ymin=-1.1, ymax=10.6, % ytick={0}, ylabel=$y$,
  xmin=-5.55, xmax=4.25, % xtick={0}, xlabel=$x$,
]

\addplot[name path=A, domain=0:180, ultra thick, blue] ({2*cos(x)},{sin(x)/2+5});
\addplot[name path=B, domain=180:360, ultra thick] ({2*cos(x)},{sin(x)/2});

\addplot[domain=180:360, ultra thick, blue] ({2*cos(x)},{sin(x)/2+5});
\addplot[domain=0:180, ultra thick, blue] ({2*cos(x)},{sin(x)/2});
\addplot[domain=0:1, ultra thick, blue] ({1.78*x},{-0.227*x});

\addplot[blue!10] fill between[of=A and B];

\addplot[domain=0:360, ultra thick] ({2*cos(x)},{sin(x)/2+10});
\addplot[domain=180:360, ultra thick] ({2*cos(x)},{sin(x)/2});

\addplot[name path=C, domain=180:360, ultra thick, green] ({2*cos(x)},{sin(x)/2+3});
\addplot[name path=D, domain=0:180, ultra thick, green] ({2*cos(x)},{sin(x)/2+3});
\addplot[name path=E, domain=180:360, ultra thick, green] ({2*cos(x)},{sin(x)/2+2.7});
\addplot[green!20] fill between[of=C and D];
\addplot[green!50] fill between[of=C and E];

\addplot[domain=0:2.6, ultra thick] ({-2.65},{x});
\addplot[domain=3.1:10, ultra thick] ({-2.65},{x});
\addplot[domain=-0.2:0.2, ultra thick] ({x-2.65},{0});
\addplot[domain=-0.2:0.2, ultra thick] ({x-2.65},{10});
\addplot[domain=-0.2:0.2, ultra thick] ({x-2.65},{2.6});
\addplot[domain=-0.2:0.2, ultra thick] ({x-2.65},{3.1});

\addplot[domain=2.6:3.1, ultra thick] ({-3.2},{x});
\addplot[domain=-0.2:0.2, ultra thick] ({x-3.2},{2.6});
\addplot[domain=-0.2:0.2, ultra thick] ({x-3.2},{3.1});

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

\node at (axis cs:2.2,-0.8) {$1$ft.};

\addplot[domain=0:7, ultra thick] ({2.65},{x});
\addplot[domain=8:10, ultra thick] ({2.65},{x});
\addplot[domain=-0.2:0.2, ultra thick] ({x+2.65},{0});
\addplot[domain=-0.2:0.2, ultra thick] ({x+2.65},{10});

\node at (axis cs:3.25,7.5) {$6$ft.};

\node at (axis cs:-3.2,1.25) {$x$};
\node at (axis cs:-4.3,6.5) {$\mbox{\,}6-x$};
\node at (axis cs:-4.05,2.85) {$dx$};

\draw[dashed,->] (axis cs:-3.75,5)--(axis cs:-2.1,5);
\node at (axis cs:-4.7,5) {$3$ ft.};
\end{axis}
\end{tikzpicture}
\end{minipage}

\end{document}

