% This is lecture no. 12 of MH1101/: Calculus II.

\chapter{Applications of Integration}%
\label{cha:applications_of_integration}

\section{Area Under a Curve}%
\label{sec:area_under_a_curve}

\begin{exmp}
	Find the area of the region enclosed by the curve $y=x^2$, $x=1$, $x=3$, and $y=0$.
	\begin{center}
		\begin{tikzpicture}
			\begin{axis}[
				axis lines = middle,
				xlabel = {$x$},
				ylabel = {$y$},
				xmin = 0,
				xmax = 4,
				ymin = 0,
				ymax = 13]

				\addplot [
				name path = A,
				domain = 0:3.2,
				samples = 100
				] {x^2}
				node [pos=1, above] {$y=x^2$};

				\addplot [
				name path = B,
				domain = 0:3.5
				] {0};

				\addplot [gray!30] fill between [of = A and B, soft clip={domain=1:3}];
				\draw [dashed] (axis cs:{1,0}) -- (axis cs:{1,1});
				\draw [dashed] (axis cs:{3,0}) -- (axis cs:{3,9});
			\end{axis}
		\end{tikzpicture}
	\end{center}
	\begin{sol}
		For $1\leqslant x \leqslant 3$, the area of a typical strip is:
		\[
			x^2\cdot \delta x
		.\]
		Thus the area of the bounded region is:
		\[
			\int_{1}^{3} x^2 \ud x= \left[\frac{x^3}{3}\right]^3_1 = \frac{26}{3}
		.\]
	\end{sol}
\end{exmp}
\begin{exmp}
	Find the area of the region lying above the line $y=1$ and below the curve $\displaystyle{y=\frac{5}{x^2+1}}$.
	\begin{sol}
		To find the intersection points, we must solve:
		\[
		1 = \frac{5}{x^2+1}
		,\]
		which gives $x^2+1=5$, so $x^2=4$ and $x=\pm 2$.
	\end{sol}
	\begin{center}
		\begin{tikzpicture}
			\begin{axis}[
				axis on top,
				axis lines = middle,
				xlabel = {$x$},
				ylabel = {$y$},
				xmin = -3.5,
				xmax = 3.5,
				ymin = 0,
				ymax = 5.5]

				\addplot [
				name path = A,
				domain = -3:3,
				samples = 100
				] {5/(x^2+1)}
				node [near end, right] {$y=\frac{5}{x^2+1}$};

				\addplot [
				name path = B,
				domain = -2:2
				] {1};

				\addplot [gray!30] fill between [of = A and B, soft clip={domain=-2:2}];
			\end{axis}
		\end{tikzpicture}
	\end{center}
	For $-2\leqslant x\leqslant 2$, the area of a typical strip is:
	\[
		\left(\frac{5}{x^2+1}-1\right)\cdot \delta x
	.\]
	Therefore the area of the region is then given by:
	\begin{align*}
		\int_{-2}^{2} \frac{5}{x^2+1}-1 \ud x & = \left[(5\tan^{-1}x)-x\right]^{2}_{-2}\\
						      & = 5(\tan^{-1}2-\tan^{-1}(-2))-4\\
						      & = 10\tan^{-1}(2) - 4.
	\end{align*}
