Proof. We know that \tan(x) = \frac{\sin(x)}{\cos(x)}. So we get:
\begin{align*} \int \tan(x) dx = \int \frac{\sin(x)}{\cos(x)} dx. \end{align*}
\begin{align*} \frac{d}{dx} u = -\sin(x) \iff du = -\sin(x)dx. \end{align*}
\begin{align*} \int \tan(x) dx &= \int \frac{\sin(x)}{\cos(x)} dx \\ &= \int \frac{-1}{u} du \\ &= - \ln \lvert u \rvert + C \\ &= - \ln \lvert \cos(x) \rvert + C \quad \text{since } u = \cos(x) \\ &= \ln \lvert \frac{1}{\cos(x)} \rvert + C \\ &= \ln \lvert \sec(x) \rvert + C. \end{align*}