\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}
\usetikzlibrary{angles,quotes}

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

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

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

\begin{document}

%\pagestyle{empty}

\noindent
\parbox{2in}{\bf Math 1120 Form A}
\hfill {\Large \bf Test \#2} \hfill
\parbox{2in}{\bf \hfill Oct. $5^\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. (25 points)} Pythagorean Theorem

\begin{enumerate}[(a)]

\item Write down the Pythagorean Theorem trigonometric identity relating sine and cosine. Then write down the other version relating tangent and secant.

\vspace{-0.05in}

Identity \#1: \quad \underline{\quad $\sin^2(x)+\cos^2(x)=1$ \quad} \qquad 
Identity \#2: \quad \underline{\quad $\tan^2(x)+1=\sec^2(x)$ \quad or \quad $\sec^2(x)-1=\tan^2(x)$ \quad}

\vspace{0.05in}

\item In each of the following integrals, use the proper (inverse) trigonometric substitution to simplify the integral. {\bf Do NOT} integrate. Just substitute and {\bf simplify}.

\vspace{-0.05in}

\begin{itemize}
\item $\displaystyle \int \dfrac{dx}{x^2\sqrt{x^2+9\strut}} = \int \dfrac{3\sec^2(\theta)\,d\theta}{9\tan^2(\theta)\sqrt{9\tan^2(\theta)+9}} = \int \dfrac{3\sec^2(\theta)\,d\theta}{9\tan^2(\theta)\sqrt{9(\tan^2(\theta)+1)}} = \int \dfrac{3\sec^2(\theta)\,d\theta}{9\tan^2(\theta)\sqrt{9\sec^2(\theta)}}$

\force \qquad \qquad $\displaystyle = \int \dfrac{3\sec^2(\theta)\,d\theta}{9\tan^2(\theta)3\sec(\theta)} =$ \fbox{$\displaystyle \int \dfrac{\sec(\theta)}{9\tan^2(\theta)}\,d\theta$}

We used the substitution $x=3\tan(\theta)$ so that $dx=3\sec^2(\theta)\,d\theta$ since we had $\sqrt{x^2+a^2\strut}$ to collapse.

\item $\displaystyle \int \dfrac{\sqrt{x^2-4\strut}}{x}\,dx = \int \dfrac{\sqrt{4\sec^2(\theta)-4}}{2\sec(\theta)}\cdot 2\sec(\theta)\tan(\theta)\,d\theta = \int \sqrt{4(\sec^2(\theta)-1)} \cdot \tan(\theta)\,d\theta$

\force \qquad \qquad $\displaystyle = \int \sqrt{4\tan^2(\theta)} \cdot \tan(\theta)\,d\theta =$ \fbox{$\displaystyle \int 2\tan^2(\theta)\,d\theta$}

We used the substitution $x=2\sec(\theta)$ so that $dx=2\sec(\theta)\tan(\theta)\,d\theta$ since we had $\sqrt{x^2-a^2\strut}$ to collapse.

\item $\displaystyle \int_0^5 \sqrt{25-x^2}\,dx = \int_0^{\pi/2} \sqrt{25-25\sin^2(\theta)} \cdot 5\cos(\theta)\,d\theta = \int_0^{\pi/2} \sqrt{25(1-\sin^2(\theta))} \cdot 5\cos(\theta)\,d\theta$ 

\force \qquad \qquad $\displaystyle = \int_0^{\pi/2} \sqrt{25\cos^2(\theta)}\cdot 5\cos(\theta)\,d\theta =$ \fbox{$\displaystyle \int_0^{\pi/2} 25\cos^2(\theta)\,d\theta$}

We used the substitution $x=5\sin(\theta)$ so that $dx=5\cos(\theta)\,d\theta$ since we had $\sqrt{a^2-x^2}$ to collapse. To change the bounds, notice that $x=0$ implies $5\sin(\theta)=0$ so $\sin(\theta)=0$. Thus our new lower bound is $\theta=0$. Also, $x=5$ implies $5\sin(\theta)=5$ so $\sin(\theta)=1$. Thus our new upper bound is $\theta=\pi/2$.

\end{itemize}

\vspace{-0.1in}

\item Given $x=3\sin(\theta)$, rewrite $7\theta-4\tan(\theta)$ in terms of $x$.

\begin{minipage}{1.25in}
\begin{tikzpicture}
\draw coordinate (a) --++(0:2*0.87cm) coordinate[label=below:$\sqrt{9-x^2\strut}$] (amb) --++(0:2*0.87cm) coordinate (b)%
          --++(90:2*0.5cm) coordinate[label=right:$x$] (bmc) --++(90:2*0.5cm) coordinate (c)%
          --++(210:2*1cm) coordinate[label=above left:$3$] (cma);

\draw[name path=abc] (a)--(b)--(c)--cycle;

\draw[use as bounding box] (b) --++(90:0.2cm) --++(180:0.2cm) --++(270:0.2cm) --cycle;

\pic[draw, "$\theta$", angle eccentricity=1.6] {angle=b--a--c};
\end{tikzpicture}
\end{minipage}
\hfill
\begin{minipage}{5.25in}
Notice $x=3\sin(\theta)$ implies $\sin(\theta) = x/3$ and so $\theta = \mathrm{arcsin}(x/3)$. To help simplify $\tan(\theta)$ we draw a triangle whose opposite side is $x$ and hypotenuse is $x$ (so that $\sin(\theta)=x/3$). 

Our adjacent side is $\sqrt{\text{Hypotenuse}^2 - \text{Opposite}^2\strut} = \sqrt{9-x^2\strut}$ (by the Pythagorean theorem). Thus, $\tan(\theta) = \dfrac{x}{\sqrt{9-x^2}}$ (i.e., opposite over adjacent).

Therefore, $7\theta-4\tan(\theta) =$ \fbox{$7\,\mathrm{arcsin}\left(\dfrac{x}{3}\right)-\dfrac{4x}{\sqrt{9-x^2}}$}
\end{minipage}
\end{enumerate}

\vspace{-0.15in}

\noindent {\bf \large 2. (8 points)} Write down the ``forms'' we would use to find the partial fraction decomposition of \quad $\displaystyle \dfrac{3x^5-x^4+9x^2+8}{x(x+6)^3(x^2+x+3)^2}$.

\vspace{-0.05in}

\force \hfill
\fbox{$\displaystyle \dfrac{A}{x}+\dfrac{B}{x+6}+\dfrac{C}{(x+6)^2}+\dfrac{D}{(x+6)^3}+\dfrac{Ex+F}{x^2+x+3}+\dfrac{Gx+H}{(x^2+x+3)^2}$}
\hfill \force

\vspace{0.05in}

\noindent {\bf \large 3. (15 points)} Complete the Square

\begin{enumerate}[(a)]

\item To integrate $\displaystyle \int \dfrac{6x}{\sqrt{1+3x-x^2}}\,dx$ we would need to split the integral into a $u$-substitution integral and an integral where we complete the square in the radical. Split this integral into those two pieces. {\bf Do NOT} integrate.

Let $u=-x^2+3x+1$ so that $du=(-2x+3)\,dx$. To match up with ``$6x$'', we need $-3\,du = (6x-9)\,dx$. Therefore, to split the integral into a part that can be tackled with a substitution and a part that can be done by using our completing the square technique, we need to subtract and add $9$.

\vspace{0.05in}

\force\hfill
$\displaystyle \int \dfrac{6x}{\sqrt{1+3x-x^2}}\,dx$ \quad $=$ \quad \underline{\qquad $\displaystyle \int \dfrac{6x-9}{\sqrt{1+3x-x^2}}\,dx$ \qquad} \quad $+$ \quad \underline{\qquad $\displaystyle \int \dfrac{9}{\sqrt{1+3x-x^2}}\,dx$ \qquad}
\hfill\force

\vspace{0.05in}

\item Compute \quad $\displaystyle \int \dfrac{3}{x^2-4x+13}\,dx = \int \dfrac{3}{(x-2)^2+9}\,dx = \int \dfrac{3}{9} \cdot \dfrac{1}{\frac{(x-2)^2}{9}+1}\,dx = \int \dfrac{1}{3} \cdot \dfrac{1}{\left(\frac{x-2}{3}\right)^2+1}\,dx = \int \dfrac{1}{u^2+1}\,du$

\force \qquad \qquad $= \mathrm{arctan}(u)+C =$ \fbox{$\mathrm{arctan}\left(\dfrac{x-2}{3}\right)+C$}  \qquad where we used $u=\dfrac{x-2}{3}$ so that $du=\dfrac{1}{3}\,dx$.

\end{enumerate}

\vspace{-0.15in}

\noindent {\bf \large 4. (18 points)} Integrate!

\begin{enumerate}[(a)]

\item $\displaystyle \int x^2e^{4x}\,dx = \dfrac{1}{4}x^2e^{4x} - \int \dfrac{1}{2}xe^{4x}\,dx = \dfrac{1}{4}x^2e^{4x}-\dfrac{1}{8}xe^{4x}-\int -\dfrac{1}{8}e^{4x}\,dx = $  \fbox{$\displaystyle \dfrac{1}{4}x^2e^{4x}-\dfrac{1}{8}xe^{4x}+\dfrac{1}{32}e^{4x}+C$}

We used integration by parts, $\int u\,dv = uv-\int v\,du$, twice. First, we let $u=x^2$ and $dv=e^{4x}\,dx$ so that $du=2x\,dx$ and $v=\frac{1}{4}e^{4x}$. The second time, we let $u=-\frac{1}{2}x$ and $dv=e^{4x}\,dx$ so that $du=-\frac{1}{2}\,dx$ and $v=\frac{1}{4}e^{4x}$. Notice that we {\it could} integrate both natural ``parts'' in each integral. However, by choosing $u=x^2$ and then $u=-x/2$, we ended up with ``simpler'' $du$'s.

\vspace{0.05in}

Alternatively, we could use undetermined coefficients. The integral must be of the form: $y=(Ax^2+Bx+C)e^{4x}$. Therefore, $y'=(2Ax+B)e^{4x}+(Ax^2+Bx+C)4e^{4x} = (4Ax^2+(2A+4B)x+(B+4C))e^{4x}$ where we need $y'=x^2e^{4x} = (1\cdot x^2+0x+0)e^{4x}$. Thus $4A=1$, $2A+4B=0$, and $B+4C=0$. This means $A=1/4$, $B=-A/2=-1/8$, and $C=-B/4 = 1/32$ and thus (once again) we get
$\displaystyle \int x^2e^{4x}\,dx =$ \fbox{$\displaystyle \left(\dfrac{1}{4}x^2-\dfrac{1}{8}x+\dfrac{1}{32}\right)e^{4x}+C$}.

\vspace{0.05in}

\item $\displaystyle \int \sin^3(x)\cos^4(x)\,dx = \int \sin^2(x)\cos^4(x)\sin(x)\,dx = \int (1-\cos^2(x))\cos^4(x) \sin(x)\,dx = \int (1-u^2)u^4(-du)$

\force \qquad \qquad $\displaystyle = \int (u^6-u^4)\,du = \dfrac{1}{7}u^7-\dfrac{1}{5}u^5+C =$ \fbox{$\displaystyle \dfrac{1}{7}\cos^7(x)-\dfrac{1}{5}\cos^5(x)+C$}

Since we had an odd power of sine, we factored out a sine, switched the remaining sines to cosines using the Pythagorean theorem. Then we used the substitution $u=\cos(x)$ so that $du=-\sin(x)\,dx$ and thus $-du=\sin(x)\,dx$.

\vspace{0.05in}

\item $\displaystyle \int_0^1 \mathrm{arctan}(x)\,dx = x\cdot\mathrm{arctan}(x)\Big|_0^1-\int_0^1 \dfrac{x}{x^2+1}\,dx =  \mathrm{arctan}(1)-\mathrm{arctan}(0) + \int_1^2 -\dfrac{1}{2} \cdot \dfrac{1}{u}\,du =  \dfrac{\pi}{4}-0 -\dfrac{1}{2}\ln(2) + \dfrac{1}{2}\ln(1)$

\force \qquad \qquad $=$ \fbox{$\displaystyle  \dfrac{\pi}{4}-\dfrac{\ln(2)}{2}$} 

We used integration by parts with $u=\mathrm{arctan}(x)$ and $dv=dx$ so that $du=dx/(x^2+1)$ and $v=x$. Notice that the only sensible parts were $\mathrm{arctan}(x)$ and $1$. We can't directly integrate $\mathrm{arctan}(x)$ (that's the whole point of this problem!) so we needed to make $dv =1\cdot dx$. Note that $\mathrm{arctan}(0)=0$. To get $\tan(\theta)=1$, we need Opposite = Adjacent. This means we have a $45^\circ$-$45^\circ$-$90^\circ$ triangle, so $\mathrm{arctan}(1)=\pi/4$. To handle the second integral we used the substitution $u=x^2+1$ so that $du=2x\,dx$ and so $du/2 = x\,dx$. The bounds change from 0 and 1 to $0^2+1=1$ and $1^2+1=2$.

