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