# Two different results of an integral

#### dwsmith

##### Well-known member
$\DeclareMathOperator{\sech}{sech}$

This integral arose when solving for a solitary wave in the KdV equation.

In class, the professor came up with:

$\int\frac{dx}{\sin(x)} = -\frac{1}{2}\ln\left[\frac{1 + \cos(x)}{1 - \cos(x)}\right]$
However, Wolfram obtains
$\int\frac{dx}{\sin(x)} = -\ln\left[\frac{1 + \cos(x)}{1 - \cos(x)}\right]$
but that changes our solitary waves solution from
$\sqrt{2\mu}e^{i\varepsilon^2\mu t} \sech\left[\sqrt{\mu}(x - vt - x_0)\right]$
to
$\sqrt{2\mu}e^{i\varepsilon^2\mu t} \sech\left[\frac{\sqrt{\mu}}{2}(x - vt - x_0)\right]$
For a solitary wave, the relation between the amplitude and the width has to at a certain portion. The professors solution for the solitary wave is correct but his integral doesn't workout compared to Wolframs.

Is there something I am missing?

#### Ackbach

##### Indicium Physicus
Staff member
Re: two different results of an integral

Check by differentiation:
\begin{align*}
\frac{d}{dx} \left[ -\frac{1}{2} \ln \left( \frac{1 + \cos(x)}{1 - \cos(x)} \right) \right]
&=- \frac{1}{2} \frac{1- \cos(x)}{1+ \cos(x)} \frac{(1- \cos(x))(- \sin(x))-(1+ \cos(x))( \sin(x))}{(1- \cos(x))^{2}} \\
&=- \frac12 \frac{- \sin(x)+ \sin(x) \cos(x)- \sin(x)- \sin(x) \cos(x)}{1- \cos^{2}(x)} \\
&= \frac{ \sin(x)}{ \sin^{2}(x)} \\
&= \frac{1}{ \sin(x)},
\end{align*}
as needed. So your professor's answer is definitely correct. Checking W/A's solution:
\begin{align*}
\frac{d}{dx} \left[- \ln \left( \frac{1 + \cos(x)}{1 - \cos(x)} \right) \right]
&= \frac{2}{ \sin(x)},
\end{align*}
which is definitely incorrect. That's odd that W/A would make a mistake like that. This does not strike me as a trivial mistake. When I plug this into W/A, it gives me
$$\int \frac{dx}{ \sin(x)}= \ln \left( \sin \left( \frac{x}{2} \right) \right)- \ln \left( \cos \left( \frac{x}{2} \right) \right) =\ln \left( \tan \left( \frac{x}{2} \right) \right).$$
This answer is correct. What exactly are you typing into W/A?