\end{exmp}
\begin{exmp}
	Evaluate the area of the region bounded on the left by $y=\sqrt{x}$, and on the right by  $y=6-x$. 
	\begin{center}
		\begin{tikzpicture}
			\begin{axis}[
				axis on top,
				axis lines = middle,
				xlabel = {$x$},
				ylabel = {$y$},
				xmin = 0,
				xmax = 6.5,
				ymin = 0,
				ymax = 3.5]

				\addplot [
				name path = A,
				domain = 0:5.5,
				samples = 100
				] {x^(0.5)}
				node [pos=1, above] {$y=\sqrt{x}$};

				\addplot [
				name path = B,
				domain = 0:6
				] {0};

				\addplot [
				name path = C,
				domain = 3:6
				] {6-x}
				node [pos=0, above] {$y=6-x$};

				\addplot [gray!30] fill between [of = A and B, soft clip={domain=0:4}];
				\addplot [gray!30] fill between [of = C and B, soft clip={domain=4:6}];
				\draw [dashed] (axis cs:{0,2}) -- (axis cs:{4,2});
				\draw [dashed] (axis cs:{4,0}) -- (axis cs:{4,2});
			\end{axis}
		\end{tikzpicture}
	\end{center}
	For $0\leqslant y\leqslant 2$, note that:
	\[
	y = 6-x\implies x=6-y
	,\]
	and:
	\[
		y=\sqrt{x}\implies x=y^2
	.\]
	The area of a typical horizontal strip is given by:
	\[
		((6-y)-y^2)\cdot \delta y
	.\]
	Therefore, the area of the bounded region is given by:
	\begin{align*}
		\int_{0}^{2} 6-y-y^2 \ud y & = \left[6y-\frac{y^2}{2}-\frac{y^3}{3}\right]^2_0\\
					   & = 12 -2-\frac{8}{3}\\
					   & = \frac{22}{3}.
	\end{align*}
\end{exmp}

\section{Volume of Solid of Revolution}%
\label{sec:volume_of_solid_of_revolution}

\subsection{The Disc Method}%
\label{sub:the_disc_method}

Solids of revolution are solids obtained by revolving a region about a line.
The volume of a disc is $\pi r^2h$ where $r$ is the radius, and $h$ is the height of the disc.
To find the volume of a solid created by the revolution of an area around an axis, we substitute $r$ to be the length of a typical horizontal strip, and we substitute $h$ with our infinitesimal:
\[
	V = \pi\int_{a}^{b} (f(x))^2 \ud x
.\]
\begin{exmp}
	Find the volume of the solid obtained by rotating about the $x$-axis the region under the curve $y=\sqrt{x}$ from 0 to 1.
	\begin{center}
		\begin{tikzpicture}
			\begin{axis}[
				axis on top,
				axis lines = middle,
				xlabel = {$x$},
				ylabel = {$y$},
				xmin = 0,
				xmax = 2,
				ymin = 0,
				ymax = 1.5]

				\addplot [
				name path = A,
				domain = 0:1.5,
				samples = 100
				] {x^(0.5)}
				node [pos=1, above] {$y=\sqrt{x}$};

				\addplot [
				name path = B,
				domain = 0:2
				] {0};

				\addplot [gray!30] fill between [of = A and B, soft clip={domain=0:1}];
				\draw [dashed] (axis cs:{1,0}) -- (axis cs:{1,1});
			\end{axis}
		\end{tikzpicture}
	\end{center}
	\begin{sol}
		For $0\leqslant x\leqslant 1$, the volume of a typical disc is:
		\[
			\pi(\sqrt{x})^2\cdot \delta x=\pi x\cdot\delta x
		.\]
		Thus the volume of the solid is:
		\[
			\int_{0}^{1} \pi x \ud x=\pi \left[\frac{x^2}{2}\right]^{1}_0 = \frac{\pi}{2}
		.\]
	\end{sol}
\end{exmp}
\begin{exmp}
	Find the volume of the solid obtained by rotating the region bounded by $y=x^3$, $y=8$, and $x=0$ about the $y$-axis.
	\begin{center}
		\begin{tikzpicture}
			\begin{axis}[
				axis on top,
				axis lines = middle,
				xlabel = {$x$},
				ylabel = {$y$},
				xmin = -1,
				xmax = 3,
				ymin = -1,
				ymax = 18]

				\addplot [
				name path = A,
				domain = -0.80:2.5,
				samples = 100
				] {x^(3)}
				node [pos=1, above] {$y=x^3$};

				\addplot [
				name path = B,
				domain = 0:2.5
				] {8}
				node [pos=1, below] {$y=8$};

				\addplot [gray!30] fill between [of = A and B, soft clip={domain=0:2}];
				\draw [dashed] (axis cs:{2,0}) -- (axis cs:{2,8});
			\end{axis}
		\end{tikzpicture}
	\end{center}
	\begin{sol}
		For each $y$ where $0\leqslant y\leqslant 8$, we have the volume of a typical disc is:
		\[
			\pi(\root 3 \of{y})^2 \cdot \delta y
		.\]
		Therefore, the volume of the solid is:
		\[
			\int_{0}^{8} \pi(\root 3\of{y})^2 \ud y = \pi\left[\frac{\root 3\of{y^{5}}}{5/3}\right]^{8}_{0} = \frac{96\pi}{5}
		.\]
	\end{sol}
