I am working on the improper integral:
$$\int_0^{\infty}\frac{e^{-x}-e^{-2x}}{x}dx$$
This function does not have an elementary anti-derivative, so here is what I did: define:
$$f(t):=\int_0^{\infty}\frac{e^{-xt}-e^{-2xt}}{x}dx,\quad t>0$$
Then differentiation gives:
$$f'(t)=\int_0^{\infty}\frac{-xe^{-xt}+2xe^{-2xt}}{x}dx=\int_0^{\infty}-e^{-xt}+2e^{-2xt}dx=0$$
this means $f$ is constant. I feel something is wrong here because $f$ should depend on $t$. Where am I wrong and what is the right way to do this?
Note that $$e^{-x} - e^{-2x} = x\int_{1}^{2}e^{-xt}dt$$ Hence, $$\int_0^{\infty} \dfrac{e^{-x}-e^{-2x}}xdx = \int_0^{\infty} \int_{1}^{2}e^{-xt}dtdx = \int_1^2 \int_0^{\infty}e^{-xt}dxdt = \int_1^2\dfrac{dt}t = \ln(2)$$ In general, by similar idea, we have $$\int_0^{\infty} \dfrac{e^{-ax}-e^{-bx}}xdx = \ln(b/a)$$