Integrating $\int\tan^3(x)\,dx$ in two different ways gives two different answers I was trying to find the antiderivative of a function 
$$\int \tan^3(x)\,dx$$
However, due to substitution differences, my book has a answer of 
$$\frac12\tan^2(x)+\ln(\cos x)+C$$ 
while I got an answer 
$$\frac12\sec^2(x)+\ln(\cos x)+C$$
The problem is what to substitute in $\int \tan x \sec^2 x dx$. The book puts $\tan x = z$, while I put $\sec x = z$. I don't know if both are correct. If they are, can all functions have multiple antiderivatives?
 A: They are both correct and the fact that there are two of them is not a problem, since their difference is constant ($1+\tan^2\theta=\sec^2\theta$).
A: Yes, all functions have multiple antiderivatives, that differ by a constant.
Sometimes the constants are "hidden" in seemingly different analytical expressions. E.g. $\arccos x$ and $-\arcsin x$ differ by $\dfrac\pi2$.
A: When evaluating indefinite integrals, there's no such thing as an incorrect substitution, just one that won't help much. Sometimes, more than one helpful option exists. If we try evaluating $\int\tan x\sec^2 xdx$ with $z=\tan x$, we get $\int zdz=\frac12 z^2+C=\frac12\tan^2 x+C$, so you might call this a useful substitution. The substitution $z=\sec x$ proves equally helpful (but your textbook was hardly going to solve the problem twice!), with the integral becoming $\int zdz=\frac12 z^2+K=\frac12\sec^2 x+K$. If you equate the two antiderivatives from these approaches, you of course get $C=\frac12 + K$ from $\sec^2 x=\tan^2 x+1$, so the results don't disagree at all. (Comparing results for $\tan^3 x$ also requires you to use this identity.)
A: The functions $\sec^2{x}$ and $\tan^2{x}$ differ by a constant. This means that when you have $\sec^2{x}$ plus a constant, it can always be turned into an expression containing $\tan^2{x}$ plus another constant and vice versa. For example:
$$\sec^2{x}+5=\left(\tan^2{x}+1\right)+5=\tan^2{x}+6.$$
More generally:
$$\sec^2{x}+C_1=\left(\tan^2{x}+1\right)+C_1=\tan^2{x}+C_2.$$
In your case:
$$
\frac12\tan^2{x}+\ln{\cos x}+C=\\
\frac12\left(\sec^2{x}+1\right)+\ln{\cos x}+C=\\
\frac12\sec^2{x}+\frac12+\ln{\cos x}+C=\\
\frac12\sec^2{x}+\ln{\cos x}+\left(\frac12+C\right)=\\
\frac12\sec^2{x}+\ln{\cos x}+C_1.
$$
Since $C_1$ is just another constant, they still use $C$ to denote that.
