Integration Example How can i find the integration of this example
$$\int \frac{\sin x}{\sin x - \cos x } dx$$
I tried first add cos and then substracting cos but then what about $$\int \frac{\cos x}{\sin x - \cos x } dx\ ?$$ 
 A: Multiply and divide Numerator by 2 to get $2\sin(x)$ and write it as $(\sin(x)+\cos(x)) + (\sin(x)-\cos(x))$ then divide each term by denominator.Second term would be 1(you can integrate it easily),for first term,  put $(\sin(x)-\cos(x))$ as $z$ then, $(\sin(x)+\cos(x))dx$ would become $dz$ and your first integral will look like $\int {\frac{dz}{z}}$, which is $ln(z)+c$.
A: Let $f(a) = \int \frac{\sin(ax)}{\sin(x) - \cos(x)}dx$.
Differentiating throughout by a, we get
$$f'(a) = a\int \frac{\cos(ax)}{\sin(x) - \cos(x)}dx$$
Therefore, $$af(a) - f'(a) = a\int \frac{\sin(ax) - \cos(ax)}{\sin(x) - \cos(x)}dx$$
Substituting $a = 1$, we get
$$f(1) - f'(1) = x + C_1$$
Also,
$$af(a) + f'(a) = a\int \frac{\sin(ax) + \cos(ax)}{\sin(x) - \cos(x)}dx$$
Substituting $a = 1$ gives,
$$f(1) + f'(1) = \int \frac{\sin(x) + \cos(x)}{\sin(x) - \cos(x)}dx = \ln(\sin(x) - \cos(x)) + C_2$$
The integral was simply solved using the substitution $t = \sin(x) - \cos(x)$.
Solving the above two equations for $f(1)$ gives,
$$2f(1) = x + \ln(\sin(x) - \cos(x)) + C_1 + C_2$$
Therefore,
$$f(1) = \frac{1}{2}(x + \ln(\sin(x) - \cos(x)) + C_1 + C_2)$$
which is what we sought.
A: Now let 
$$ I = \int \frac{\cos x}{\cos x + \sin x} \, \mathrm{d}x \quad \text{and} \quad J = \int \frac{\sin x}{\cos x + \sin x} \, \mathrm{d}x$$
Notice that 
\begin{align*}
I + J & = \int \frac{\cos x + \sin x}{\cos x + \sin x} \, \mathrm{d}x = x + \mathcal{C} \\
I - J & = \int \frac{(\sin x + \cos x)'}{\cos x + \sin x} \, \mathrm{d}x = \ln\bigl( \cos x + \sin x \bigr) + \mathcal{C}
\end{align*}
Solving the system yields
$$I = \frac{1}{2}x + \frac{1}{2}\ln\bigl( \cos x + \sin x \bigr) + \mathcal{C}$$
and
$$J = \frac{1}{2}x - \frac{1}{2}\ln\bigl( \cos x + \sin x \bigr) + \mathcal{C}$$
as wanted. 