\end{exmp}

\subsection{The Cylindrical Shell Method}%
\label{sub:the_cylindrical_shell_method}

The volume of a cylindrical with radius $r$, height $h$, and thickness $t$ is approximated by $2\pi rht$ as $t\to 0$.
So, to find the volume of a solid enclosed within the $x$-axis rotated around the $y$-axis, we substitute $h$ to be the length of a typical horizontal strip, $r$ to be the distance from the $y$-axis, $x$, and $t$ becomes our infinitesimal:
\[
	V = 2\pi \int_{a}^{b} x f(x) \ud x
.\]
\begin{exmp}
	Find the volume of the solid obtained by rotating about the $y$-axis the region between $y=x$ and $y=x^2$.
	\begin{center}
		\begin{tikzpicture}
			\begin{axis}[
				axis on top,
				axis lines = middle,
				xlabel = {$x$},
				ylabel = {$y$},
				xmin = -0.5,
				xmax = 1.8,
				ymin = 0,
				ymax = 1.8]

				\addplot [
				name path = A,
				domain = -0.40:1.2,
				samples = 100
				] {x^(2)}
				node [pos=1, above] {$y=x^2$};

				\addplot [
				name path = B,
				domain = 0:1.2
				] {x}
				node [pos=1, right] {$y=x$};

				\addplot [gray!30] fill between [of = A and B, soft clip={domain=0:1}];
				\draw [dashed] (axis cs:{1,0}) -- (axis cs:{1,1});
				\draw [dashed] (axis cs:{0,1}) -- (axis cs:{1,1});
			\end{axis}
		\end{tikzpicture}
	\end{center}
	\begin{sol}
		Using the cylindrical shell method, the volume of the solid is:
		\begin{align*}
			\int_{0}^{1} 2\pi x(x-x^2) \ud x & = 2\pi \int_{0}^{1} x^2-x^3 \ud x\\
							 & = 2\pi \left[\frac{x^3}{3}-\frac{x^{4}}{4}\right]^{1}_{0}\\
							 & = \frac{\pi}{6}.
		\end{align*}
		
	\end{sol}
\end{exmp}

\section{The Length of an Arc of a Curve}%
\label{sec:the_length_of_an_arc_of_a_curve}

The length of an arc of a curve can be approximated using the Pythagoras Theorem, where the length of the curve is $\delta s$:
\begin{center}
	\begin{tikzpicture}
		\begin{axis}[
			axis on top,
			axis lines = middle,
			xlabel = {$x$},
			ylabel = {$y$},
			xtick=\empty,
			ytick=\empty,
			xmin = 0,
			xmax = 0.35,
			ymin = 0,
			ymax = 0.8]

			\addplot [
			name path = A,
			domain = 0.01:0.30,
			samples = 100
			] {x^(0.5)};

			\draw [] (axis cs:{0.05,0.2236068}) -- (axis cs:{0.2,0.2236068});
			\draw [] (axis cs:{0.2,0.2236068}) -- (axis cs:{0.2,0.4472136});
			\draw [] (axis cs:{0.05,0.2236068}) -- (axis cs:{0.2,0.4472136});

			\node at (0.22,0.3354) {$\delta y$};
			\node at (0.125,0.18) {$\delta x$};
			\node at (0.14,0.32) {$\delta s$};
			\node at (0.15,0.6) {$\therefore\delta s= \sqrt{(\delta x)^2 + (\delta y)^2}$};
		\end{axis}
	\end{tikzpicture}
