# A strange integral

• Jul 23rd 2006, 05:06 AM
Soroban
A strange integral

Hello, everyone!

Try this integral: .$\displaystyle \int \frac{dx}{1 + e^x}$

I posted this problem at SOSMath three years ago.

I said (quite smugly as you will see):
. . . . ."So far, I've found four ways to integrate it.
. . . . . And the four answers all look different.
. . . . . Give it a try. .I dare you to come up with a fifth method."

Within three hours, radagast found a stunning fifth method.
And a day or so later, skeeter provided a surprising sixth method.

So I offer the challenge again (less arrogantly this time):
. . Is there a seventh method?

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Method #1: "Long Division"

We have: .$\displaystyle I \:= \:\int\frac{dx}{1 + e^x}$

. . $\displaystyle \frac{1}{1 + e^x}\;=\;\frac{1 + e^x - e^x}{1 + e^x} \;= \;\frac{1 + e^x}{1 + e^x} - \frac{1}{1 + e^x}\;=\;1 - \frac{e^x}{1 + e^x}$

Therefore: .$\displaystyle I \;= \;\int\left(1 - \frac{e^x}{1 + e^x}\right)\,dx\;=\;\boxed{x - \ln(1 + e^x) + C}$

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Method #2: $\displaystyle \frac{du}{u}$

Multiply top and bottom by $\displaystyle e^{-x}:$

. . $\displaystyle \frac{e^{-x}}{e^{-x}}\cdot\frac{1}{1 + e^x} \;= \;\frac{e^{-x}}{e^{-x} + 1} \;= \;-\frac{-e^{-x}}{e^{-x} + 1}$

Therefore: .$\displaystyle I \;= \;-\int\frac{-e^{-x}}{e^{-x} + 1}\,dx \;= \;\boxed{ -\ln(e^{-x} + 1) + C}$

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Method #3: Substitution

Let $\displaystyle U = 1 + e^x\quad\Rightarrow\quad e^x = U-1\quad\Rightarrow\quad x =$$\displaystyle \ln(U - 1)\quad\Rightarrow\quad dx = \frac{dU}{U - 1} Substitute: .\displaystyle I \;= \;\int \frac{dU}{U(U - 1)} Now there are two ways to proceed . . . . . (A) Partial Fractions . . \displaystyle \int\frac{du}{U(U - 1)}\;=\;\int\left(\frac{1}{U - 1} - \frac{1}{U}\right)\,dU \displaystyle = \;\ln|U - 1| - \ln|U| + C . . . . \displaystyle = \;\ln\left|\frac{U - 1}{U}\right| + C \;= \;\ln\left(\frac{e^x}{1 + e^x}\right) + C . . (B) Complete the square . . \displaystyle \int\frac{dU}{U^2 - U} \;= \;\int\frac{dU}{(U - \frac{1}{2})^2 - (\frac{1}{2})^2} \;=\;\ln\left|\frac{(U - \frac{1}{2}) - \frac{1}{2}}{(U - \frac{1}{2}) + \frac{1}{2}}\right| + C . . . . \displaystyle = \;\ln\lleft|\frac{U - 1}{u}\right| + C \;= \;\boxed{\ln\left(\frac{e^x}{1 + e^x}\right) + C} Note: the substitution \displaystyle u = e^x leads to the same integral. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Method #4: Trig Substitution . . . my personal favorite. Let \displaystyle e^x = \tan^2\theta\quad\Rightarrow\quad e^{\frac{x}{2}} = \tan\theta\quad \Rightarrow\quad \frac{x}{2} =$$\displaystyle \ln(\tan\theta)\quad\Rightarrow\quad dx = 2\cdot\frac{sec^2\theta}{\tan\theta}\,d\theta$
The denominator is: .$\displaystyle 1 + e^x \;= \;1 + \tan^2\theta \;= \;\sec^2\theta$

Substitute: .$\displaystyle I\;=\;\int\frac{1}{\sec^2\theta}\cdot2\cdot\frac{\ sec^2\theta}{\tan\theta}\,d\theta\;=$ $\displaystyle 2\int\cot\theta\,d\theta \;= \;2\cdot\ln|\sin\theta| + C$

Since $\displaystyle \tan\theta = e^{\frac{x}{2}}$. then angle $\displaystyle \theta$ is in a right triangle with $\displaystyle opp = e^{\frac{x}{2}}$ and $\displaystyle adj = 1$.
. . Hence: .$\displaystyle hyp = \sqrt{1 + e^x}$ .and .$\displaystyle \sin\theta = \frac{e^{\frac{x}{2}}}{\sqrt{1 + e^x}}$

Therefore: .$\displaystyle I \;= \;\boxed{2\cdot\ln\left(\frac{e^{\frac{x}{2}}}{ \sqrt{1 + e^x}}\right) + C}$

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

I have "boxed" the four different-looking solutions.

(should you decide to accept it) is to prove them equivalent.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Method #5: radagast's method

