Asymptotic Expansion of Digamma Function While reading the wikipedia page of the Digamma function (https://en.wikipedia.org/wiki/Digamma_function#Asymptotic_expansion)
I noticed that it said the asymptotic expansion for the digamma function ($\psi(z)$) can be obtained from using
\begin{equation} \psi(z+1) = -\gamma + \sum_{n=1}^{\infty} (\frac{1}{n} - \frac{1}{n+z}) \end{equation} (where $\gamma$ is the Euler–Mascheroni constant) combined with Euler–Maclaurin formula to conclude
\begin{equation} \psi(z) \approx \log(z) - \frac{1}{2z} \end{equation}   My main confusion about this is that when I tried to use the Euler–Maclaurin formula to approximate the sum as an integral, I could not figure out how to obtain a $\gamma$ to cancel out the $\gamma$ term in the series expansion. Any  help on how to obtain the above relationship using the formula or just where the $\gamma$ comes from when I apply the Euler-Maclaurian formula would be greatly appreciated!

I shall assume that $|\arg (z+1)|<\pi$. By the Euler–Maclaurin formula,
\begin{align*}
\psi (z + 1) = &  - \gamma  + \int_1^{ + \infty } {\left( {\frac{1}{t} - \frac{1}{{t + z}}} \right)dt}  + \frac{1}{2}\left( {1 - \frac{1}{{1 + z}}} \right) \\ & + \int_1^{ + \infty } {\left( {\left\{ {1 - t} \right\} - \frac{1}{2}} \right)\left( {\frac{1}{{t^2 }} - \frac{1}{{(t + z)^2 }}} \right)dt} 
\\  = & \; \log (z + 1) - \gamma  + \int_1^{ + \infty } {\frac{{\left\{ {1 - t} \right\}}}{{t^2 }}dt}  - \frac{1}{{2(z + 1)}} - \int_1^{ + \infty } {\frac{{\left\{ {1 - t} \right\} - \frac{1}{2}}}{{(t + z)^2 }}dt}.
\end{align*}
Thus, it remains to show that
$$
\int_1^{ + \infty } {\frac{{\left\{ {1 - t} \right\}}}{{t^2 }}dt}  = \gamma 
$$
and
$$
\int_1^{ + \infty } {\frac{{\left\{ {1 - t} \right\} - \frac{1}{2}}}{{(t + z)^2 }}dt}  = \mathcal{O}\!\left( {\frac{1}{{(z + 1)^2 }}} \right).
$$
The first one can be shown as follows:
\begin{align*}
\int_1^{ + \infty } {\frac{{\left\{ {1 - t} \right\}}}{{t^2 }}dt} & =\sum\limits_{k = 1}^\infty  {\int_k^{k + 1} {\frac{{\left\{ {1 - t} \right\}}}{{t^2 }}dt} }  = \sum\limits_{k = 1}^\infty  {\int_0^1 {\frac{{1 - t}}{{(k + t)^2 }}dt} } \\ & = \sum\limits_{k = 1}^\infty  {\left[ {\frac{1}{k} - \log \left( {1 + \frac{1}{k}} \right)} \right]}  = \mathop {\lim }\limits_{n \to  + \infty } \sum\limits_{k = 1}^n {\left[ {\frac{1}{k} - \log \left( {1 + \frac{1}{k}} \right)} \right]} 
\\ &
 = \mathop {\lim }\limits_{n \to  + \infty } \left(\sum\limits_{k = 1}^n {\frac{1}{k}}  - \log (n + 1) \right)= \gamma .
\end{align*}
For the second claim, we use integration by parts and some estimations to obtain
\begin{align*}
& \left| {\int_1^{ + \infty } {\frac{{\left\{ {1 - t} \right\} - \frac{1}{2}}}{{(t + z)^2 }}dt} } \right| = \left| {\int_1^{ + \infty } {\frac{{\left\{ t \right\} - \left\{ t \right\}^2 }}{{(t + z)^3 }}dt} } \right| \\ & \le \frac{1}{4}\int_1^{ + \infty } {\frac{1}{{\left| {t + z} \right|^3 }}dt}  = \frac{1}{4}\int_0^{ + \infty } {\frac{1}{{\left| {t + (z + 1)} \right|^3 }}dt} 
\\ &
 \le \frac{1}{4}\int_0^{ + \infty } {\frac{1}{{(t + \left| {z + 1} \right|)^3 }}dt} \sec ^3 \left( {\frac{{\arg (z + 1)}}{2}} \right) = \frac{1}{{8\left| {z + 1} \right|^2 }}\sec ^3 \left( {\frac{{\arg (z + 1)}}{2}} \right).
\end{align*}
In summary, replacing $z+1$ by $z$,
$$
\psi (z) = \log z - \frac{1}{{2z}} + R(z)
$$
where
$$
\left| {R(z)} \right| \le \frac{1}{{8\left| z \right|^2 }}\sec ^3 \left( {\frac{{\arg z}}{2}} \right)
$$
and $|\arg z|<\pi$. With more careful considerations, the constant $\frac{1}{8}$ can be replaced by $\frac{1}{12}$.
