Why does integral $\int \frac 1{(x+\cos a)^2+(\sin a)^2} dx $ have two solutions

calculusindefinite-integralsintegrationtrigonometric-integrals

For the integral $$\int \frac 1{(x+\cos a)^2+(\sin a)^2} dx $$

My evaluation

$$ \csc a\arctan\left(\frac {x+\cos a}{\sin a}\right) $$

Wolfram Alpha's evaluation here

$$ \csc a\arctan\left(\frac {(x-1)\tan\frac a2}{x+1}\right) $$

When I was doing a STEP question I found this integral and evaluated it. I checked it with Wolfram Alpha and it gave me a different solution, so I checked on another integration calculator that gave my answer. In fact, Wolfram Alpha was the only website to give their evaluation of the integral.

This intrigued me so i graphed both Mine and Wolfram Alpha's equation on Desmos; the graphs were different but both valid solutions to the same integral.

If anyone knows why this happened or how to get Wolfram Alpha's solution please let me know. Also if there are any other examples of integrals you have come across that have multiple unique solutions please share.

Best Answer

The two answers differs by a constant, as shown below. Let $u= \frac {x-1}{x+1}\tan\frac a2 $, $v=\frac {\sin a}{x+\cos a}$ and evaluate

$$\frac{ u + v}{1-uv}= \tan\frac a2 \cdot \frac{(x+\cos a)(x-1) + 2\cos^2 \frac a2 (x+1)}{(x+\cos a)(x+1)-2\sin^2 \frac a2 (x-1)}=\tan\frac a2$$

Then, utilize the identity $\arctan \frac{ u + v}{1-uv} =\arctan u + \arctan v $ to get

$$\arctan\left(\frac {(x-1)\tan\frac a2}{x+1}\right)+\arctan\left(\frac {\sin a}{x+\cos a}\right)=\arctan\left(\tan\frac a2\right) = \frac a2$$

Also, note that

$$\arctan\left(\frac {\sin a}{x+\cos a}\right) = \frac\pi2 - \arctan\left(\frac {x+\cos a}{\sin a}\right) $$

Thus, the difference of the two is

$$ \csc a\arctan\left(\frac {(x-1)\tan\frac a2}{x+1}\right) -\csc a\arctan\left(\frac {x+\cos a}{\sin a}\right) = \frac12(a-\pi)\csc a$$

which is a constant, as expected.

Related Question