# Question:

Find the value of the following expression:

$$\int \frac{\cos^2x}{1+\sin x}\ dx$$

# My Working:

## Failed Method 1:

Basically, I first tried to use $$u$$-substitution with $$u=1+\sin x$$, and this would result in

\begin{align} \frac{du}{dx}&=\cos x\\ du&=\cos x\cdot dx \end{align}

This would not cancel out the other $$\cos x$$.

## Failed Method 2:

I also tried using the formula $$\cos^2x=\frac{1+\cos2x}{2},$$ but that would result in the integral being equivalent to

\begin{align} & \quad\int\frac{\frac{1+\cos 2x}{2}}{1+\sin x}\ dx\\ &=\int\frac{1+\cos2x}{2+2\sin x}\ dx \end{align}

Nothing would cancel out here either.

# WolframAlpha's Answer Which Looks Ridiculous:

I've also tried using WolframAlpha, but the "answer", shown below, looks terrifying, and maybe not the right answer (at least, not the simplified right answer). (By the way, I don't have WolframAlpha Pro, so I cannot access the step-by-step solution)

$$-\frac{\left[2 \sqrt{1 - \sin x} \sin^{-1}\left(\frac{\sqrt{1 - \sin x}}{\sqrt{2}}\right) + (\sin x - 1) \sqrt{\sin x + 1}\right] \cos^3x}{(\sin x - 1)^2 (\sin x + 1)^{3/2}} + c$$

## Could you please give me some advice on how to solve the problem? Thanks!

Did Wolfram Alpha really produce that?

$$\cos^2 x=1-\sin^2x=(1+\sin x)(1-\sin x)$$.

You can do the rest yourself.

• Thanks, I have solved the problem now. I just forgot to use the theorem. +1, will accept soon. Oct 8, 2022 at 6:35
• I don't understand why but I got the same result: wolframalpha.com/… But look at this: wolframalpha.com/… Oct 8, 2022 at 6:36
• The lesson being: WolframAlpha isn't infallible. Oct 8, 2022 at 6:37
• @PrincessEev Yes, I remember when it couldn't factor $x^4+y^4$ without going to complex numbers. Oct 8, 2022 at 6:38
• @SuzuHirose Very strange. I reported this as a bug. Oct 8, 2022 at 9:32

\begin{align} \int {\cos^2 x \over 1+\sin x } \mathrm{d}x&= \int {1-\sin^2 x \over 1 + \sin x } \mathrm{d}x \\&=\int {(1+\sin x)(1-\sin x) \over (1+\sin x) } \mathrm{d}x\\ &=\int (1-\sin x) \mathrm d x\\&=x+\cos x + \mathrm{const} \end{align}

• Wait wait, why I was downvoted? Oct 8, 2022 at 6:39
• Sorry, probably because you answered a little late. But you still provided more working out, so I upvoted anyway. Oct 8, 2022 at 6:41

Use the "tan half-ange" substitution, $$viz$$ $$u=\tan (x/2)$$ to convert the integral to the integral of a rational function.

Use $$\cos^2x=1-\sin^2x$$. Then $$I=\int (1-\sin x) dx$$