# Indefinite integral $\int \frac{2^x}{2^{2x}-4}dx$

I found an interesting integral to try to evaluate, $$\int \frac{2^x}{2^{2x}-4}dx$$ I am not sure if my result is correct, I can verify it by taking $\frac d{dx}$ of my result which takes me back to the original integrand, but when I check it with Mathematica it seems that it is incorrect. What I did was quite straight forward, $$\int \frac{2^x}{2^{2x}-4}dx\;=\;\frac 14 \int \frac{2^x}{2^x-1}dx$$ Let $u=2^x-1$ so $\ln u = \ln(2^x-1)$ and take the derivative $$\frac 1u du \,=\, \frac {2^x\ln 2}{2^x-1}dx$$ So $du=2^x\ln 2dx$ and I get an integral of the form $\int \frac 1u du$ which yields $$\int \frac{2^x}{2^{2x}-4}dx\;=\;\frac {\ln|2^x-1|}{4\ln2}+C$$ Taking the derivative to verify this result I get $$\frac d{dx} \left[\frac {\ln|2^x-1|}{4\ln2}+C\right]\,=\,\left(\frac 1{4\ln2}\right) \frac d{dx}\ln|2^x-1|$$ $$=\, \frac {2^x\ln2}{4\ln2(2^x-1)}\,=\,\frac {2^x}{2^{2x}-4}$$ Which is the original integrand.

My question comes from the fact that when I differentiate $\frac {\ln|2^x-1|}{4\ln2}+C$ with Mathematica, I get $$\frac d{dx}\left[\frac {\ln|2^x-1|}{4\ln2}+C\right] \,=\, \frac {2^{x-2}}{2^x-1}$$ and also a different result for the indefinite $x$-integral, for which Mathematica says $$\int \frac{2^x}{2^{2x}-4}dx\,=\,\frac {\ln|2-2^x|}{4\ln2}-\frac {\ln|2+2^x|}{4\ln2}+C$$ What am I doing wrong? I know I should be able to get back to the original integrand by taking the derivative of my result but then if I make the same mistake in both directions won't this cause me to miss the correct result anyway? Thanks for the help!

Your first step is wrong. Note that

$$2^{2x}\ne4\times2^x$$

instead, $2^{2x}=(2^x)^2$, so by letting $2^x=u$, we get

$$I=\frac1{\ln2}\int\frac1{u^2-4}\ du$$

And by PFD,

$$\frac1{u^2-4}=\frac14\left(\frac1{u-2}-\frac1{u+2}\right)$$

Thus,

$$I=\frac1{4\ln2}\left(\ln|u-2|-\ln|u+2|\right)=\frac1{4\ln2}\left(\ln|2-2^x|-\ln|2+2^x|\right)$$

as expected.

There's a problem with your first step: $4\cdot (2^x-1)=2^{x+2}-4$, which is not the same thing as $2^{2x}-4$.

Instead, since $2^{2x}=(2^x)^2$ and $\frac{d}{dx}2^x=\ln(2)2^x$, I suggest trying a substitution with $u=2^x$ and then using partial fractions.