\end{center}
Therefore, the length of the arc can be approximated to be the summation of $\delta s$.
This approximation gets more and more accurate as $\delta x$ and $\delta y$ get smaller and smaller, so passing these to the limit we have:
\begin{align*}
	L & = \int_{a}^{b} \ud s\\
	  & = \int_{a}^{b} \sqrt{(\upd x)^2 + (\upd y)^2}\\
	\intertext{Factoring out $\upd x$ we have:}
	  & = \int_{a}^{b} \sqrt{\frac{(\upd x)^2}{(\upd x)^2} + \frac{(\upd y)^2}{(\upd x)^2}} \ud x\\
	  & = \int_{a}^{b} \sqrt{1 + \left(\frac{\upd y}{\upd x}\right)^2} \ud x\\
	  & = \int_{a}^{b} \sqrt{1+(f^{\prime}(x))^2} \ud x.
\end{align*}
Likewise, for the curve defined by $x=g(y)$, where $y\in [c,d]$, the length of the arc of the curve is:
\[
	L = \int_{c}^{d} \sqrt{1+(g^{\prime}(y))^2} \ud y
.\]
Finally, for a parametric curve defined by:
\[
	y = y(t),\quad x=x(t),\quad a\leqslant t\leqslant b
,\]
the length of the arc of the curve is:
\[
	L = \int_{a}^{b} \sqrt{(x^{\prime}(t))^2+(y^{\prime}(t))^2} \ud t
.\]
\begin{exmp}
	Find the length of the arc of the curve $y = 1+6x^{\frac{3}{2}}$ for $0\leqslant x\leqslant 1$.
	\begin{sol}
		The length of the arc of the curve is:
		 \begin{align*}
			 \int_{0}^{1} \sqrt{1 + \left(\frac{\upd y}{\upd x}\right)^2} \ud x & = \int_{0}^{1} \sqrt{1 + \left(9x^{\frac{1}{2}}\right)^2} \ud x\\
											  & = \int_{0}^{1} \sqrt{1 + 81x} \ud x\\
											  & = \left[\frac{(1+81x)^{\frac{3}{2}}}{81\cdot \frac{3}{2}}\right]^{1}_{0}\\
											  & = \frac{2}{243}\left(82^{\frac{3}{2}}-1\right).
		\end{align*}
	\end{sol}
\end{exmp}

\section{Area of Surface of Revolution}%
\label{sec:area_of_surface_of_revolution}

To calculate the surface area of revolution, we must calculate the surface area of all the thin slices and add them up.
The surface area of a thin slice is a frustum of a cone.
This can be calculated by using our approximation of the length of an arc:
\[
	\delta A \approx (2\pi y)\delta s = 2\pi y\sqrt{1 + \left(\frac{\upd y}{\upd x}\right)^2}\cdot\delta x
.\]
Summing up all these small areas, and making $\delta x$ smaller and smaller, we arrive at the following definite integral:
\[
	A = \int_{a}^{b} 2\pi y\sqrt{1 + \left(\frac{\upd y}{\upd x}\right)^2} \ud x
.\]
\begin{exmp}
	Find the surface area generated by revolving the curve $y=\sqrt{x+1}$ on $1\leqslant x\leqslant 5$, about the $x$-axis.
	\begin{sol}
		The surface area is the value of the definite integral:
		\begin{align*}
			A & = \int_{1}^{5} 2\pi y\sqrt{1+ \left(\frac{\upd y}{\upd x}\right)^2} \ud x\\
			  & = \int_{1}^{5} 2\pi\sqrt{x+1}\sqrt{1 + \left(\frac{1}{2\sqrt{x+1}}\right)^2} \ud x\\
			  & = 2\pi \int_{1}^{5} \sqrt{(x+1)\left(1 + \frac{1}{4\left(x+1\right)}\right)} \ud x\\
			  & = \pi \int_{1}^{5} \sqrt{4x+5} \ud x\\
			  & = \left[\frac{2\pi}{3}(4x+5)^{\frac{3}{2}}\right]^{5}_{1}\\
			  & = \frac{2\pi}{3}(125-27)\\
			  & = \frac{196\pi}{3}.
		\end{align*}
		
	\end{sol}
\end{exmp}
