Does $\tan (x)$ equal $\frac{-1}{x-\frac{\pi}{2}}+\frac{-1}{x+\frac{\pi}{2}}+\frac{-1}{x-\frac{3\pi}{2}}+\frac{-1}{x+\frac{3\pi}{2}}+...$? I set my Year 12 students a question involving the sums of rational functions $\frac{1}{x-n}$. The graph of a sum of these functions looks an awful lot like a tan graph. This led me to ask:
Does $\tan (x)$ equal $\frac{-1}{x-\frac{\pi}{2}}+\frac{-1}{x+\frac{\pi}{2}}+\frac{-1}{x-\frac{3\pi}{2}}+\frac{-1}{x+\frac{3\pi}{2}}+...$?
I've played with it a little. I can show that the derivative of the right hand side is $1$ at $x=0$, which is promising. I haven't got any further.
(I am assuming convergence of the RHS...)
i. Might somebody have a delicious proof or disproof of this identity?
ii. Varying the +s and -s in the sum seems to produce graphs that look like $\sec(x)$. Is there a general method to write a function that has vertical asymptotes as a sum of such reciprocal functions?
Thanks!
 A: Recall that the infinite product representation of the cosine function is given by 
$$\cos z=\prod_{n=1}^{\infty}\left(1-\frac{z^2}{\pi^2(n-1/2)^2}\right) \tag 1$$
Now, just take the logarithmic derivative of both sides of $(1)$ and multiply by $-1$ to expose that 
$$\bbox[5px,border:2px solid #C0A000]{\tan z=\sum_{n=1}^{\infty}\frac{-2z}{z^2-(n-1/2)^2\pi^2}} \tag 2$$

NOTE:
We can write the sum in $(2)$ as 
$$\tan z=\sum_{n=1}^{\infty}\left(\frac{-1}{z-(n-1/2)\pi}+\frac{-1}{z+(n-1/2)\pi}\right)$$
A: A small alteration to the working provided in the "Example" section of the Partial fractions in complex analysis Wikipedia page (linked to by Jyrki Lahtonen above) leads to a similar representation for $\sec x$.
The residues of $\tan z$ are calculated as follows (using L'Hopital for the limit):
$$
Res\left[\tan z ; (n+\tfrac{1}{2})\pi\right]=\lim_{z \to (n+\frac{1}{2})\pi} \left(z- (n+\tfrac{1}{2})\pi \right)\frac{\sin z}{ \cos z} = \frac{\sin \left((n+\tfrac{1}{2})\pi \right)}{ - \sin \left((n+\tfrac{1}{2})\pi \right)}=-1
$$
While the residues of $\sec z$ are:
$$
Res\left[\sec z ; (n+\tfrac{1}{2})\pi\right]=\lim_{z \to (n+\frac{1}{2})\pi} \left(z- (n+\tfrac{1}{2})\pi \right)\frac{1}{ \cos z} = \frac{1}{ - \sin \left((n+\tfrac{1}{2})\pi \right)}=(-1)^{n+1}
$$
And this little adjustment leads to:
$$
\sec z=\sum_{n=0}^{\infty}\left(\frac{(-1)^{n+1}}{z-(n+\tfrac{1}{2})\pi}+\frac{(-1)^{n}}{z+(n+\tfrac{1}{2})\pi}\right)
$$
(This has been an excellent Sunday morning, refreshing my undergrad complex analysis.)
