Closed form for $\int \left(k e^{-2x}+4e^{-x}\right)^{-1/2}dx$

I could manage to solve the following integral:

$$\int \left(k e^{-2x}+4e^{-x}\right)^{-1/2} \,dx$$

Where $k \in \Re$. However I'm not satisfied with my method so I wanted to ask if there's a more elegant way of solving it. Also I don't care if it requires further knowledge. It's just for curiosity.

I posted as an answer my solution for comparison. What is nagging me is how simple the solution is.

PS: After writing everything down I figured an easier substitution $u = e^{x}$ but I'll post it anyways if it helps. Still I would like to know if there's a better (in terms of elegance) solution.

-
Given the form of the answer, I doubt there is a better approach than to use $u=e^x$ or a similar substitution. – robjohn Mar 1 '14 at 7:22

I found another way to do it that is much shorter. If we write out your question it is this:

$$\large\int \dfrac {dx}{\sqrt{\frac{k}{(e^x)^2}+\frac{4}{e^x}}}$$

$$\large \int \dfrac {dx}{\sqrt \frac {4e^x+k}{(e^x)^2}}$$

$$\large\int \dfrac {e^x dx}{\sqrt {4e^x +k}}$$

Now we can make a substitution; $u=e^x$, $du=e^x dx$

$$\large\int \dfrac {du}{\sqrt{4u+k}}$$

Another substitution, $v=4u+k$, $dv=4 du$

$$\large\dfrac 14 \int \dfrac {dv}{\sqrt v}$$

$$\large\dfrac 12 \sqrt v +C$$

$$\large\dfrac 12 \sqrt {4u+k} +C$$

$$\large\dfrac 12 \sqrt {4e^x+k} +C$$

-
Upon closer inspection, I see that my approach is similar to this one. However, this one is pretty much a simplification of your earlier answer. I have upvoted them both because I did not realize that they were both by the same author. I would have simplified the earlier answer rather than posting a second. In any case, I definitely think this is a good approach :-) – robjohn Mar 1 '14 at 7:21
@robjohn Yes they are very similar, and thanks for the upvote, I returned the favor :) – Ovi Mar 1 '14 at 20:00

Using $u=\frac4ke^x$, \begin{align} \int\frac{\mathrm{d}x}{\sqrt{ke^{-2x}+4e^{-x}}} &=\frac{\sqrt{k}}4\int\frac{\frac4ke^x\,\mathrm{d}x}{\sqrt{1+\frac4ke^x}}\\ &=\frac{\sqrt{k}}4\int\frac{\mathrm{d}u}{\sqrt{1+u}}\\ &=\frac{\sqrt{k}}2\sqrt{1+u}+C\\[3pt] &=\frac{\sqrt{k+4e^x}}{2}+C \end{align}

-

This is very similar to yours, but I think the $v$ substitution is much easier to come up with this way:

$$-\int \dfrac {du}{u\sqrt {ku^2+4u}}$$

$$-\int \dfrac {du}{u \sqrt u \sqrt {ku+4}}$$

$$-2\int \dfrac {1}{u \sqrt {ku+4}} \dfrac {du}{2\sqrt u}$$

We can make the substitution $v=\sqrt u$ , so $dv=\dfrac {1}{2\sqrt u} du$ , and $u=v^2$

$$-2\int \dfrac {dv}{v^2 \sqrt {kv^2+4}}$$

Now we can make a trig substitution with $v=\dfrac 2k \tan \theta$, and $dv=\dfrac {2}{\sqrt k} \sec^2 \theta d\theta$

$$-2\int \dfrac {\sec^2 \theta d\theta}{ \frac 4k \tan^2 \theta \sqrt{4 \tan^2 \theta +4}}$$

$$-\dfrac k2 \int \dfrac {\sec^2 \theta d\theta}{\tan^2 \theta \sec \theta}$$

$$-\dfrac k2 \int \csc \theta \cot \theta d\theta$$

$$\dfrac k2 \csc \theta +C$$

From here it is just a matter of substituting everything back in.

-

This is how I solved it:

Firstly, I made this substitution: $u = e^{-x} \Rightarrow du = -e^{-x}\,dx = -u\, dx$

$$-\int \frac{du}{u \sqrt{k\,u^2+4u}}$$

Since, $ku^2 + 4u = \left(\sqrt{k}+\frac{2}{\sqrt{k}}\right)^2 - \frac{4}{k}$, I made another substitution:

$$v = \sqrt{k}\,u + \frac{2}{\sqrt{k}} \\ dv = \sqrt{k} \, du$$

Replacing $u$:

$$-\frac{1}{\sqrt{k}} \int \frac{dv}{\left(\frac{v}{\sqrt{k}}-\frac{2}{k}\right)\cdot \sqrt{v^2 - \frac{4}{k}}}$$

And the last substitution: $$v = \frac{2}{\sqrt{k}} \cdot sec\,\theta \\ dv = \frac{2}{\sqrt{k}} \cdot sec\,\theta\, tan\,\theta \,d\theta$$

After replacing and simplifying a little bit the expression, I get to:

\begin{align} -\frac{\sqrt{k}}{2} \, \int \frac{sec\,\theta}{sec\,\theta - 1} \, d\theta &= -\frac{\sqrt{k}}{2} \, \int \frac{d\theta}{1-cos\,\theta} \\ &= -\frac{\sqrt{k}}{2} \, \int (cosec^2\,\theta + cosec\,\theta\cdot\cot\,\theta)\,d\theta \\ &= \frac{\sqrt{k}}{2} \cdot (cot\,\theta + cosec\,\theta) + C \end{align}

Since $sec\,\theta = \frac{\sqrt{k}v}{2}$, I could assume a triangle which hypotenuse is equal to $\sqrt{k}\,v$, the adyacent side with respect to $\theta$ equal to $2$ and the opposite with respect to $\theta$ side equal to $\sqrt{k\, v^2 - 4}$. Thus:

$$\frac{\sqrt{k}}{2} \left(\frac{2}{\sqrt{k\,v^2-4}} + \frac{\sqrt{k}\,v}{\sqrt{k\,v^2-4}}\right) + C$$

Finally, replacing $v$ by its original substitution $v = \sqrt{k}\,u + \frac{2}{\sqrt{k}}$ and simplifying:

\begin{align} \frac{\sqrt{k}}{2} \left[\frac{(ku + 4)\cdot\sqrt{k^2 u^2 + 4ku}}{ku(ku+4)}\right] &= \frac{\sqrt{u(ku+4)}}{2u} \\ u = e^{-x}&\Rightarrow \frac{e^x}{2}\cdot\sqrt{e^{-2x}(ke^{-x}+4)} \\ &= \frac{\sqrt{k+4e^x}}{2} \end{align}

-