So far we have integrated rather simple trigonometric functions such that $f(x) = \sin x$ where $\int f(x) \: dx = -\cos x$. We will now look at techniques for integrating more challenging trigonometric functions and prove the following theorem:

 Theorem 1: The following functions have the following indefinite integrals: a) If $f(x) = \cos ^2 x \: dx$, then $\int \cos ^2 x \: dx = \frac{\cos x \sin x + x}{2} + C$. b) If $f(x) = \sin ^2 x \: dx$, then $\int \sin ^2 x \: dx = \frac{x - \sin x \cos x }{2} + C$. c) If $f(x) = \tan ^2 x$, then $\int \tan ^2 x \: dx = \tan x - x + C$.
• Proof of a) To integrate this function, let's first split the cosines apart so that $f(x) = \cos x \cdot \cos x$. Now let's integrate this function by parts. Let $u = \cos x$ and let $dv = \cos x \: dx$. It thus follows that $du = -\sin x \: dx$ and $v = \sin x$. Now inputting this information into the integration by parts equality $\int u \: dv = uv - \int v \: du$ we obtain:
(1)
\begin{align} \int \cos ^2 x \: dx = \cos x \sin x - \int -\sin ^2 x \: dx \\ \int \cos ^2 x \: dx = \cos x \sin x + \int (1 - \cos ^2 x \: dx \\ \int \cos ^2 x \: dx = \cos x \sin x + \int 1 \: dx - \int \cos ^2 x \: dx \\ 2 \int \cos ^2 \: dx x = \cos x \sin x + x \\ \int \cos ^2 x \: dx = \frac{\cos x \sin x + x}{2} + C \\ \end{align}
• Proof of b) Once again we're going to integrate this function by first separating it apart and then applying the technique of integration by parts for $f(x) = \sin x \sin x$. Let $u = \sin x$ and let $dv = \sin x \: dx$. It follows that $du = \cos x \: dx$ and $v = -\cos x$. Then with integration by parts we obtain:
(2)
\begin{align} \int \sin ^2 x = - \sin x \cos x - \int -\cos^2 x \: dx \\ \int \sin ^2 x = - \sin x \cos x + \int (1 - \sin ^2 x) \: dx \\ \int \sin ^2 x = - \sin x \cos x + \int 1 \: dx - \int \sin ^2 x \: dx \\ 2 \int \sin ^2 x = - \sin x \cos x + x \\ \int \sin ^2 x = \frac{x - \sin x \cos x}{2} + C \end{align}
• Proof of c) Recall the identity $\tan ^2 x = \sec ^2 x - 1$. Hence:
(3)
\begin{align} \int \tan ^2 x \: dx = \int (\sec ^2 x - 1) \: dx \\ \int \tan ^2 x \: dx = \int \sec ^2 x \: dx - \int 1 \: dx \\ \int \tan ^2 x \: dx = \tan x - x + C \quad \blacksquare \end{align}