\documentclass[a4paper]{article}
\begin{document}
\begin{eqnarray*}
f (x)
 & = & \frac{\cos^{2} (ax)}{(1 + \cos (ax))^{3}} \\
\end{eqnarray*}
\newpage
\begin{eqnarray*}
F (x)
 & = & \int \frac{\cos^{2} (ax)}{(1 + \cos (ax))^{3}} \, \mbox{d}x \\
& = & \int \frac{1 - \sin^{2} (ax)}{(1 + \cos (ax)) (1 + \cos (ax))}
 \frac{(1 - \cos (ax)) (1 - \cos (ax)) (1 - \cos (ax))}{(1 - \cos (ax)) (1 - \cos (ax)) (1 - \cos (ax))} \, \mbox{d}x \\
& = & \int \frac{(1 - \sin^{2} (ax)) (1 - 3 \cos (ax) + 3 \cos^{2} (ax) - \cos^{3} (ax))}
{(1 - \cos^{2} (ax)) (1 - \cos^{2} (ax)) (1 - \cos^{2} (ax))} \, \mbox{d}x \\
& = & \int (1 - 3 \cos (ax) + 3 \cos^{2} (ax) - \cos^{3} (ax) - \sin^{2} (ax) + 3 \cos (ax) \sin^{2} (ax) - 3 \cos^{2} (ax) \sin^{2} (ax) \\
 & & \qquad \qquad + \, \cos^{3} (ax) \sin^{2} (ax)) (\sin^{2} (ax) \sin^{2} (ax) \sin^{2} (ax))^{-1} \, \mbox{d}x \\
& = & \int (1 - 3 \cos (ax) + 3 (1 - \sin^{2} (ax)) - \cos (ax) (1 - \sin^{2} (ax)) - \sin^{2} (ax) + 3 \cos (ax) \sin^{2} (ax) \\
 & & \qquad \qquad - \, 3 (1 - \sin^{2} (ax)) \sin^{2} (ax) + \cos (ax) (1 - \sin^{2} (ax)) \sin^{2} (ax)) (\sin^{6} (ax))^{-1} \, \mbox{d}x \\
& = & \int (1 - 3 \cos (ax) + 3 - 3 \sin^{2} (ax) - \cos (ax) + \cos (ax) \sin^{2} (ax) - \sin^{2} (ax) + 3 \cos (ax) \sin^{2} (ax) \\
 & & \qquad \qquad - \, 3 \sin^{2} (ax) + 3 \sin^{4} (ax) + \cos (ax) \sin^{2} (ax) - \cos (ax) \sin^{4} (ax)) (\sin^{6} (ax))^{-1} \, \mbox{d}x \\
& = & \int \frac{4 - 4 \cos (ax) - 7 \sin^{2} (ax) + 5 \cos (ax) \sin^{2} (ax) + 3 \sin^{4} (ax) - \cos (ax) \sin^{4} (ax)}{\sin^{6} (ax)} \, \mbox{d}x \\
& = & \int \left ( \frac{4}{\sin^{6} (ax)} - \frac{4 \cos (ax)}{\sin^{6} (ax)} - \frac{7 \sin^{2} (ax)}{\sin^{6} (ax)}
 + \frac{5 \cos (ax) \sin^{2} (ax)}{\sin^{6} (ax)} + \frac{3 \sin^{4} (ax)}{\sin^{6} (ax)} - \frac{\cos (ax) \sin^{4} (ax)}{\sin^{6} (ax)}
 \right ) \, \mbox{d}x \\
& = & \int \left ( \frac{4}{\sin^{6} (ax)} - \frac{4 \cos (ax)}{\sin^{6} (ax)} - \frac{7}{\sin^{4} (ax)}
 + \frac{5 \cos (ax)}{\sin^{4} (ax)} + \frac{3}{\sin^{2} (ax)} - \frac{\cos (ax)}{\sin^{2} (ax)}
 \right ) \, \mbox{d}x \\
