Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This question already has an answer here:

I'm trying to figure out how to take this indefinite integral:

$$ \int{\frac{\cos x}{\sin x + \cos x}dx}$$

I tried simplifying and rearranging it, and this is the best I got: $$ \int{\frac{1}{\tan x + 1 } } dx$$

But I still can't figure out how to integrate from there. I know that it's integrable, as Wolfram Alpha indicates that the integral is $ \frac{1}{2}(x+\ln{(\sin x + \cos x)})+C$, but I can't figure out the steps to deriving it. Does anyone know how to evaluate this integral?

share|improve this question
This is basically the same as this question. (To be more precise, if you know one of the two integrals, it is easy to calculate the other one and vice versa.) –  Martin Sleziak May 30 '13 at 16:42
add comment

marked as duplicate by Martin Sleziak, Amzoti, rschwieb, Asaf Karagila, Mark Bennet May 30 '13 at 17:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers

up vote 14 down vote accepted

Let $I=\int\frac{\cos x}{\sin x+\cos x}\ dx$ and $J=\int \frac{\sin x}{\sin x+\cos x}\ dx$.

Then $I+J=\int\frac{\cos x+\sin x}{\sin x+\cos x}\ dx=x+C_1$ and $I-J=\int\frac{\cos x-\sin x}{\sin x+\cos x}\ dx=\ln |\sin x+\cos x|+C_2$.

Hence $I=\frac{1}{2}((I+J)+(I-J))=\frac{1}{2}(x+\ln |\sin x+\cos x|)+C$.

share|improve this answer
This is very elegant in that it requires no substitutions. –  user54147 Feb 9 '13 at 12:20
add comment

A general (but not necessarily efficient) tool is the Weierstrass substitution $t=\tan(x/2)$.

Then $\cos x=\frac{1-t^2}{1+t^2}$, $\sin x=\frac{2t}{1+t^2}$, and $dx=\frac{2}{1+t^2}$. Do the substitution. We end up needing the following ugly integral: $$\int \frac{2(1-t^2)}{(1+2t-t^2)(1+t^2)}\,dt.$$ We are integraing a rational function, and it can be done using partial fractions. But it takes some work.

The same idea works in principle for any rational function of $\sin x$ and $\cos x$.

share|improve this answer
add comment

Notice that $$\sin x+\cos x=\sqrt{2}\left(\frac{1}{\sqrt{2}}\sin x+\frac{1}{\sqrt{2}}\cos x\right)=\sqrt{2}\sin\left(x+\frac{\pi}{4}\right)$$ Therefore $$I=\frac{1}{\sqrt{2}}\int\frac{\cos x}{\sin\left(x+\frac{\pi}{4}\right)}dx$$ Now let $x+\frac{\pi}{4}=t$ $$I=\frac{1}{\sqrt{2}}\int\frac{\cos \left(t-\frac{\pi}{4}\right)}{\sin t}dt=\frac{1}{2}\int\frac{\sin t + \cos t}{\sin t}dt=\frac{1}{2}\left(t+\ln {\left|\sin t\right|}\right)+C_1\\=\frac{1}{2}\left(x+\frac{\pi}{4}+\ln {\left|\sin x+\cos x\right|}\right)+C_1=\frac{1}{2}\left(x+\ln {\left|\sin x+\cos x\right|}\right)+C$$

share|improve this answer
add comment

$\displaystyle \int \frac{1}{1+ \tan x} \ dx $

$ \displaystyle = \int \frac{1}{1+u} \frac{1}{1+u^{2}} \ du$ (let $u = \tan x$)

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

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

$ \displaystyle =\frac{1}{2} \left(\ln(1+u) - \frac{1}{2} \ln(1+u^{2}) + \arctan u \right) + C$

$ \displaystyle =\frac{1}{2} \left(\ln(1+u) - \ln(\sqrt{1+u^{2}}) + \arctan u \right) + C$

$ \displaystyle = \frac{1}{2} \left( \ln(1+\tan x) - \ln (\sqrt{1+\tan^{2}x}) + x \right) + C$

$ \displaystyle = \frac{1}{2} \left( \ln(1+\tan x) - \ln (\sec x) + x \right) + C$

$ \displaystyle = \frac{1}{2} \Big( \ln \big(\frac{1+ \tan x}{\sec x}\big) + x \Big) + C$

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

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.