7

I manually integrate $\int \frac{1}{\sin(x)}dx$ as $$\int \frac{\sin(x)}{\sin^{2}(x)}dx = -\int \frac{1}{\sin^{2}(x)}d\cos(x) = \int \frac{1}{\cos^{2}(x) - 1}d\cos(x).$$

After replacing $u = \cos(x)$,

$$\int \frac{1}{u^{2} - 1}du = \int \frac{1}{u^{2} - 1}du = \frac {1} {2} \int \left(\frac {1} {u - 1} - \frac {1} {u+1}\right) du = \frac {1} {2} \ln\left(\frac {u-1} {u+1}\right) + C.$$

Substitute back to obtain

$$\frac {1} {2} \ln\left(\frac {\cos(x)-1}{\cos(x)+1}\right) + C.$$

The problem is that this solution is incorrect (I guess) because for example http://www.integral-calculator.com/ gives another solution

$$\frac {1} {2} \ln\left(\frac {1 - \cos(x)}{1 + \cos(x)}\right) + C.$$

And all other online solvers gives equivalent solution to $$\frac {1} {2} \ln\left(\frac {1 - \cos(x)}{1 + \cos(x)}\right) + C.$$

The question is there I made a mistake?

Update: some of you may say that in complex space my answer is right but not so fast:

Take wolfram solver: integrate 1/sinx

The we get: $-ln(cot(x) + csc(x)) + C$ It is easy to see that it is equvalent to $$\frac {1} {2} \ln\left(\frac {1 - \cos(x)}{1 + \cos(x)}\right) + C.$$

$-\ln(\cot(x) + \csc(x)) + C = -\ln(\frac {\cos(x)} {\sin(x)} + \frac {1} {\sin(x)})$

then

$-\ln(\frac {\cos(x)} {\sin(x)} + \frac {1} {\sin(x)}) = -\frac {1}{2} \ln(\frac {(1+\cos(x))^{2}} {\sin^{2}x}) = -\frac {1}{2} \ln(\frac{1+\cos(x)+\cos(x)+\cos^{2}(x)} {1-\cos^{2}x}) = -\frac {1}{2} \ln(\frac {(1+\cos(x))(\cos(x)+\cos^{2})(x)} {1-\cos^{2}x}) = -\frac {1}{2} \ln(\frac {1+\cos(x)} {1-\cos(x)}) = \frac {1}{2} \ln(\frac {1-\cos(x)} {1+\cos(x)})$

user326159
  • 2,731

3 Answers3

6

Where did I make a mistake?

First, you rather have $$ \frac {1} {2} \int \left(\frac {1} {u - 1} - \frac {1} {u+1}\right) du = \frac {1} {2} \ln\left|\frac {u-1} {u+1}\right| + C $$then observe that $$ \left|\frac {\cos(x)-1}{\cos(x)+1}\right|=\frac {1-\cos(x)}{1+\cos(x)} $$ since $$ 1 - \cos(x)\ge 0,\quad 1+ \cos(x)\ge0, $$ giving that $$ \ln\left|\frac {\cos(x)-1}{\cos(x)+1}\right|=\ln\left(\frac {1-\cos(x)}{1+\cos(x)}\right). $$

Olivier Oloa
  • 120,989
  • Ok It is a point but that if I calculate this in complex space? Then $\int \frac {1}{x} dx = ln(x)$ not $ln|x|$ (I guess) – Marat Zakirov Mar 11 '17 at 10:16
  • @MaratZakirov Here we assume to integrate in a real space. In a complex space, you are right to say it does not hold. – Olivier Oloa Mar 11 '17 at 10:17
  • @MaratZakirov How do you define $\log(z)$ for $z \in \mathbb{C}$? Thanks. One may recall that no branch of $\log(z)$ exists on an open set $U$ containing a closed curve that winds around $0$... – Olivier Oloa Mar 11 '17 at 10:26
  • please see update of my question in complex space my answer is still incorrect and pay attention to fact that it is done on wolfram alpha solver which is complex by default – Marat Zakirov Mar 11 '17 at 10:38
  • @MaratZakirov I must confess that I don't really understand your point here ;) – Olivier Oloa Mar 11 '17 at 10:40
  • The point is simple if we consider complex space - no module in $ln$ you are agree with that? If yes Then I took wolfram solver and ask it to integrate it give answer which is different from mine but the problem is that wolfram is integrating in complex space – Marat Zakirov Mar 11 '17 at 10:42
1

The integral of $1/x$ is not $\ln(x)$, but $\ln|x|$. See What is the integral of 1/x?

Then, in your case $\frac{1}{2}\int du \left( \frac{1}{u-1} - \frac{1}{u+1} \right) = \frac{1}{2}\ln\left( \frac{|u-1|}{|u+1|} \right) + C$. When you put back $u=\cos(x)$, the expression $|u-1|$ becomes $|\cos(x)-1|=1-\cos(x)$ and $|u+1|$ becomes $|\cos(x)+1|=1+\cos(x)$. Notice, you can forget about taking the absolute value, because $1-\cos(x) \ge 0$ and $1+\cos(x)\ge 0$. Finally

$\int dx \frac{1}{\sin(x)} = \frac{1}{2}\ln\left( \frac{1-\cos(x)}{1+\cos(x)} \right) + C$

Lagrang3
  • 155
1

If you are considering antiderivatives as functions on connected domains $D$ that are open in $\mathbb{C}$ -- suitably chosen so that we don't have to worry about multivaluedness of the logarithm -- then you should still be okay. It's still true that the functions $z \mapsto \frac1{2} \ln \left(\frac{1 - \cos(z)}{1 + \cos(z)}\right)$ and $z \mapsto \frac1{2} \ln \left(\frac{\cos(z) - 1}{\cos(z) + 1}\right)$ are antiderivatives of $z \mapsto 1/\sin(z)$. Their difference is the constant $C = \ln(-1)/2$ for whatever branch of the logarithm you are considering. So you still get the same family of functions, up to a complex constant.

user43208
  • 8,289