%\vspace{0.05in}

\end{enumerate}

\noindent {\bf \large 5. (34 points)} Integrate!

\begin{enumerate}[(a)]

\item $\displaystyle \int e^x\sin(3x)\,dx = e^x\sin(3x)-\int 3e^x\cos(3x)\,dx = e^x\sin(3x)-3e^x\cos(3x)-\int 9e^x\sin(3x)\,dx$

We integrate by parts twice and then solve for the integral. First, let $u=\sin(3x)$ and $dv=e^x$ so that $du=3\cos(3x)\,dx$ and $v=e^x$. Then let $u=-3\cos(3x)$ and $dv=e^x$ so that $du=9\sin(3x)$ and $v=e^x$. If we let $I=\int e^x\sin(3x)\,dx$, our above calculation says that $I = e^x\sin(3x)-3e^x\cos(3x)-9I$ so that $10I = e^x\sin(3x)-3e^x\cos(3x)$. Therefore, $\displaystyle \int e^x\sin(3x)\,dx = I =$ \fbox{$\displaystyle \dfrac{1}{10}e^x\sin(3x)-\dfrac{3}{10}e^x\cos(3x)+C$}

\vspace{0.05in}

Alternatively, we could use undetermined coefficients to find this integral. We know that the integral must of the form $y=Ae^x\sin(3x)+Be^x\cos(3x)$. Thus $y'=Ae^x\sin(3x)+3Ae^x\cos(3x)+Be^x\cos(3x)-3Be^x\sin(3x) = (A-3B)e^x\sin(3x)+(3A+B)e^x\cos(3x)$. This must match our integrand $e^x\sin(3x) = 1\cdot e^x\sin(3x)+0\cdot e^x\cos(3x)$ so that $A-3B=1$ and $3A+B=0$. Thus $B=-3A$ and plugging this into the first equation yields $A-3(-3A)=1$ so that $10A=1$ and thus $A=1/10$. Finally, $B=-3A=-3/10$. Once again we find that $\displaystyle \int e^x\sin(3x)\,dx =$ \fbox{$\displaystyle \dfrac{1}{10}e^x\sin(3x)-\dfrac{3}{10}e^x\cos(3x)+C$}

