Evaluate indefinite integral $\int \tan(\frac{x}{3}) \, dx$ I need help verifying why I am getting an incorrect answer for the question evaluate the integral 
$$\int \tan\left(\frac{x}{3}\right) \, dx$$
I simplify the above equation using trig identities to get
$$\int \frac {\sin \left(\frac{x}{3}\right)}{\cos\left(\frac{x}{3}\right)} \, dx$$
I use the substitution method to find 
$$ du = -\frac{1}{3} \sin(x/3) \, dx$$ and so $dx = \frac{-3\,du}{\sin\frac{x}{3}}$
I plug the $u$ back into equation
$$ \int \frac {\sin\left(\frac{x}{3}\right)}{u} \cdot\frac {-3\,du}{\sin \left(\frac{x}{3}\right)}$$
I cross out the $\sin \left(\frac{x}{3}\right)$ and (this is where I may be going wrong), I pull out the $-3$ to be in front of the integral sign since it is a constant and solve for
$$-3 \int \frac{1}{u} \, du$$ and get the final answer $$ -3 \biggl|\,\ln \, \cos \frac{x}{3}\biggr| + C $$
But the answer in the back of the book is $ -\frac{1}{3} |\ln \, \cos \frac{x}{3}| + C $
 A: Your book is wrong! As a check, $$\frac{d}{dx}\left(-\frac13\bigg|\ln\cos\frac x3\bigg|\right)=-\frac1{3\cos\frac x3}\cdot\left(-\frac13\sin\frac x3\right)=\color{red}{\frac19}\tan\frac x3\neq \tan\frac x3.$$
A: 
(...) and get the final answer $$ -3 |\ln \, \cos \frac{x}{3}| + C $$
But the answer in the back of the book is $ -\frac{1}{3} |\ln \, \cos \frac{x}{3}| + C $

You can differentiate to verify but you are right and the book is wrong!
A: At a glance, you're correct, because you'll divide by the $\frac 13$when you take it out of the trig function, not multiply by it.
However, this formula sheet states that $$\int{\tan(x)dx}=\ln|\sec(x)|+C$$
(see the $C4$ section - page $9$)
A: Just to make your life a bit simpler without this fraction $\frac{x}{3}$, just use u-sub.
Put:    $\frac{x}{3}=u$
Then    $\int tan(\frac{x}{3})dx= 3\int tan\ u\ du= 3 $ln |sec u| +C$=$3 ln|sec($\frac{x}{3})|+C$
A: Your book is wrong as this is a standard integral and the value is:


-3 ln|cos(x/3)| + C.


If you want verification, differentiate this and u will get


tan(x/3)

