Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We tried to do an integral with the universal trigonometric substitution $$\int \frac{1}{(1+\sin x)}dx$$

Meaning, we substituted: $ t = \tan \frac{x}{2} \Rightarrow$

$$\int \frac{1}{(1+\sin x)}dx = \int \frac{\frac{2}{1+t^2}}{1+\frac{2t}{1+t^2}}dt = \int \frac{2}{(1+t)^2}dt = \frac{-2}{1+t} = \frac{-2}{1+\tan \frac{x}{2}} + C$$

But the answer is: $$ \tan x - \frac{1}{\cos x} + C $$

What did we do wrong?

share|cite|improve this question
I think your approach is correct. Manipulate a little bit your final result and you will come up with the answer. – Dmoreno Jan 21 '14 at 10:44
up vote 17 down vote accepted

$$\begin{align} \frac{-2}{1+\tan \frac{x}{2}} &= \frac{-2\cos \frac{x}{2}}{\cos\frac{x}{2} + \sin \frac{x}{2}}\\ &= \frac{-2\cos \frac{x}{2}(\cos \frac{x}{2}-\sin\frac{x}{2})}{(\cos \frac{x}{2}+\sin\frac{x}{2})(\cos \frac{x}{2}-\sin\frac{x}{2})}\\ &= \frac{\sin x - 2 \cos^2 \frac{x}{2}}{\cos x}\\ &= \tan x - \frac{\cos x + 1}{\cos x}\\ &= \tan x - \frac{1}{\cos x} - 1 \end{align}$$

You did nothing wrong, you just got another representation of the same family of functions.

share|cite|improve this answer
when I put the functions in WolframAlpha, it say's that the functions are not equal for every x... – Algosub Jan 21 '14 at 10:44
You have different constants. Plug in $x = 0$ to see that the main part of your primitive and the answer's is $1$ there. Differentiate to see that both are primitives of the integrand, so the difference is constant. – Daniel Fischer Jan 21 '14 at 10:47
ok, thank you!! – Algosub Jan 21 '14 at 10:49
@Tomer, I'm no math whiz, so I can't directly comment on the correctness of Daniel's answer. However, Wolfram Alpha, when not given any constraints, takes the broadest possible approach to the problem. Wolfram will consider possibilities such as imaginary values for x, even if you think "x is a real number" is implied. This sort of thing is, in my experience, the most common logical error when dealing with Wolfram technologies. – Brian S Jan 21 '14 at 19:20

An alternative method of integration first involves multiplying the numerator and denominator by $1-\sin x$: this gives $$\begin{align*} \int \frac{1}{1+\sin x} \, dx &= \int \frac{1 - \sin x}{1 - \sin^2 x} \, dx \\ &= \int \frac{1 - \sin x}{\cos^2 x} \, dx \\ &= \int \sec^2 x - \frac{\sin x}{\cos^2 x} \, dx \\ &= \tan x - \int \frac{-du}{u^2}, \quad u = \cos x, du = -\sin x \, dx \\ &= \tan x - \frac{1}{u} + C \\ &= \tan x - \sec x + C. \end{align*}$$ To see the equivalence of this form with the expression $$-\frac{2}{1+\tan \frac{x}{2}} + C,$$ consider their difference, with $\theta = x/2$: $$\begin{align*} \tan x - \sec x + \frac{2}{1 + \tan \frac{x}{2}} &= \frac{\sin 2\theta - 1}{\cos 2\theta} + \frac{2}{1 + \tan \theta} \\ &= \frac{\sin 2\theta - 1}{\cos 2\theta} + \frac{2 \cos \theta}{\sin \theta + \cos \theta} \\ &= \frac{\sin 2\theta - 1 + 2 \cos\theta(\cos \theta - \sin \theta)}{\cos 2\theta} \\ &= \frac{2 \cos^2 \theta - 1}{\cos 2\theta} \\ &= 1. \end{align*}$$ Thus their difference is constant, and both are antiderivatives.

share|cite|improve this answer

Another approach would be to first multiply the integrand by $\dfrac{1-\sin x}{1-\sin x}$ to get $$\begin{aligned}\int \frac{1}{1+\sin x}\,dx &= \int\frac{1-\sin x}{1-\sin^2 x}\,dx\\ &= \int\frac{1-\sin x}{\cos^2x}\,dx \\ &= \int\frac{1}{\cos^2 x}-\frac{\sin x}{\cos^2 x}\,dx \\ &= \int \sec^2x -\frac{\sin x}{\cos^2x}\,dx\\ &= \ldots\end{aligned}$$ The first term is trivial to integrate, and the second integral requires the substitution $u=\cos x$. I leave it to you to finish things off.

share|cite|improve this answer

Another answer is $$ \int\frac{1}{1+\sin x} dx=-\frac{\cos x}{1+\sin x}+c $$ To show this we write $$ \tan x-\sec x=\frac{\sin x-1}{\cos x}= \frac{(\sin x-1)\cos x}{\cos^2 x}= \frac{(\sin x-1)\cos x}{1-\sin^2 x}= \frac{(\sin x-1)\cos x}{(1-\sin x)(1+\sin x)}= -\frac{\cos x}{1+\sin x}+c $$

share|cite|improve this answer

Another answer:

Let $x=\dfrac\pi2-2u$. Then $dx=-2du$ and so the integral is $$\int\frac{-2du}{1+\cos(2u)}=-\int \sec^2(u)du=-\tan u+c=\cdots$$ where $c$ is constant.

We used $\cos 2u=2\cos^2 u-1$ and $\sec x=\cos^{-1}x$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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