\vspace{0.05in}

Our final alternative method of computing this integral is complexification. We have that $e^{(1+3i)x} = e^xe^{3xi} = e^x\cos(3x)+ie^x\sin(3x)$. Thus the imaginary part of the integral of $e^{(1+3i)x}$ is our desired function. We have $\int e^{(1+3i)x}\,dx = \dfrac{1}{1+3i}e^{(1+3i)x}+C = \dfrac{1}{1+3i}\cdot\dfrac{1-3i}{1-3i}\left(e^x\cos(3x)+ie^x\sin(3x)\right)+C=\dfrac{1-3i}{1^2+3i(-3i)}\left(e^x\cos(3x)+ie^x\sin(3x)\right)+C$ $=\dfrac{1}{10}\left(1-3i\right)\left(e^x\cos(3x)+ie^x\sin(3x)\right)+C=\dfrac{1}{10}\left(e^x\cos(3x)-3i\cdot ie^x\sin(3x) +ie^x\sin(3x)-3ie^x\cos(3x)\right)+C$

$=\left(\dfrac{1}{10}e^x\cos(3x)+\dfrac{3}{10}e^x\sin(3x)\right)+i\left(\dfrac{1}{10}e^x\sin(3x)-\dfrac{3}{10}e^x\cos(3x)\right)+C$. We need the imaginary part so that yet again
$\displaystyle \int e^x\sin(3x)\,dx =$ \fbox{$\displaystyle \dfrac{1}{10}e^x\sin(3x)-\dfrac{3}{10}e^x\cos(3x)+C$}. 

