finding integral of $ \int \frac{1}{\sin x + \sqrt{3} \cos x}\ dx $ In $ \int\frac{1}{\sin x + \sqrt{3} \cos x}\ dx $, If I multiply and divide by $1/2$ I get $$ \int\frac{1/2}{\frac{1}{2} \sin x + \frac{\sqrt{3}}{2} \cos x}\ dx ,$$
then I can write $ 1/2=\sin (\frac{\pi}{6}) $ and $ \sqrt{3}/2=\cos (\frac{\pi}{6}) $ and apply $\cos(a-b)=\cos a \cos b + \sin a \sin b$,
I'll get $ \int\frac{1}{\cos(\frac{\pi}{6} - x)}\ dx $, I get $ \int \sec(\frac{\pi}{6} - x)\ dx $, now we know $ \int \sec(x)\ dx = \log|\tan(\frac{\pi}{4}+\frac{x}{2})| + c $ ,
so I finally get $$ \int\frac{1}{\sin x + \sqrt{3} \cos x}\ dx = \frac{1}{2}\log|\tan(\frac{\pi}{4}+\frac{\pi}{6}-\frac{x}{2})| + c $$
However if at this step $ \int\frac{1/2}{\frac{1}{2} \sin x + \frac{\sqrt{3}}{2} \cos x}\ dx $
I take $ 1/2=\cos (\frac{\pi}{3}) $ and $ \sqrt{3}/2=\sin (\frac{\pi}{3})$, then what I get is $ \int\frac{1}{\sin(\frac{\pi}{3} + x)}\ dx $, which is equal to $ \int \csc(\frac{\pi}{3} + x)\ dx $, now we know $ \int \csc(x)\ dx = \log|\tan(\frac{x}{2})| + c $
so I finally get $$ \int\frac{1}{\sin x + \sqrt{3} \cos x}\ dx = \frac{1}{2}\log|\tan(\frac{\pi}{6}+\frac{x}{2})| + c $$
why answer is different, I have rechecked and could not find any mistake
 A: You should not get different answers (up to a constant of integration.) In fact, this is simply a matter of a calculation error.
$$\int \sec x\, \mathrm dx = \log\left|\tan\left(\frac\pi 4 + \frac x2 \right) \right| + C$$
gives
$$\frac12 \int \sec \left(x - \frac\pi 6 \right)\mathrm dx = \frac12 \log\left|\tan\left(\frac\pi 6 + \frac x2 \right) \right| + C$$
as $\frac\pi 4 + \frac x 2 - \frac {\pi}{12} = \frac x 2 + \frac \pi 6$. On the other hand,
$$\int \operatorname{cosec} x\, \mathrm dx = \log\left|\tan\left(\frac x2 \right) \right| + C$$
gives
$$\frac12 \int \operatorname{cosec}\left(x + \frac\pi 3 \right) \, \mathrm dx = \frac12 \log\left|\tan\left(\frac\pi 6 + \frac x2 \right) \right| + C$$
as $\frac12 \left( x + \frac\pi 3\right) = \frac x2 + \frac \pi 6$.
A: Both of your methods have a mistake in them. In your first method, you should have
$$\frac{\sin\left(\frac{\pi}{6}\right)}{\sin\left(\frac{\pi}{6}\right)\sin\left(x\right)+\cos\left(\frac{\pi}{6}\right)\cos\left(x\right)} = \frac{\sin\left(\frac{\pi}{6}\right)}{\cos\left(\frac{\pi}{6}-x\right)}.$$
Similarly, your second method should have
$$\frac{\cos\left(\frac{\pi}{3}\right)}{\cos\left(\frac{\pi}{3}\right)\sin\left(x\right)+\sin\left(\frac{\pi}{3}\right)\cos\left(x\right)} = \frac{\cos\left(\frac{\pi}{3}\right)}{\sin\left(\frac{\pi}{3}+x\right)}.$$
I'm guessing you forgot about the numerator, right? I think you can figure out the rest from there. Integrating both of them should result in the same answer, probably differing by a constant (I didn't try it out).
