I've been studying the digamma function lately and I often see it defined as the following:
$$ \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)} $$ or
$$ \psi(x) = \int_0^\infty \frac{e^{-t}}{t} - \frac{e^{-xt}}{1-e^{-t}} dt $$
I've seen this shown but rarely justified how these expressions are the same. Perhaps I don't have the tools to recognize it, but it is not immediately obvious to me. I'd like a proof laid out. Showing why these are equivalent.
I understand the identity $\psi(x) = -\gamma+\sum_{n=0}^{\infty}\frac{1}{n+1}-\frac{1}{n+x} $ comes from differentiating $\ln(\Gamma(x))$ and using the Weierstrass product formula for $\Gamma$ as explained in this post here (for those like me learning from the bottom up I found this PDF which explains the product formula; also $\gamma$ is the Euler-Mascheroni constant). I also accept $\Gamma'(1)=-\gamma$ (some good proofs in this post).
Now I tried first to split the integral into two:
$$ \int_0^\infty \frac{e^{-t}}{t} - \frac{e^{-xt}}{1-e^{-t}} dt = \int_0^\infty \frac{e^{-t}}{t} - \frac{e^{-t}}{1-e^{-t}} dt +\int_0^\infty \frac{e^{-t}}{1-e^{-t}} - \frac{e^{-xt}}{1-e^{-t}} dt $$
For $0<t<\infty$ then $0<e^{-t}<1$ thus it follows that
$$ \int_0^\infty \frac{e^{-t}}{1-e^{-t}} - \frac{e^{-xt}}{1-e^{-t}} dt=\sum_{n=0}^{\infty}\int_0^\infty e^{-(n+1)t}-e^{-(n+x)t}dt = $$
$$ \sum_{n=0}^{\infty} \frac{1}{n+1} - \frac{1}{n+x} $$
Now clearly last integral should be $-\gamma$ and we're done. However I can't satisfactorily do this. I suspect it's because I'm not being rigorous enough somewhere or I've been thinking about it too much and can't see an obvious mistake. To start, I split the integral in two and use integration by parts $u=e^{-t}$ and $dv=\frac{1}{t}dt$.
$$ \int_0^\infty \frac{e^{-t}}{t} - \frac{e^{-t}}{1-e^{-t}} dt = \int_0^\infty \frac{e^{-t}}{t} dt - \int_0^\infty \frac{e^{-t}}{1-e^{-t}} dt = $$
$$ \ln(t)e^{-t}|_{0}^\infty+\int_0^\infty \ln(t)e^{-t}dt-\sum_{n=0}^{\infty} \frac{1}{n+1}=\lim_{a\to0}-\ln(a)-\sum_{n=1}^{\infty} \frac{1}{n}+\Gamma'(1) $$
Here I had two thoughts a) the limit goes to $\infty$ and the harmonic series does the same so we can say they cancel each other out. This is too much hand waving for my liking, but b) was that $\lim_{a\to0}-\ln(a)=\lim_{a\to0}\ln(\frac{1}{a})=\lim_{n\to\infty}\ln(n)$ and hence we have
$$ \lim_{a\to0}\ln(a) - \sum_{n=1}^{\infty} \frac{1}{n} = \lim_{n\to\infty}\ln(n) - \sum_{k=1}^n \frac{1}{k} \equiv -\gamma $$
$$ \therefore \int_0^\infty \frac{e^{-t}}{t} - \frac{e^{-t}}{1-e^{-t}} dt = -2\gamma $$
This second approach seems less dodgy to me but is wrong.
Could someone point out my error in this method, or give an alternative proof using Calc II techniques? Please justify any identities for $\Gamma$, $\psi$, or $\gamma$ not used here or provide a link to a source which does.