Integral of $$$\frac{2 \sin{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}}$$$

The calculator will find the integral/antiderivative of $$$\frac{2 \sin{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}}$$$, with steps shown.

Related calculator: Definite and Improper Integral Calculator

Please write without any differentials such as $$$dx$$$, $$$dy$$$ etc.
Leave empty for autodetection.

If the calculator did not compute something or you have identified an error, or you have a suggestion/feedback, please contact us.

Your Input

Find $$$\int \frac{2 \sin{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}}\, dx$$$.

Solution

Rewrite the numerator and split the fraction:

$${\color{red}{\int{\frac{2 \sin{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}} d x}}} = {\color{red}{\int{\left(1 + \frac{\sin{\left(x \right)} + \cos{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}}\right)d x}}}$$

Integrate term by term:

$${\color{red}{\int{\left(1 + \frac{\sin{\left(x \right)} + \cos{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}}\right)d x}}} = {\color{red}{\left(\int{1 d x} + \int{\frac{\sin{\left(x \right)} + \cos{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}} d x}\right)}}$$

Apply the constant rule $$$\int c\, dx = c x$$$ with $$$c=1$$$:

$$\int{\frac{\sin{\left(x \right)} + \cos{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}} d x} + {\color{red}{\int{1 d x}}} = \int{\frac{\sin{\left(x \right)} + \cos{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}} d x} + {\color{red}{x}}$$

Let $$$u=\sin{\left(x \right)} - \cos{\left(x \right)}$$$.

Then $$$du=\left(\sin{\left(x \right)} - \cos{\left(x \right)}\right)^{\prime }dx = \left(\sin{\left(x \right)} + \cos{\left(x \right)}\right) dx$$$ (steps can be seen »), and we have that $$$\left(\sin{\left(x \right)} + \cos{\left(x \right)}\right) dx = du$$$.

Therefore,

$$x + {\color{red}{\int{\frac{\sin{\left(x \right)} + \cos{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}} d x}}} = x + {\color{red}{\int{\frac{1}{u} d u}}}$$

The integral of $$$\frac{1}{u}$$$ is $$$\int{\frac{1}{u} d u} = \ln{\left(\left|{u}\right| \right)}$$$:

$$x + {\color{red}{\int{\frac{1}{u} d u}}} = x + {\color{red}{\ln{\left(\left|{u}\right| \right)}}}$$

Recall that $$$u=\sin{\left(x \right)} - \cos{\left(x \right)}$$$:

$$x + \ln{\left(\left|{{\color{red}{u}}}\right| \right)} = x + \ln{\left(\left|{{\color{red}{\left(\sin{\left(x \right)} - \cos{\left(x \right)}\right)}}}\right| \right)}$$

Therefore,

$$\int{\frac{2 \sin{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}} d x} = x + \ln{\left(\left|{\sin{\left(x \right)} - \cos{\left(x \right)}}\right| \right)}$$

Simplify:

$$\int{\frac{2 \sin{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}} d x} = x + \ln{\left(\left|{\cos{\left(x + \frac{\pi}{4} \right)}}\right| \right)} + \frac{\ln{\left(2 \right)}}{2}$$

Add the constant of integration (and remove the constant from the expression):

$$\int{\frac{2 \sin{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}} d x} = x + \ln{\left(\left|{\cos{\left(x + \frac{\pi}{4} \right)}}\right| \right)}+C$$

Answer

$$$\int \frac{2 \sin{\left(x \right)}}{\sin{\left(x \right)} - \cos{\left(x \right)}}\, dx = \left(x + \ln\left(\left|{\cos{\left(x + \frac{\pi}{4} \right)}}\right|\right)\right) + C$$$A