I am tasked to show that the following identity holds: $$\sum_{n \geq 1}\frac{1}{n^2-z} = \frac{1-\pi \sqrt{z}cot(\pi\sqrt{z})}{2z}$$ for $z \in \mathbb{C} \setminus \mathbb{N}$
This is for a class in functional analysis using Gerald Teschl's "Topics in Linear and Nonlinear Functional Analysis."
The hint is to use the trace formula:
$$\int_0^1G(z, x, x) = \sum_{j \geq 0}\frac{1}{E_j-z}$$ where $G(z, x, x)$ is the Green's function, and $E_j$ are the eigenvalues of some operator.
Unfortunately I have no experience with Green's functions and so I'm note sure how to go about constructing one for this particular problem. Any help would be appreciated.
Without using the hint.
Write $$\frac 1{n^2-z}=\frac{1}{2 \sqrt{z}}\Big[\frac{1}{n-\sqrt{z}}-\frac{1}{n+\sqrt{z}} \Big]$$ Now, using generalized harmonic numbers $$\sum_{n=1}^p \frac{1}{n-\sqrt{z}}=H_{p-\sqrt{z}}-H_{-\sqrt{z}}$$ $$\sum_{n=1}^p \frac{1}{n+\sqrt{z}}=H_{p+\sqrt{z}}-H_{\sqrt{z}}$$ $$H_{\sqrt{z}}-H_{-\sqrt{z}}=\frac{1}{\sqrt{z}}-\pi \cot \left(\pi \sqrt{z}\right)$$
For the other terms, using the asymptotics of generalized harmonic numbers $$H_{p-\sqrt{z}}-H_{p+\sqrt{z}}=-\frac{2 \sqrt{z}}{p}+\frac{\sqrt{z}}{p^2}+O\left(\frac{1}{p^3}\right)$$
$$\sum_{n=1}^p\frac 1{n^2-z}=\frac{1}{2 \sqrt{z}}\Big[\frac{1}{\sqrt{z}}-\pi \cot \left(\pi \sqrt{z}\right)-\frac{2 \sqrt{z}}{p}+O\left(\frac{1}{p^2}\right) \Big]$$ $$\sum_{n=1}^\infty\frac 1{n^2-z}=\frac{1-\pi \sqrt{z} \cot \left(\pi \sqrt{z}\right)}{2 z}$$