# How to solve $\int\sqrt{e^x}$ - different approaches seem to yield different results

Approaching the following integral in different ways appears to yield different results:

$\int \sqrt{e^x} dx$

1. Simplifying $\sqrt{e^x}$ to $(e^x)^\frac{1}{2}$ to $e^\frac{x}{2}$. Now, integrating simply takes one over the inner derivative as the factor yielding $2e^\frac{x}{2}$ or $2\sqrt{e^x}$ (cutting the partial integration part short here since it becomes more relevant in the next approach).

2. Using partial integration and substituting $u = e^x$ and $\frac{du}{dx} = e^x$. The integral becomes $\int \frac{\sqrt{u}}{e^x}du$. This is where one can choose an approach once again:

a) Integrate $e^{-x}\int \sqrt{u}du$ first, equaling $\frac{2}{3}e^{-x}u^{\frac{3}{2}}$. Replacing $e^x$ back for $u$ gives $\frac{2}{3}e^{\frac{3}{2}x - x} = \frac{2}{3}e^{\frac{x}{2}} = \frac{2}{3}\sqrt{e^x}$.

b) Insert $u$ for the $e^x$ denominator to give $\int \frac{\sqrt{u}}{u}du = \int \frac{du}{\sqrt{u}}$. This again becomes $2\sqrt{e^x}$ like approach 1.

The last approach (2b) is also the one Wolfram|Alpha suggests when entering the integral. Recalling approach 1, this also seems to be the true one. This leads to the question: What is wrong with 2a ? Why is the result only one third of the correct result ? I can't spot any errors (I'm a maths A-level student).

• You can't pull $e^{-x}$ outside of the integral because it's not a constant independent of $u$. In fact $u=e^x$, so you must replace $e^x$ in the denominator with $u$.
– anon
Jul 24, 2016 at 7:45
• Oh well, thanks for clearing that up. If you wish to, create an answer I'll accept. Jul 24, 2016 at 7:47
• Just put $e^x=u$ .e^x is a variable , you cannot take it out of integration Jul 24, 2016 at 7:50

Whilst it is true that $$\int \lambda f(x) \, \mathrm{d}x = \lambda \int f(x) \, \mathrm{d}x$$ for real $\lambda$ not depending on $x$, it does not hold that $$\int f(x) g(x) \, \mathrm{d}x = g(x) \int f(x) \, \mathrm{d}x = f(x) \int g(x) \, \mathrm{d}x$$
In general, you cannot pull out things from the integral that depend on the variable you are integrating with respect to. This can be seen via a few more trivial examples. You know that $\int \cos x \, \mathrm{d}x = \sin x + \mathrm{C}$ but using the fallacious method gives $\cos x \int \, \mathrm{d}x = x\cos x + \mathrm{C}$.
Furthermore, you can verify an anti derivative by differentiating it, so $\frac{\mathrm{d}}{\mathrm{d}x} (2\sqrt{e^x}) =\frac{2e^x}{2\sqrt{e^x}} = \sqrt{e^x}$ which is the integrand.