<s>[INST] 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
 [/INST] 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).
</s>