# What is the right first step to take when integrating $1/(2+ \sin x + \cos x)$? [duplicate]

I want a hint on this following integral. I don't know the first step, do I do $u$-sub. or do I use trig. sub or something?

$$\int \frac{1}{2+ \sin x + \cos x} ~\mathrm{d}x$$

-

## marked as duplicate by Hakim, alexqwx, Cookie, ncmathsadist, RecklessReckonerAug 3 '14 at 1:20

Perhaps using the tangent half-angle substitution (Weierstrass substitution) will do the job. See en.wikipedia.org/wiki/Weierstrass_substitution – Gahawar Aug 2 '14 at 23:00

Hint: let $u = \tan (x/2)$. Then find $\sin x$, and $\cos x$ in terms of $u$. Also solve for $dx$ in terms of $du$.
I stumbled upon this question and attempted to evaluate this interval as well as the OP. After performing Weierstrass substitution (as you and @Gahawar indicated), are we supposed to end up with $$\int \frac1{u^2+2u+3} \, du$$ and we have to integrate that from there using long division of the polynomial? – Cookie Aug 2 '14 at 23:52
If that's right, you write: $$u^2 + 2u + 3 = (u+1)^2 + 2 = 2\left(\left(\frac{u+1}{\sqrt{2}}\right)^2+1\right)$$And the answer will be something involving $\arctan$. – Ivo Terek Aug 3 '14 at 0:17
Hint: Notice that $$\sin x + \cos x = \sqrt{2}\sin\left(x + \frac{\pi}{4}\right)$$ I would try $u = 2 + \sqrt{2}\sin\left(x + \frac{\pi}{4}\right)$ then.