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

\chapter{Trigonometric Functions}%
\label{cha:trigonometric_functions}

\section{Intergrating $\sin^{m}x\cos^{n}x$}%
\label{sec:intergrating_sin_m_xcos_n_x_}

To integrate integrands of the following form:
\[
\int \sin^{m}x\cos^{n}x\ud x
,\]
the following tools are required:
\[
% \boxed
% {
\begin{aligned}
	\int \cos x \ud x & = \sin x + C\\
	\int \sin x \ud x & = -\cos x + C
\end{aligned}
% }
\qquad
% \boxed
% {
\cos^2 x + \sin^2x = 1
% }
\qquad
% \boxed
% {
\begin{aligned}
	\cos^2x & = \frac{1+\cos 2x}{2}\\
	\sin^2x & = \frac{1-\cos 2x}{2}
\end{aligned}
% }
\]
In the case that there is an odd power of $\cos x$, our aim is to substitute $u=\sin x$, with $u^{\prime}=\cos x$.
We take out one $\cos x$ term, and replace the remaining even power of $\cos x$ using:
\[
\cos^2x=1-\sin^2x
.\]
And then use our substitution $u=\sin x$.
We do the converse when we have and odd power of $\sin x$.
\begin{exmp}
	Evaluate the following integral:
	\[
	\int \sin^3x\cos^{8}x\ud x
	.\]
	\begin{sol}
		\begin{align*}
			\int \sin^3x\cos^{8}x\ud x & = \int \sin x(\sin^2x)\cos^{8}x\ud x\\
						   & = \int \sin x(1-\cos^2x)\cos^{8}x\ud x\\
			\intertext{Substituting $u=\cos x$, $u^{\prime}=-\sin x$:}
						   & = \int -(1-u^2)(u^{8})\ud u\\
						   & = \int -u^{8}+u^{10}\ud u\\
						   & = -\frac{u^{9}}{9}+\frac{u^{11}}{11}+C\\
						   & = -\frac{\cos^{9}x}{9}+\frac{\cos^{11}x}{11}+C.
		\end{align*}
	\end{sol}
\end{exmp}
In the case where both powers of $\sin x$ and $\cos x$ are even, we use the double angle formulae to express the integrand as a function of $\cos 2x$.
\begin{exmp}
	Evaluate the following integral:
	\[
	\int \sin^{4}x\cos^2x\ud x
	.\]
	\begin{sol}
		\begin{align*}
			\int \sin^{4}\cos^2x\ud x & = \int (\sin^2x)^2\cos^2x\ud x\\
						  & = \int \left(\frac{1-\cos 2x}{2}\right)^2\left(\frac{1+\cos 2x}{2}\right)\ud x\\
						  & = \frac{1}{8}\int \left(1-2\cos 2x + \cos^2 2x\right)(1+\cos 2x)\ud x\\
						  & = \frac{1}{8}\int 1 - \cos 2x - \underbrace{\cos^22x}_{\textrm{even power}} + \underbrace{\cos^32x}_{\textrm{odd power}}\ud x\\
						  & = \frac{1}{8}\int 1-\cos 2x-\frac{1+\cos 4x}{2}+\cos 2x\left(1-\sin^2 2x\right)\ud x\\
						  & = \frac{1}{8}\int \frac{1}{2}-\frac{\cos 4x}{2}-\cos2x\sin^2 2x \ud x\\
						  & = \frac{x}{16} - \frac{\sin 4x}{64} - \frac{\sin^3 2x}{48} + C.
		\end{align*}
	\end{sol}
\end{exmp}
\section{Intergrating $\sec^{m}x\tan^{n}x$}%
\label{sec:intergrating_sec_m_xtan_n_x_}

To intgrate integrands of the following form:
\[
\int \sec^{m}x\tan^{n}x\ud x
,\]
we must first obtain some simple derivatives.
First, we must find the integral of $\tan x$:
\[
\int \tan x\ud x = \int \frac{\sin x}{\cos x}\ud x
.\]
We let $u=\cos x$, therefore $u^{\prime}=-\sin x$.
Then:
\begin{align*}
	\int \frac{\sin x}{\cos x}\ud x & = -\int \frac{1}{u}\ud u\\
					& = -\ln |u|+C\\
					& = -\ln|\cos x| + C\\
					& = \ln|\sec x| + C.
\end{align*}
Second, we must find the integral of $\sec x$:
\begin{align*}
	\int \sec x \ud x & = \int \sec x \left(\frac{\sec x + \tan x}{\sec x +\tan x}\right)\ud x\\
			  & = \int \frac{\sec^2 x + \sec x\tan x}{\tan x+\sec x}\ud x\\
			  & = \ln|\tan x+\sec x| +C.
\end{align*}
\begin{mdframed}
	\begin{note}
		We used the following facts to achieve the result above:
		\[
			\frac{\ud}{\ud x}[\tan x +\sec x] = \sec^2x+\sec x \tan x
			,
			\quad
			\int \frac{f^{\prime}(x)}{f(x)}\ud x = \ln|f(x)| +C
		.\]
	\end{note}
\end{mdframed}

\noindent
The rest of the following tools are required for this section:
\[
\begin{aligned}
	\int \sec^2x\ud x&=\tan x+C\\
	\int \sec x\tan x\ud x&=\sec x+C
\end{aligned}
\qquad
1 + \tan^2x=\sec^2x
.\]
In the case where there are odd powers of $\sec x$ \textbf{and} $\tan x$, our aim is to substitute $u=\sec x$, with $u^{\prime}=\sec x\tan x$.
First, we keep one copy of $\sec x\tan x$ separate.
Then we change the remaining $\tan^{n}x$ term to its various $\sec x$ terms using:
\[
\tan^2x=\sec^2x-1
,\]
so that the expression involves $\sec x$ only.
Finally, we use our substitution $u=\sec x$.
\begin{exmp}
	Evaluate the following integral:
	\[
	\int \sec x\tan^3x\ud x
	.\]
	\begin{sol}
		\begin{align*}
			\int \sec x\tan^3x\ud x & = \int (\sec x\tan x)\tan^2x\ud x\\
						& = \int (\sec x\tan x)(\sec^2x-1)\ud x\\
			\intertext{We use the substitution $u=\sec x$:}
						& = \int u^2-1\ud u\\
						& = \frac{u^3}{3}-u+C\\
						& = \frac{\sec^3x}{3}-\sec x+C.
		\end{align*}
	\end{sol}
\end{exmp}
In the case where there is a even power of $\sec x$, our aim is to substitute $u=\tan x$, with $u^{\prime}=\sec^2x$.
First we keep one $\sec^2x$ term separate.
Then, we change the remaining even power $\sec x$ term into powers of $\tan x$ using:
\[
\sec^2x=1+\tan^2x
.\]
Finally, we use our substitution $u=\tan x$.
\begin{exmp}
	Evaluate the following integral:
	\[
	\int\sec^{4}x\tan^3x\ud x
	.\]
	\begin{sol}
		\begin{align*}
			\int\sec^{4}x\tan^3x\ud x & = \int(\sec^2x)\sec^2x\tan^3x\ud x\\
						  & = \int(\sec^2x)(1+\tan^2x)\tan^3x\ud x\\
			\intertext{We use the substitution $u=\tan x$:}
						  & = \int (1+u^2)u^3\ud u\\
						  & = \int u^3 + u^{5}\ud u\\
						  & = \frac{u^{4}}{4}+\frac{u^{6}}{6}+C\\
						  & = \frac{\tan^{4}x}{4}+\frac{\tan^{6}x}{6}+C.
		\end{align*}
	\end{sol}
\end{exmp}
