# 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\ ?$$

-
You can try $t = \tan (x/2)$, so that $$\cos x = \frac{1-t^2}{1+t^2} \quad \text{and} \quad \sin x = \frac{2t}{1+t^2}.$$ Or, you may multiply $\cos x + \sin x$ to both numerator and denominator and utilize double-angle of sine and cosine. – Sangchul Lee Jun 25 '12 at 10:27
the ans. in my book will not match when i take t=tan(x/2) or convert it into double angle Is there any easy way to solve this? – Siddhant Trivedi Jun 25 '12 at 10:39

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$.

-
+1 for its simplicity. – Sangchul Lee Jun 25 '12 at 11:15

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.

-
Above I demonstrate how you nail a toothpick with a big hammer :-D – TenaliRaman Jun 25 '12 at 11:36
1+ for the big hammer :D – N3buchadnezzar Jun 25 '12 at 12:34

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.

-