Checking solution for $\int \tan^3(x)\,dx$ $$\int\tan^3(x)\,dx$$
My solution:
$$
\int \tan(x)(\sec^2(x)-1)\,dx \\
\int \tan(x)(\sec(x) \cdot \sec(x) - 1)\,dx \\
\int \sec(x) \cdot \tan(x)\sec(x)\,dx - \int \tan(x) \,dx \\
\int u ~du - \ln(\sec(x)) \\
\frac{\sec^2(x)}{2} - \ln(\sec(x))
$$
My teacher is saying that the correct answer is:
$$\frac{\tan^2(x)}{2} -\ln(\sec(x))$$
But even if i use the identity $\sec^2(x) = \tan^2(x) +1$, this will give me an additional term of $\frac{1}{2}$. Why is this happening?
 A: Updated answer:
\begin{align}
& \left(\frac{\tan^2 x} 2 + \text{constant}\right) \\[8pt]
& \text{is the same thing as} \\[8pt]
& \left(\frac{\sec^2 x} 2 + \text{a different constant}\right).
\end{align}
Original answer:
One possibility is that the instructor expected $\ln\left|\sec x\right|$ rather than $\ln\sec x.$
$$
\int\frac{du} u = \ln\left|u\right|+\text{“constant”}
$$
where “constant” means piecewise constant, i.e. one constant when $u>0$ and possibly another when $u<0.$
Or maybe the instructor failed to notice that $-\ln\sec x$ is the same as $\ln\cos x$ (although a competent mathematician typically would realize that).
Another possibility is that the instructor had in mind some answer that is equal to what you had, or differs from it by a constant, but that one would need a bit of work with trigonometric identities to show that. An instructor who needs to grade 35 papers might be rushed and fail to notice something like that, although the fact that that can happen should be known to the instructor.
(As long as we're talking about the piecewise nature of the constant, notice that with a periodic function with vertical asymptotes, the "constant" could change at each point in the domain where one of those occurs.)
