2 Different integrals of $\int \left ( \tan{x}\right ) ^3 dx$.

My friend asked me why this function has 2 different integrals. I'm very confused. \begin{align} \int \left ( \tan{x}\right ) ^3 dx &=\int \left ( \tan{x} \right )^2 \tan{x}dx \\ &=\int \left ( \sec^2 {x} -1 \right ) \tan{x} dx \\ &=\int \tan{x} \left ( \tan{x} \right )' -\int \tan{x}dx \\ &=\frac12 \tan^2{x} +\log{|\cos{x}|}+C \end{align} Also, \begin{align} \int \left ( \tan{x}\right ) ^3 dx &=\int \left ( \tan{x} \right )^2 \tan{x}dx \\ &=\int \left ( \sec^2 {x} -1 \right ) \tan{x} dx \\ &=\int \frac{-1}{t^3}dt-\int \frac{-1}{t}dt \\ &=\frac12 \sec^2{x} +\log{|\cos{x}|}+C \end{align} with $x=\cos {t}$. I don't know why this integral has two answers and how to know that there exist 2 and more answers. Thanks in advance.

-

Note that $\frac{1}{2}\sec^2 x$ and $\frac{1}{2}\tan^2 x$ differ by a constant. Since there is always an arbitrary constant of integration, the two answers are the same answer.
In the same way $x^2+17+C$ and $x^2+C$ are both correct integrals of $2x$.