As a bonus, we get that $\displaystyle \int e^x\cos(3x)\,dx = \dfrac{1}{10}e^x\cos(3x)+\dfrac{3}{10}e^x\sin(3x)+C$ (this is the desired integral from Form B).


\item $\displaystyle \int \tan^5(x)\sec^4(x)\,dx = \int \tan^5(x)\sec^2(x)\cdot \sec^2(x)\,dx = \int \tan^5(x)(\tan^2(x)+1)\sec^2(x)\,dx=\int u^5(u^2+1)\,du$ 

\force \qquad \qquad $\displaystyle = \int (u^7+u^5)\,du = \dfrac{1}{8}u^8+\dfrac{1}{6}u^6+C =$ \fbox{$\displaystyle \dfrac{1}{8}\tan^8(x)+\dfrac{1}{6}\tan^6(x)+C$}

We used the substitution $u=\tan(x)$ so that $du=\sec^2(x)\,dx$ since after peeling off $\sec^2(x)$, we were still left with an even power of secant (which we could convert into tangents using the Pythagorean theorem).

Alternatively, we could use the substitution $u=\sec(x)$ so that $du=\sec(x)\tan(x)\,dx$. This yields an equally correct answer, but the algebra is slightly more involved.

$\displaystyle \int \tan^5(x)\sec^4(x)\,dx = \int \tan^4(x)\sec^3(x)\cdot \sec(x)\tan(x)\,dx = \int (\tan^2(x))^2\sec^3(x)\cdot \sec(x)\tan(x)\,dx$ 

\force \qquad \qquad $\displaystyle = \int (\sec^2(x)-1)^2\sec^3(x)\cdot \sec(x)\tan(x)\,dx = \int (u^2-1)^2 u^3\,du = \int (u^4-2u^2+1)u^3\,du$

\force \qquad \qquad $\displaystyle = \int (u^7-2u^5+u^3)\,du = \dfrac{1}{8}u^8-\dfrac{2}{6}u^6+\dfrac{1}{4}u^4+C =$ \fbox{$\displaystyle \dfrac{1}{8}\sec^8(x)-\dfrac{1}{3}\sec^6(x)+\dfrac{1}{4}\sec^4(x)+C$}


\vspace{0.05in}

\item $\displaystyle \int \sqrt{4-x^2}\,dx = \int \sqrt{4-4\sin^2(\theta)}\cdot 2\cos(\theta)\,d\theta = \int \sqrt{4(1-\sin^2(\theta))}\cdot 2\cos(\theta)\,d\theta = \int \sqrt{4\cos^2(\theta)}\cdot 2\cos(\theta)\,d\theta$

\force\qquad\qquad $\displaystyle = \int 4\cos^2(\theta)\,d\theta = \int \left(2+2\cos(2\theta)\right)\,d\theta =  2\theta+\sin(2\theta)+C$

\force \qquad\qquad $\displaystyle =2\theta+2\sin(\theta)\cos(\theta)= 2\,\mathrm{arcsin}\left(\dfrac{x}{2}\right)+x\cdot\dfrac{\sqrt{4-x^2}}{2}+C=$ \fbox{$\displaystyle 2\,\mathrm{arcsin}\left(\dfrac{x}{2}\right)+\dfrac{x\sqrt{4-x^2}}{2}+C$}

\vspace{0.05in}

\begin{minipage}{1.25in}
\begin{tikzpicture}
\draw coordinate (a) --++(0:2*0.87cm) coordinate[label=below:$\sqrt{4-x^2\strut}$] (amb) --++(0:2*0.87cm) coordinate (b)%
          --++(90:2*0.5cm) coordinate[label=right:$x$] (bmc) --++(90:2*0.5cm) coordinate (c)%
          --++(210:2*1cm) coordinate[label=above left:$2$] (cma);

\draw[name path=abc] (a)--(b)--(c)--cycle;

\draw[use as bounding box] (b) --++(90:0.2cm) --++(180:0.2cm) --++(270:0.2cm) --cycle;

\pic[draw, "$\theta$", angle eccentricity=1.6] {angle=b--a--c};
\end{tikzpicture}
\end{minipage}
\hfill
\begin{minipage}{5.25in}
We use the substitution $x=2\sin(\theta)$ so that $dx=2\cos(\theta)\,d\theta$ to make $\sqrt{4-x^2}$ collapse. After plugging in the substitution and simplifying, we use the double angle identity $\cos^2(\theta)=\frac{1}{2}(1+\cos(2\theta))$. Then after integrating we use another double angle identity: $\sin(2\theta)=2\sin(\theta)\cos(\theta)$. Finally, we note that $\sin(\theta)=x/2$ so that $\theta=\mathrm{arcsin}(x/2)$ and draw a triangle with opposite side $x$ and hypotenuse $2$ to help simplify $\cos(\theta)$.
\end{minipage}