\end{eqnarray*}
\newpage
\begin{eqnarray*}
F (x)
 & = & \int \left ( \frac{4}{\sin^{6} (ax)} - \frac{4 \cos (ax)}{\sin^{6} (ax)} - \frac{7}{\sin^{4} (ax)}
 + \frac{5 \cos (ax)}{\sin^{4} (ax)} + \frac{3}{\sin^{2} (ax)} - \frac{\cos (ax)}{\sin^{2} (ax)}
 \right ) \, \mbox{d}x \\
& = & - \frac{4}{a} \cot (ax) - \frac{8}{3a} \cot^{3} (ax) - \frac{4}{5a} \cot^{5} (ax)
 + \frac{4}{5a} \frac{1}{\sin^{5} (ax)}
 + \frac{7}{a} \cot (ax) + \frac{7}{3a} \cot^{3} (ax)
 - \frac{5}{3a} \frac{1}{\sin^{3} (ax)} \\
 & & \qquad \qquad - \, \frac{3}{a} \cot (ax)
 + \frac{1}{a} \frac{1}{\sin (ax)} + c \\
& = & - \frac{4}{5a} \cot^{5} (ax)
 + \frac{4}{5a} \frac{1}{\sin^{5} (ax)}
 - \frac{1}{3a} \cot^{3} (ax)
 - \frac{5}{3a} \frac{1}{\sin^{3} (ax)}
 + \frac{1}{a} \frac{1}{\sin (ax)} + c \\
& = & - \frac{4}{5a} \cot^{5} (ax)
 + \frac{4}{5a} \csc^{5} (ax)
 - \frac{1}{3a} \cot^{3} (ax)
 - \frac{5}{3a} \csc^{3} (ax)
 + \frac{1}{a} \csc (ax) + c \\
\end{eqnarray*}
\newpage
\begin{eqnarray*}
f (x)
 & = & \frac{\mbox{d}(F (x))}{\mbox{d}x} \\
& = & \frac{\mbox{d}}{\mbox{d}x}
 \left ( - \frac{4}{5a} \cot^{5} (ax)
 + \frac{4}{5a} \csc^{5} (ax)
 - \frac{1}{3a} \cot^{3} (ax)
 - \frac{5}{3a} \csc^{3} (ax)
 + \frac{1}{a} \csc (ax) + c \right ) \\
& = & - \frac{4}{5a} \cdot 5 \cot^{4} (ax) \frac{- a}{\sin^{2} (ax)}
 + \frac{4}{5a} \cdot 5 \csc^{4} (ax) \frac{- a \cos (ax)}{\sin^{2} (ax)}
 - \frac{1}{3a} \cdot 3 \cot^{2} (ax) \frac{- a}{\sin^{2} (ax)} \\
 & & \qquad \qquad - \, \frac{5}{3a} \cdot 3 \csc^{2} (ax) \frac{- a \cos (ax)}{\sin^{2} (ax)}
 + \frac{1}{a} \frac{- a \cos (ax)}{\sin^{2} (ax)} + 0 \\
& = & 4 \cot^{4} (ax) \frac{1}{\sin^{2} (ax)}
 - 4 \csc^{4} (ax) \frac{\cos (ax)}{\sin^{2} (ax)}
 + \cot^{2} (ax) \frac{1}{\sin^{2} (ax)} \\
 & & \qquad \qquad + \, 5 \csc^{2} (ax) \frac{\cos (ax)}{\sin^{2} (ax)}
 - \frac{\cos (ax)}{\sin^{2} (ax)} \\
