Quick question regarding $\int \frac{\cos x + \sin x}{\sin 2x}\,dx$

255 Views Asked by At

I already asked a question here regarding the discrepancy between the answers I get when I work integrals by hand and the result I can verify using $Mathematica$. I only know enough about $Mathematica$ to type in the commands I need to verify results, plot graphs of polynomials, etc.

Usually I get to the same answer that the program produces, which I always find a bit gratifying, but other times I get results that are equivalent but quite different and often tedious to transfer for one form to the other to verify the equivalence.

Anyway, since this happens to me quite often lately, I wonder how I could check whether I am getting correct results in a reliable way.

For example $$\int \frac{\cos x + \sin x}{\sin 2x}\,dx$$ I use the identity $\sin 2x = 2 \sin x \cos x $ and get $$\frac 12 \int \frac {\cos x + \sin x}{\sin x \cos x}\, dx$$

$$=\, \frac 12 \int \frac {\cos x}{\sin x \cos x}+\frac {\sin x}{\sin x \cos x}\, dx$$

$$=\, \frac 12 \int \csc x \, dx \; + \; \frac 12 \int \sec x \,dx$$

$$=\, -\frac 12 \ln {|\csc x + \cot x|} + \frac 12 \ln {|\sec x + \tan x|}+C$$

This is not the same as the result from $Mathematica$, which gives $$-\frac 12 \ln \left(\cos \frac x2 \right) - \frac 12 \ln \left( \cos \frac x2 - \sin \frac x2 \right)+ \frac 12 \ln \left( \sin \frac x2 \right) + \ln \left( \cos \frac x2 + \sin\frac x2 \right)$$ is this equivalent to my result $$=\, -\frac 12 \ln {|\csc x + \cot x|} + \frac 12 \ln {|\sec x + \tan x|}+C$$ and how could I reliably verify my answers with $Mathematica$?

2

There are 2 best solutions below

2
On BEST ANSWER

It's the same result, if you change the parentheses for modulus:

$$ -\ln \left| \cos \frac x2 - \sin \frac x2 \right|+ \ln \left| \sin \frac x2 + \cos \frac x2 \right| = \ln \frac{\left| \sin \frac x2 + \cos \frac x2 \right|}{\left| \cos \frac x2 - \sin \frac x2 \right|} =$$

$$\ln \left| \frac{\left( \sin \frac x2 + \cos \frac x2 \right)^2}{\left( \cos \frac x2 - \sin \frac x2 \right)\left( \sin \frac x2 + \cos \frac x2 \right)} \right | = \ln \left| \frac{1 + \sin x}{\cos x} \right | = \ln |\sec x + \tan x| $$

And

$$ -\ln {|\csc x + \cot x|} = \ln \left|\frac{\sin x}{1+\cos x} \right| = \ln \left|\frac{2\sin \frac x2\cos \frac x2}{2\cos^2 \frac x2} \right| = \ln \left |\tan \frac x2 \right| = \ln \left | \sin \frac x2 \right| - \ln \left |\cos \frac x2 \right| $$

0
On

Check your integrals by taking the derivatives; if you're good at derivatives it's easy. Faster and more productive than Mathematica in a large number of cases.