\item $\displaystyle \int \dfrac{2x^2+7x+4}{x(x+1)^2}\,dx$
\qquad 
We are integrating a rational function (the fraction is already proper), so we use a partial fraction decomposition. First, write down forms (our denominator is already factored):
$\dfrac{2x^2+7x+4}{x(x+1)^2} = \dfrac{A}{x}+\dfrac{B}{x+1}+\dfrac{C}{(x+1)^2}$. Next, clear the denominators by multiplying both side by $x(x+1)^2$ and get that $2x^2+7x+4=A(x+1)^2+Bx(x+1)+Cx$.

Plug in the root $x=-1$ to get $2(-1)^2+7(-1)+4=0+0+C(-1)$ so $-1=-C$. Thus $C=1$. Next plug in the root $x=0$. This gives us $0+0+4=A(1)^2+0+0$ so $A=4$. To get $B$ we can either multiply everything out and equate coefficients or plug in some other random number. The latter option is easiest. Let's plug in $x=1$: $2(1)^2+7(1)+4=A(1+1)^2+B(1)(1+1)+C(1)$. Thus $13=16+2B+1$ so $-4=2B$. Thus $B=-2$. 

Now we can integrate $\displaystyle \int \dfrac{2x^2+7x+4}{x(x+1)^2}\,dx = \int \left(\dfrac{4}{x}+\dfrac{-2}{x+1}+\dfrac{1}{(x+1)^2}\right)\,dx  = \int \left(\dfrac{4}{x}+\dfrac{-2}{x+1}+(x+1)^{-2}\right)\,dx$ 

\force \qquad \qquad $= 4\ln|x|-2\ln|x+1|-(x+1)^{-1}+C =$ \fbox{$\displaystyle 4\ln|x|-2\ln|x+1|-\dfrac{1}{x+1}+C$}

\vspace{0.05in}