We note that: .$\displaystyle \frac{d}{dx}\left[\ln(1 + e^x)\right] \:=\:\frac{e^x}{1 + e^x}$

Then: .$\displaystyle \int d\left[\ln(1 + e^x)\right]\,dx\;=\;\int\frac{e^x}{1 + e^x}\,dx$

. . and we have: .$\displaystyle \ln(1 + e^x) \;= \;\int\left(1 - \frac{1}{1 + e^x}\right)\,dx\;=$ $\displaystyle \int dx\: - \underbrace{\int\frac{dx}{1 + e^x}}$
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . This is $\displaystyle I$

We have the equation: .$\displaystyle \ln(1 + e^x)\:=\:x - I + C$

Therefore: .$\displaystyle I\;=\;x - \ln(1 + e^x) + C$ . (Solution #1)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Method #6: skeeter's method

Let $\displaystyle u^2 = e^x\quad\Rightarrow\quad 2u\,du = e^x\,dx\quad\Rightarrow\qiad 2u\,du =$$\displaystyle u^2dx\quad\Rightarrow\quad dx = \frac{2\,du}{u}$

Substitute: .$\displaystyle \int\frac{1}{1 + u^2}\left(\frac{2\,du}{u}\right)\;=\;\int\frac{2\, du}{u(1 + u^2)}\;=$ $\displaystyle \int\left(\frac{2}{u} - \frac{2u}{1 + u^2}\right)\,du$

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

Therefore: .$\displaystyle I \;= \;\ln\left(\frac{e^x}{1 + e^x}\right) + C$ . (Solution #3)

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Now you are fully prepared to impress/amaze/terrify your teacher.

• Jul 23rd 2006, 06:19 AM
earboth
Hello, Soroban,

$\displaystyle x-\ln(1+e^x)=\ln(e^x)-\ln(1+e^x)=\ln\left(\frac{e^x}{1+e^x}\right)$. Answer # 3

$\displaystyle -\ln(e^{-x}+1)=\ln\left(\frac{1}{\frac{1}{e^x}+1}\right) =\ln\left(\frac{e^x}{1+e^x}\right)$. Answer # 3

$\displaystyle 2 \cdot \ln \left(\frac{e^{\frac{x}{2}}}{\sqrt{1+e^x}} \right) =$ $\displaystyle \ln\left(\left(\frac{e^{\frac{x}{2}}}{\sqrt{1+e^x} }\right)^2\right)$ $\displaystyle =\ln\left(\frac{e^x}{1+e^x}\right)$. Answer # 3

Greetings

EB
• Jul 23rd 2006, 08:04 AM
Soroban
Well done, Earboth!

My first experience with these multiple-answer integrals was: $\displaystyle \int\sin x\cos x\,dx$
. . which my professor said could be integrated in two ways.

(1) Let $\displaystyle u = \sin x\quda\Rightarrow\quad du = \cos x\,dx$
. . .Substitute: .$\displaystyle \int u\,du \;= \;\frac{1}{2}u^2 + C\;= \;\frac{1}{2}\sin^2x + C$

(2) Let $\displaystyle u = \cos x\quad\Rightarrow\quad du = -\cos x\,dx$
. . . Substitute: .$\displaystyle -\int u\,du \;=\;-\frac{1}{2}u^2 + C\;= \;-\frac{1}{2}\cos^2x + C$

Then he proceeded to show us a third method:

(3) $\displaystyle \int\sin x\cos x\,dx \;= \;\frac{1}{2}\int(2\sin x\cos x)\,dx \;=$ $\displaystyle \;\frac{1}{2}\int\sin(2x)\,dx \;= \;-\frac{1}{4}\cos(2x) + C$

And asked us to show that the answers are equivalent.
. . (I later found a fourth method.)

Later he gave us: .$\displaystyle \int\sec^2x\tan x\,dx$

And asked us to find at least three ways to integrate it . . .

• Jul 23rd 2006, 10:48 AM
earboth
Quote:

Originally Posted by Soroban
Well done, Earboth![size=3]

My first experience with these multiple-answer integrals was: $\displaystyle \int\sin x\cos x\,dx$
. . which my professor said could be integrated in two ways....

Hello, Soroban,

how about using partial integration:

$\displaystyle \int u\cdot v'dx= u\cdot v-\int v\cdot u'dx$

Let v(x)=sin(x) ==> v'(x) = cos(x) and
u'(x) = cos(x) ==> u(x) = sin(x)

$\displaystyle \int\sin x\cos x\,dx=\sin(x) \cdot \sin(x)-\int\sin x\cos x\,dx + C$

Thus

$\displaystyle 2\cdot \int\sin x\cos x\,dx= \left(\sin(x)\right)^2+C_1$. Therefore

$\displaystyle \int\sin x\cos x\,dx=\frac{1}{2}\cdot \left(\sin(x)\right)^2+C_2$

Greetings

EB
• Jul 23rd 2006, 12:16 PM
Soroban
Nice work, Earboth!
. . That was the fourth method I had found