Identity involving partial sums of Fourier series Suppose $f$ is a continuous periodic function and $S_Nf(x) = \sum^N_{n=−N} \hat f(n) e^{inx}$, where $$\hat f(n)= \frac{1}{2\pi}\int_0^{2\pi}f(x)e^{-inx} dx.$$
How can I show that $$\sum_{j=0}^{N-1}S_jf(x)= \int_{-\pi}^{\pi} \frac{\sin^2(\frac{1}{2}Ny)}{\sin^2(\frac{1}{2}y)}f(x-y)dy?$$
Supposedly it can be done using routine trigonometric manipulation, but I don't see it right away. Thank you in advance.
 A: This relies on switching the order of summation and integration.  For one particular value of $S_k$:
$$\begin{align}S_k &= \frac{1}{2 \pi} \int_0^{2 \pi} dx' \: f(x') \sum_{n=-k}^k e^{i k (x-x')} \\ &= \frac{1}{2 \pi} \int_0^{2 \pi} dx' \: f(x') \frac{e^{i (k+1)(x-x')} - e^{-i k (x-x')}}{e^{i (x-x')} -1}\\ &= \frac{1}{2 \pi} \int_0^{2 \pi} dx' \: f(x') \frac{\sin{\left[\left(k+\frac{1}{2}\right)(x-x')\right]}}{\sin{\left[\frac{1}{2}(x-x')\right]}} \end{align}$$
Now we want to evaluate a sum over $k$ of $S_k$:
$$\begin{align}\sum_{k=0}^{N-1} S_k &= \frac{1}{2 \pi} \int_0^{2 \pi} dx' \: f(x') \frac{1}{\sin{\left[\frac{1}{2}(x-x')\right]}}\sum_{k=0}^{N-1}\sin{\left[\left(k+\frac{1}{2}\right)(x-x')\right]}\end{align}$$
Now
$$\begin{align}\sum_{k=0}^{N-1}\sin{\left[\left(k+\frac{1}{2}\right)(x-x')\right]}&= \Im{\left[\sum_{k=0}^{N-1}e^{i\left[\left(k+\frac{1}{2}\right)(x-x')\right]}\right]} \\ &= \Im{\left[e^{i\left[\frac{1}{2}(x-x')\right]} \sum_{k=0}^{N-1}e^{i\left[k(x-x')\right]}\right]}\\ &=\Im{\left[e^{i\left[\frac{1}{2}(x-x')\right]}\frac{e^{i N (x-x')}-1}{e^{i(x-x')}-1}\right]}\\ &= \Im{\left[e^{i N (x-x')/2} \frac{\sin{[N (x-x')/2]}}{\sin{[(x-x')/2}]} \right]} \\ &= \frac{\sin^2{[N (x-x')/2]}}{\sin{[(x-x')/2}]}\end{align}$$
Therefore
$$\sum_{k=0}^{N-1} S_k = \frac{1}{2 \pi} \int_0^{2 \pi} dx' \: f(x') \frac{\sin^2{[N (x-x')/2]}}{\sin^2{[(x-x')/2}]}$$
The stated result follows, save for the factor of $2 \pi$.
A: The following identity is known as the Fejér kernel and is itself a sum of Dirichlet kernels (for derivations see this thread Why is the Fejér Kernel always non-negative?):
$$\frac{1}{N} \frac{\sin^2(\frac{1}{2}Ny)}{\sin^2(\frac{1}{2}y)}=\frac{1}{N}\sum^{N-1}_{j=0}\sum_{n=-j}^j e^{i n y}$$
Stick that in and change variable to $u=x-y$: 
\begin{aligned}
\int_{-\pi}^{\pi} \frac{\sin^2(\frac{1}{2}Ny)}{\sin^2(\frac{1}{2}y)}f(x-y)dy
&=\frac{1}{2\pi}\int_{-\pi}^{\pi}\sum^{N-1}_{j=0}\sum_{n=-j}^n e^{i n y}f(x-y)dy\\
&=\sum^{N-1}_{n=0}\sum_{j=-n}^ne^{i n x}\frac{1}{2\pi}\int_{-\pi+x}^{\pi+x} e^{-i n u}f(u)du\\
&=\sum^{N-1}_{j=0}\sum_{n=-j}^je^{i n x}\frac{1}{2\pi}\int_{-\pi}^{\pi} e^{-i n u}f(u)du\\
&=\sum^{N-1}_{j=0}\sum_{n=-j}^je^{i n x}\hat f(n)\\
&=\sum^{N-1}_{j=0}S_{j}f(x)
\end{aligned}
where the $2\pi$ periodicity of the integrand was used to drop $x$ from the limits.