\end{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\noindent
\parbox{2in}{\bf Math 1120 Form B}
\hfill {\Large \bf Test \#2} \hfill
\parbox{2in}{\bf \hfill Oct. $5^\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. (25 points)} Pythagorean Theorem

\begin{enumerate}[(a)]

\item Write down the Pythagorean Theorem trigonometric identity relating sine and cosine. Then write down the other version relating tangent and secant.

\vspace{-0.05in}

Identity \#1: \quad \underline{\quad $\sin^2(x)+\cos^2(x)=1$ \quad} \qquad 
Identity \#2: \quad \underline{\quad $\tan^2(x)+1=\sec^2(x)$ \quad or \quad $\sec^2(x)-1=\tan^2(x)$ \quad}

\vspace{0.05in}

\item In each of the following integrals, use the proper (inverse) trigonometric substitution to simplify the integral. {\bf Do NOT} integrate. Just substitute and {\bf simplify}.

\vspace{-0.05in}

\begin{itemize}
\item $\displaystyle \int \dfrac{dx}{x^2\sqrt{x^2+4\strut}} = \int \dfrac{2\sec^2(\theta)\,d\theta}{4\tan^2(\theta)\sqrt{4\tan^2(\theta)+4}} = \int \dfrac{2\sec^2(\theta)\,d\theta}{4\tan^2(\theta)\sqrt{4(\tan^2(\theta)+1)}} = \int \dfrac{2\sec^2(\theta)\,d\theta}{4\tan^2(\theta)\sqrt{4\sec^2(\theta)}}$

\force \qquad \qquad $\displaystyle = \int \dfrac{2\sec^2(\theta)\,d\theta}{4\tan^2(\theta)2\sec(\theta)} =$ \fbox{$\displaystyle \int \dfrac{\sec(\theta)}{4\tan^2(\theta)}\,d\theta$}

We used the substitution $x=2\tan(\theta)$ so that $dx=2\sec^2(\theta)\,d\theta$ since we had $\sqrt{x^2+a^2\strut}$ to collapse.

\item $\displaystyle \int \dfrac{\sqrt{x^2-9\strut}}{x}\,dx = \int \dfrac{\sqrt{9\sec^2(\theta)-9}}{3\sec(\theta)}\cdot 3\sec(\theta)\tan(\theta)\,d\theta = \int \sqrt{9(\sec^2(\theta)-1)} \cdot \tan(\theta)\,d\theta$

\force \qquad \qquad $\displaystyle = \int \sqrt{9\tan^2(\theta)} \cdot \tan(\theta)\,d\theta =$ \fbox{$\displaystyle \int 3\tan^2(\theta)\,d\theta$}

We used the substitution $x=3\sec(\theta)$ so that $dx=3\sec(\theta)\tan(\theta)\,d\theta$ since we had $\sqrt{x^2-a^2\strut}$ to collapse.

\item $\displaystyle \int_0^4 \sqrt{16-x^2}\,dx = \int_0^{\pi/2} \sqrt{16-16\sin^2(\theta)} \cdot 4\cos(\theta)\,d\theta = \int_0^{\pi/2} \sqrt{16(1-\sin^2(\theta))} \cdot 4\cos(\theta)\,d\theta$ 

\force \qquad \qquad $\displaystyle = \int_0^{\pi/2} \sqrt{16\cos^2(\theta)}\cdot 4\cos(\theta)\,d\theta =$ \fbox{$\displaystyle \int_0^{\pi/2} 16\cos^2(\theta)\,d\theta$}

We used the substitution $x=4\sin(\theta)$ so that $dx=4\cos(\theta)\,d\theta$ since we had $\sqrt{a^2-x^2}$ to collapse. To change the bounds, notice that $x=0$ implies $4\sin(\theta)=0$ so $\sin(\theta)=0$. Thus our new lower bound is $\theta=0$. Also, $x=4$ implies $4\sin(\theta)=4$ so $\sin(\theta)=1$. Thus our new upper bound is $\theta=\pi/2$.

\end{itemize}

\vspace{-0.1in}

\item Given $x=5\sin(\theta)$, rewrite $4\theta-7\tan(\theta)$ in terms of $x$.

\begin{minipage}{1.25in}
\begin{tikzpicture}
\draw coordinate (a) --++(0:2*0.87cm) coordinate[label=below:$\sqrt{25-x^2\strut}$] (amb) --++(0:2*0.87cm) coordinate (b)%
          --++(90:2*0.5cm) coordinate[label=right:$x$] (bmc) --++(90:2*0.5cm) coordinate (c)%
          --++(210:2*1cm) coordinate[label=above left:$5$] (cma);

\draw[name path=abc] (a)--(b)--(c)--cycle;

\draw[use as bounding box] (b) --++(90:0.2cm) --++(180:0.2cm) --++(270:0.2cm) --cycle;

\pic[draw, "$\theta$", angle eccentricity=1.6] {angle=b--a--c};
\end{tikzpicture}
\end{minipage}
\hfill
\begin{minipage}{5.25in}
Notice $x=5\sin(\theta)$ implies $\sin(\theta) = x/5$ and so $\theta = \mathrm{arcsin}(x/5)$. To help simplify $\tan(\theta)$ we draw a triangle whose opposite side is $x$ and hypotenuse is $x$ (so that $\sin(\theta)=x/5$). 

Our adjacent side is $\sqrt{\text{Hypotenuse}^2 - \text{Opposite}^2\strut} = \sqrt{25-x^2\strut}$ (by the Pythagorean theorem). Thus, $\tan(\theta) = \dfrac{x}{\sqrt{25-x^2}}$ (i.e., opposite over adjacent).

Therefore, $4\theta-7\tan(\theta) =$ \fbox{$4\,\mathrm{arcsin}\left(\dfrac{x}{5}\right)-\dfrac{7x}{\sqrt{25-x^2}}$}
\end{minipage}
\end{enumerate}

\vspace{-0.15in}

\noindent {\bf \large 2. (8 points)} Write down the ``forms'' we would use to find the partial fraction decomposition of \quad $\displaystyle \dfrac{3x^5-x^4+9x^2+8}{x^3(x+7)(x^2+x+11)^2}$.

\vspace{-0.05in}

\force \hfill
\fbox{$\displaystyle \dfrac{A}{x}+\dfrac{B}{x^2}+\dfrac{C}{x^3}+\dfrac{D}{x+7}+\dfrac{Ex+F}{x^2+x+11}+\dfrac{Gx+H}{(x^2+x+11)^2}$}
\hfill \force

\vspace{0.05in}

\noindent {\bf \large 3. (15 points)} Complete the Square

\begin{enumerate}[(a)]

\item To integrate $\displaystyle \int \dfrac{10x}{\sqrt{1+4x-x^2}}\,dx$ we would need to split the integral into a $u$-substitution integral and an integral where we complete the square in the radical. Split this integral into those two pieces. {\bf Do NOT} integrate.

Let $u=-x^2+4x+1$ so that $du=(-2x+4)\,dx$. To match up with ``$10x$'', we need $-5\,du = (10x-20)\,dx$. Therefore, to split the integral into a part that can be tackled with a substitution and a part that can be done by using our completing the square technique, we need to subtract and add $20$.

\vspace{0.05in}

\force\hfill
$\displaystyle \int \dfrac{10x}{\sqrt{1+4x-x^2}}\,dx$ \quad $=$ \quad \underline{\qquad $\displaystyle \int \dfrac{10x-20}{\sqrt{1+4x-x^2}}\,dx$ \qquad} \quad $+$ \quad \underline{\qquad $\displaystyle \int \dfrac{20}{\sqrt{1+4x-x^2}}\,dx$ \qquad}
\hfill\force

\vspace{0.05in}

\item Compute \quad $\displaystyle \int \dfrac{2}{x^2-6x+13}\,dx = \int \dfrac{2}{(x-3)^2+4}\,dx = \int \dfrac{2}{4} \cdot \dfrac{1}{\frac{(x-3)^2}{4}+1}\,dx = \int \dfrac{1}{2} \cdot \dfrac{1}{\left(\frac{x-3}{2}\right)^2+1}\,dx = \int \dfrac{1}{u^2+1}\,du$

\force \qquad \qquad $= \mathrm{arctan}(u)+C =$ \fbox{$\mathrm{arctan}\left(\dfrac{x-3}{2}\right)+C$}  \qquad where we used $u=\dfrac{x-3}{2}$ so that $du=\dfrac{1}{2}\,dx$.

\end{enumerate}

\vspace{-0.15in}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\vspace{-0.05in}

\noindent {\bf \large 4. (18 points)} Integrate!

\begin{enumerate}[(a)]

\item $\displaystyle \int x^2e^{-x}\,dx = -x^2e^{-x} - \int -2xe^{-x}\,dx = -x^2e^{-x}-2xe^{-x}-\int -2e^{-x}\,dx = $  \fbox{$\displaystyle -x^2e^{-x}-2xe^{-x}-2e^{-x}+C$}

We used integration by parts, $\int u\,dv = uv-\int v\,du$, twice. First, we let $u=x^2$ and $dv=e^{-x}\,dx$ so that $du=2x\,dx$ and $v=-e^{-x}$. The second time, we let $u=2x$ and $dv=e^{-x}\,dx$ so that $du=2\,dx$ and $v=-e^{-x}$. Notice that we {\it could} integrate both natural ``parts'' in each integral. However, by choosing $u=x^2$ and then $u=2x$, we ended up with ``simpler'' $du$'s.

\vspace{0.05in}

Alternatively, we could use undetermined coefficients. The integral must be of the form: $y=(Ax^2+Bx+C)e^{-x}$. Therefore, $y'=(2Ax+B)e^{-x}-(Ax^2+Bx+C)e^{-x} = (-Ax^2+(2A-B)x+(B-C))e^{-x}$ where we need $y'=x^2e^{-x} = (1\cdot x^2+0x+0)e^{-x}$. Thus $-A=1$, $2A-B=0$, and $B-C=0$. This means $A=-1$, $B=2A=-2$, and $C=B=-2$ and thus (once again) we get
$\displaystyle \int x^2e^{-x}\,dx =$ \fbox{$\displaystyle \left(-x^2-2x-2\right)e^{-x}+C$}.

\vspace{0.05in}

\item $\displaystyle \int \sin^4(x)\cos^x(x)\,dx = \int \sin^4(x)\cos^2(x)\cos(x)\,dx = \int \sin^4(x)(1-\sin^2(x))\cos(x)\,dx = \int u^4(1-u^2)\, du$

\force \qquad \qquad $\displaystyle = \int (-u^6+u^4)\,du = -\dfrac{1}{7}u^7+\dfrac{1}{5}u^5+C =$ \fbox{$\displaystyle -\dfrac{1}{7}\sin^7(x)+\dfrac{1}{5}\sin^5(x)+C$}

Since we had an odd power of cosine, we factored out a cosine, switched the remaining cosines to sines using the Pythagorean theorem. Then we used the substitution $u=\sin(x)$ so that $du=\cos(x)\,dx$.

\vspace{0.05in}

\item $\displaystyle \int_0^1 \mathrm{arctan}(x)\,dx$ \qquad [Same as Form A]

\vspace{0.05in}

\end{enumerate}

\noindent {\bf \large 5. (34 points)} Integrate!

\begin{enumerate}[(a)]


\item $\displaystyle \int e^x\cos(3x)\,dx = e^x\cos(3x)-\int -3e^x\sin(3x)\,dx = e^x\cos(3x)+3e^x\sin(3x)-\int 9e^x\cos(3x)\,dx$

We integrate by parts twice and then solve for the integral. First, let $u=\cos(3x)$ and $dv=e^x$ so that $du=-3\sin(3x)\,dx$ and $v=e^x$. Then let $u=3\sin(3x)$ and $dv=e^x$ so that $du=9\cos(3x)$ and $v=e^x$. If we let $I=\int e^x\cos(3x)\,dx$, our above calculation says that $I = e^x\cos(3x)+3e^x\sin(3x)-9I$ so that $10I = e^x\cos(3x)+3e^x\sin(3x)$. Therefore, $\displaystyle \int e^x\cos(3x)\,dx = I =$ \fbox{$\displaystyle \dfrac{1}{10}e^x\cos(3x)+\dfrac{3}{10}e^x\sin(3x)+C$}

\vspace{0.05in}

Alternatively, we could use undetermined coefficients to find this integral. We know that the integral must of the form $y=Ae^x\sin(3x)+Be^x\cos(3x)$. Thus $y'=Ae^x\sin(3x)+3Ae^x\cos(3x)+Be^x\cos(3x)-3Be^x\sin(3x) = (A-3B)e^x\sin(3x)+(3A+B)e^x\cos(3x)$. This must match our integrand $e^x\cos(3x) = 0\cdot e^x\sin(3x)+1\cdot e^x\cos(3x)$ so that $A-3B=0$ and $3A+B=1$. Thus $A=3B$ and plugging this into the second equation yields $3(3B)+B=1$ so that $10B=1$ and thus $B=1/10$. Finally, $A=3B=3/10$. Once again we find that $\displaystyle \int e^x\cos(3x)\,dx =$ \fbox{$\displaystyle \dfrac{3}{10}e^x\sin(3x)+\dfrac{1}{10}e^x\cos(3x)+C$}

\vspace{0.05in}

We could also integrate this using a complexification. See Form A for this calculation (here we want the real part not the imaginary part).

\item $\displaystyle \int \tan^3(x)\sec^6(x)\,dx = \int \tan^3(x)(\sec^2(x))^2 \cdot \sec^2(x)\,dx = \int \tan^3(x)(\tan^2(x)+1)^2\sec^2(x)\,dx=\int u^3(u^2+1)^2\,du$ 

\force \qquad \qquad $\displaystyle = \int u^3(u^4+2u^2+1)\,du = \int (u^7+2u^5+u^3)\,du = \dfrac{1}{8}u^8+\dfrac{2}{6}u^6+\dfrac{1}{4}u^4+C =$ \fbox{$\displaystyle \dfrac{1}{8}\tan^8(x)+\dfrac{1}{3}\tan^6(x)+\dfrac{1}{4}\tan^4(x)+C$}

We used the substitution $u=\tan(x)$ so that $du=\sec^2(x)\,dx$ since after peeling off $\sec^2(x)$, we were still left with an even power of secant (which we could convert into tangents using the Pythagorean theorem).

Alternatively, we could use the substitution $u=\sec(x)$ so that $du=\sec(x)\tan(x)\,dx$. This yields an equally correct answer, and this yields a better route since the algebra is easier.

$\displaystyle \int \tan^3(x)\sec^6(x)\,dx = \int \tan^2(x)\sec^5(x)\cdot \sec(x)\tan(x)\,dx = \int (\sec^2(x)-1)\sec^5(x)\cdot \sec(x)\tan(x)\,dx = \int (u^2-1) u^5\,du$ 

\force \qquad \qquad $\displaystyle  = \int (u^7-u^5)\,du = \dfrac{1}{8}u^8-\dfrac{1}{6}u^6+C =$ \fbox{$\displaystyle \dfrac{1}{8}\sec^8(x)-\dfrac{1}{6}\sec^6(x)+C$}


\item $\displaystyle \int \sqrt{9-x^2}\,dx = \int \sqrt{9-9\sin^2(\theta)}\cdot 3\cos(\theta)\,d\theta = \int \sqrt{9(1-\sin^2(\theta))}\cdot 3\cos(\theta)\,d\theta = \int \sqrt{9\cos^2(\theta)}\cdot 3\cos(\theta)\,d\theta$

\force\qquad\qquad $\displaystyle = \int 9\cos^2(\theta)\,d\theta = \int \dfrac{9}{2}\left(1+\cos(2\theta)\right)\,d\theta =  \dfrac{9}{2}\theta+\dfrac{9}{4}\sin(2\theta)+C$

\force \qquad\qquad $\displaystyle =\dfrac{9}{2}\theta+\dfrac{9}{2}\sin(\theta)\cos(\theta)= \dfrac{9}{2}\,\mathrm{arcsin}\left(\dfrac{x}{3}\right)+\dfrac{3}{2}x\cdot\dfrac{\sqrt{9-x^2}}{3}+C=$ \fbox{$\displaystyle \dfrac{9}{2}\,\mathrm{arcsin}\left(\dfrac{x}{3}\right)+\dfrac{x\sqrt{9-x^2}}{2}+C$}

\vspace{0.05in}

\begin{minipage}{1.25in}
\begin{tikzpicture}
\draw coordinate (a) --++(0:2*0.87cm) coordinate[label=below:$\sqrt{9-x^2\strut}$] (amb) --++(0:2*0.87cm) coordinate (b)%
          --++(90:2*0.5cm) coordinate[label=right:$x$] (bmc) --++(90:2*0.5cm) coordinate (c)%
          --++(210:2*1cm) coordinate[label=above left:$3$] (cma);

\draw[name path=abc] (a)--(b)--(c)--cycle;

\draw[use as bounding box] (b) --++(90:0.2cm) --++(180:0.2cm) --++(270:0.2cm) --cycle;

\pic[draw, "$\theta$", angle eccentricity=1.6] {angle=b--a--c};
\end{tikzpicture}
\end{minipage}
\hfill
\begin{minipage}{5.25in}
We use the substitution $x=3\sin(\theta)$ so that $dx=3\cos(\theta)\,d\theta$ to make $\sqrt{9-x^2}$ collapse. After plugging in the substitution and simplifying, we use the double angle identity $\cos^2(\theta)=\frac{1}{2}(1+\cos(2\theta))$. Then after integrating we use another double angle identity: $\sin(2\theta)=2\sin(\theta)\cos(\theta)$. Finally, we note that $\sin(\theta)=x/3$ so that $\theta=\mathrm{arcsin}(x/3)$ and draw a triangle with opposite side $x$ and hypotenuse $3$ to help simplify $\cos(\theta)$.
\end{minipage}


\item $\displaystyle \int \dfrac{3x^2+1}{x(x-1)^2}\,dx$ \qquad We are integrating a rational function (the fraction is already proper), so we use a partial fraction decomposition. First, write down forms (our denominator is already factored):
$ \dfrac{3x^2+1}{x(x-1)^2} = \dfrac{A}{x}+\dfrac{B}{x-1}+\dfrac{C}{(x-1)^2}$. Next, clear the denominators by multiplying both side by $x(x-1)^2$ and get that $3x^2+1=A(x-1)^2+Bx(x-1)+Cx$.

Plug in the root $x=1$ to get $3(1)^2+1=0+0+C(1)$ so $C=4$. Next plug in the root $x=0$. This gives us $0+1=A(-1)^2+0+0$ so $A=1$. To get $B$ we can either multiply everything out and equate coefficients or plug in some other random number. Let's multiply out: $3x^2+1=1(x-1)^2+Bx(x-1)+4x$ so $3x^2+1=x^2-2x+1+Bx^2-Bx+4x$. 
Thus $2x^2-2x=Bx^2-Bx$ so $B=2$.

Now we can integrate $\displaystyle \int \dfrac{3x^2+1}{x(x-1)^2}\,dx = \int \left(\dfrac{1}{x}+\dfrac{2}{x-1}+\dfrac{4}{(x-1)^2}\right)\,dx  = \int \left(\dfrac{1}{x}+\dfrac{2}{x-1}+4(x-1)^{-2}\right)\,dx$ 

\force \qquad \qquad $= \ln|x|+2\ln|x-1|-4(x-1)^{-1}+C =$ \fbox{$\displaystyle \ln|x|+2\ln|x-1|-\dfrac{4}{x-1}+C$}

\vspace{0.05in}


\end{enumerate}



\end{document}