& = & \frac{4 \cos^{4} (ax)}{\sin^{4} (ax)} \frac{1}{\sin^{2} (ax)}
 - \frac{4}{\sin^{4} (ax)} \frac{\cos (ax)}{\sin^{2} (ax)}
 + \frac{\cos^{2} (ax)}{\sin^{2} (ax)} \frac{1}{\sin^{2} (ax)} \frac{\sin^{2} (ax)}{\sin^{2} (ax)} \\
 & & \qquad \qquad + \, \frac{5}{\sin^{2} (ax)} \frac{\cos (ax)}{\sin^{2} (ax)} \frac{\sin^{2} (ax)}{\sin^{2} (ax)}
 - \frac{\cos (ax)}{\sin^{2} (ax)} \frac{\sin^{4} (ax)}{\sin^{4} (ax)} \\
& = & \frac{4 \cos^{4} (ax)}{\sin^{6} (ax)}
 - \frac{4 \cos (ax)}{\sin^{6} (ax)}
 + \frac{\cos^{2} (ax) \sin^{2} (ax)}{\sin^{6} (ax)}
 + \frac{5 \cos (ax) \sin^{2} (ax)}{\sin^{6} (ax)}
 - \frac{\cos (ax) \sin^{4} (ax)}{\sin^{6} (ax)} \\
& = & (4 \cos^{4} (ax) - 4 \cos (ax) + \cos^{2} (ax) (1 - \cos^{2} (ax)) + 5 \cos (ax) (1 - \cos^{2} (ax)) \\
 & & \qquad \qquad - \, \cos (ax) \sin^{2} (ax) \sin^{2} (ax)) (\sin^{2} (ax) \sin^{2} (ax) \sin^{2} (ax))^{-1} \\
& = & (4 \cos^{4} (ax) - 4 \cos (ax) + \cos^{2} (ax) - \cos^{4} (ax) + 5 \cos (ax) - 5 \cos^{3} (ax) \\
 & & \qquad \qquad - \, \cos (ax) (1 - \cos^{2} (ax)) (1 - \cos^{2} (ax))) ((1 - \cos^{2} (ax)) (1 - \cos^{2} (ax)) (1 - \cos^{2} (ax)))^{-1} \\
& = & \frac{3 \cos^{4} (ax) + \cos (ax) + \cos^{2} (ax) - 5 \cos^{3} (ax) - \cos (ax) (1 - 2 \cos^{2} (ax) + \cos^{4} (ax))}
{(1 + \cos (ax)) (1 - \cos (ax)) (1 + \cos (ax)) (1 - \cos (ax)) (1 + \cos (ax)) (1 - \cos (ax))} \\
& = & \frac{3 \cos^{4} (ax) + \cos (ax) + \cos^{2} (ax) - 5 \cos^{3} (ax) - \cos (ax) + 2 \cos^{3} (ax) - \cos^{5} (ax)}
{(1 + \cos (ax))^{3} (1 - \cos (ax))^{3}} \\
& = & \frac{3 \cos^{4} (ax) + \cos^{2} (ax) - 3 \cos^{3} (ax) - \cos^{5} (ax)}{(1 + \cos (ax))^{3} (1 - \cos (ax))^{3}} \\
& = & \frac{\cos^{2} (ax) (3 \cos^{2} (ax) + 1 - 3 \cos (ax) - \cos^{3} (ax))}{(1 + \cos (ax))^{3} (1 - \cos (ax))^{3}} \\
& = & \frac{\cos^{2} (ax) (1 - \cos (ax))^{3}}{(1 + \cos (ax))^{3} (1 - \cos (ax))^{3}} \\
& = & \frac{\cos^{2} (ax)}{(1 + \cos (ax))^{3}} \\
\end{eqnarray*}
\newpage
\begin{eqnarray*}
F (x)
 & = & - \frac{4}{5a} \cot^{5} (ax) + \frac{4}{5a} \csc^{5} (ax) - \frac{1}{3a} \cot^{3} (ax) \\
 & & \qquad - \, \frac{5}{3a} \csc^{3} (ax) + \frac{1}{a} \csc (ax) + c \\
\end{eqnarray*}
\end{document}
