I am interested in the following sum
$$\sum_{\text{even } n=-\infty}^{\infty}\left(-\cos^2x\delta_{n,0}+\cos x\left(\frac{1-\cos x}{\sin x}\right)^{|n|}\right).$$
Wolfram alpha returns answer $\sin^2x$ which does not make any sense to me as the function clearly goes to 0 at $x=\pi/2$. Am I missing something?
Here is what I did: $$\sum_{n=0}^\infty\cos x\left(\frac{1-\cos x}{\sin x}\right)^{2n}=\sum_{n=0}^\infty\cos x\left[\tan^2\left(\frac{x}{2}\right)\right]^n=\cos x\frac{1}{1-\tan^2\left(\frac{x}{2}\right)}=\cos^2\left(\frac{x}{2}\right).$$ The problem is that the above is legal only for $\tan^2\left(\frac{x}{2}\right)<1$ which necessarily means for $x<\pi/2$. The question is then how do you then reconcile that the series sums to 0 at $x=\pi/2$ while it sums to $1$ at $x=\pi/2^{-}$?
Let a sequence of continuous functions, $f_n(x)$, be defined by
$$f_n(x)=\begin{cases}\cos(x) \left(\frac{1-\cos(x)}{\sin(x)}\right)^{2n}&,0\le|x|<\pi/2\\\\0&,x=\pi/2\end{cases}$$
Then, the sum $\sum_{n=0}^Nf_n(x)$ can be written
$$\begin{align} \sum_{n=0}^N f_n(x)&=\sum_{n=0}^N \cos(x) \tan^{2n}(x/2)\,\,\,\,\,\,\,,0\le |x|\le\pi/2\\\\ &=\begin{cases} \cos(x)\frac{1-\tan^{2N+2}(x/2)}{1-\tan^2(x/2)}&,0\le |x|<\pi/2 \tag 1\\\\ 0&,x=\pi/2 \end{cases} \end{align}$$
Using $\frac{\cos(x)}{1-\tan^2(x/2)}=\cos^2(x/2)$ for $0\le |x|<\pi/2$ and taking the limit of $(1)$ as $N\to \infty$ yields
$$\sum_{n=0}^\infty f_n(x)=\begin{cases}\cos^2(x/2)&,0\le |x|<\pi/2 \\\\ 0&,x=\pi/2\end{cases} $$
which is discontinuous at $x=\pi/2$.