Calculation of $ \int\frac{dx}{a\sin x+b\cos x} $

107 Views Asked by At

Assume $ a,b $ are some constant real numbers. ( I have no further information about those constants, but Im gonna assume everything that's needed in order to calculate an antideriviative).

I have to calculate $ \int\frac{dx}{a\sin x+b\cos x} $

Now, we had a hint in the question that says :

"find suitable $ \alpha, \beta $ such that $ a\sin x+b\cos x=\alpha\sin\left(x+\beta\right) $.

I didnt use the hint and solve in this way:

I used trigonometric substitution, thus:

$ \tan\left(\frac{x}{2}\right)=t,\sin x=\frac{2t}{1+t^{2}},\cos x=\frac{1-t^{2}}{1+t^{2}},dx=\frac{2}{1+t^{2}} $

therefore:

$ \int\frac{dx}{a\sin x+b\cos x}=\int\frac{2}{-bt^{2}+2at+b}dt=\int\frac{2}{-b\left(t^{2}-\frac{2at}{b}-1\right)}=\frac{2}{-b}\int\frac{1}{t^{2}-\frac{2at}{b}-1}=\frac{2}{-b}\int\frac{1}{(t-\frac{a}{b})^{2}-\left(\frac{a^{2}+b^{2}}{b^{2}}\right)}dt $

Now substitue once again $ t-\frac{a}{b} $

thus $ dt=du $ and:

$ \frac{2}{-b}\int\frac{1}{(t-\frac{a}{b})^{2}-\left(\frac{a^{2}+b^{2}}{b^{2}}\right)}dt=\frac{2}{-b}\int\frac{1}{u^{2}-\left(\frac{a^{2}+b^{2}}{b^{2}}\right)}du=\frac{2}{-b}\int\frac{1}{\left(u-\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\right)\left(u+\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\right)}=\frac{2}{-b}\int\left(\frac{1}{2\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\left(u-\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\right)}-\frac{1}{2\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\left(u+\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\right)}\right)du $

and finally, calculating the integrals and returning to $ x $ :

$ \frac{2}{-b}\int\left(\frac{1}{2\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\left(u-\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\right)}-\frac{1}{2\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\left(u+\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}\right)}\right)du=\frac{-1}{b\sqrt{\frac{a^{2}+b^{2}}{b^{2}}}}\ln|\frac{\tan\left(\frac{x}{2}\right)-\frac{a}{b}+\sqrt{\frac{a^{2}}{b^{2}}+1}}{\tan\left(\frac{x}{2}\right)-\frac{a}{b}-\sqrt{\frac{a^{2}}{b^{2}}+1}}|+C $

Now I'm not sure if my final result is correct, because when I used integral calculator online it shows different answer (maybe equvivalent though)

Thats the result that the online calculator shows (I used b and c instead of a and b because the calculator takes $ a \sin $ as $ \arcsin $ :

$ -\dfrac{\ln\left(\frac{\left|\frac{c\sin\left(x\right)}{\cos\left(x\right)+1}+\frac{-2\sqrt{c^2+b^2}-2b}{2}\right|}{\left|\frac{c\sin\left(x\right)}{\cos\left(x\right)+1}+\frac{2\sqrt{c^2+b^2}-2b}{2}\right|}\right)}{\sqrt{c^2+b^2}} $

So, I'll be glad if someone could tell if my final result is correct, and if someone can present simpler way to solve this integral.

Thanks in advance.

2

There are 2 best solutions below

1
On

Per the hint

$$a\sin x+b\cos x=\sqrt{a^2+b^2}\sin\left(x+\tan^{-1}\frac b a\right) $$

and $(\ln \tan\frac t2)’= \frac1{\sin t}$

\begin{align} \int \frac1{a\sin x+b\cos x}dx= &\frac1{\sqrt{a^2+b^2}}\int \frac1{\sin\left(x+\tan^{-1}\frac b a\right)}dx\\ =& \frac1{\sqrt{a^2+b^2}}\ln\left( \tan\frac{x+\tan^{-1}\frac b a}2 \right)+C\\ \end{align}

0
On

Using the tangent half-angle substitution, without using the hint, the most general form of the result is $$\int \frac{dx}{a \sin (x)+b \cos (x)}=\frac{2}{\sqrt{a^2+b^2}}\tanh ^{-1}\left(\frac{b \tan \left(\frac{x}{2}\right)-a}{\sqrt{a^2+b^2}}\right)$$