First we need the following lemma
Lemma (Best approximation by orthogonal projection)
Let \(H\) be an inner product space, let \(W\) be a finite-dimensional subspace of \(H\), and let \(x \in H\). Then
\[
\left\|x-\operatorname{proj}_W(x)\right\|
\leq \|x-w\|
\qquad\text{for every }w\in W.
\]
Proof. Let \(w\in W\). Write
$$
\begin{align*}
x-w &= x (-\operatorname{proj}_W(x) +\operatorname{proj}_W(x))-w \\
&= (x -\operatorname{proj}_W(x)) + (\operatorname{proj}_W(x)-w) \tag{1}
\end{align*}
$$
Now observe that \(x - \operatorname{proj}_W(x)\) is in \(W^{\perp}\). To see this, let \(\{u_1,\dots,u_k\}\) be an orthonormal basis of \(W\). Then
$$
\begin{align*}
\operatorname{proj}_W(x)=\sum_{i=1}^k\langle x,u_i\rangle u_i.
\end{align*}
$$
For each basis vector \(u_j\),
$$
\begin{align*}
\left\langle x-\operatorname{proj}_W(x),u_j\right\rangle
=\langle x,u_j\rangle
-\sum_{i=1}^k\langle x,u_i\rangle\langle u_i,u_j\rangle
=\langle x,u_j\rangle-\langle x,u_j\rangle=0.
\end{align*}
$$
Since every vector in \(W\) is a linear combination of these basis vectors, \(x-\operatorname{proj}_W(x)\) is orthogonal to every vector in \(W\). By definition, this means.
$$
\begin{align*}
x-\operatorname{proj}_W(x)\in W^\perp
\end{align*}
$$
Next, since \(\operatorname{proj}_W(x) \in W\) and \(w \in W\), then \(\operatorname{proj}_W(x)-w \in W\). Hence the two vectors in (1) are orthogonal and we can apply the Pythagorean theorem to obtain
$$
\begin{align*}
\|x-w\|^2
&=\left\|x-\operatorname{proj}_W(x)\right\|^2
+\left\|\operatorname{proj}_W(x)-w\right\|^2\\
&\geq\left\|x-\operatorname{proj}_W(x)\right\|^2.
\end{align*}
$$
Taking square roots gives
$$
\begin{align*}
\left\|x-\operatorname{proj}_W(x)\right\|\leq\|x-w\|,
\end{align*}
$$
Next, we study the main result:
Theorem 0.5 (Parseval for Continuous Functions)
Let \(f\) be a continuous \(2\pi\)-periodic function. Then
\[
\lim_{N\to\infty}
\int_0^{2\pi} |f(x)-S_Nf(x)|^2\,dx = 0,
\]
and
\[
\sum_{n=-\infty}^{\infty} |\widehat{f}(n)|^2
= \|f\|^2.
\]
Proof.
We use the normalized norm
$$
\begin{align*}
\|g\|_2^2=\frac{1}{2\pi}\int_0^{2\pi}|g(x)|^2\,dx.
\end{align*}
$$
Recall from chapter two that the Fejér kernels \(\{ F_N \}\) form a family of good kernel. If we write \(\sigma_N f=F_N*f\). If we are additionally given a periodic continuous function, then Fejér’s theorem gives uniform convergence \(\sigma_N f\to f\). Moreover Corollary 5.4 says
Corollary 5.4: Continuous functions on the circle can be uniformly approximated by trigonometric polynomials.
This is true because \(\sigma_N f\) is a trigonometric polynomial itself since it is a finite sum:
$$
\begin{align*}
\sigma_N f(x)=\sum_{n=-N}^{N}
\left(1-\frac{|n|}{N}\right)\widehat f(n)e^{inx}.
\end{align*}
$$
Uniform convergence means that for every \(\epsilon>0\), choosing \(N\) sufficiently large gives
$$
\begin{align*}
\sup_x|f(x)-\sigma_N f(x)|<\epsilon.
\end{align*}
$$
So \(\sigma_N f\) itself is the trigonometric polynomial promised by Corollary 5.4. Since \(\sigma_N f\) contains frequencies with \(|n|\le N\), it is a trigonometric polynomial of degree at most \(N\). Since \(\sigma_N f\) has degree at most \(N\), it belongs to
$$
\begin{align*}
W_N=\operatorname{span}\{e^{inx}:-N\le n\le N\}.
\end{align*}
$$
Recall that \(S_Nf\) is the orthogonal projection of \(f\) onto \(W_N\). Hence by the lemma above, it is the closest element of \(W_N\) to \(f\) in the \(L^2\) norm. Therefore,
$$
\begin{align*}
\boxed{\|f-S_Nf\|_2\le \|f-\sigma_Nf\|_2.}
\end{align*}
$$
Uniform convergence implies \(L^2\) convergence here:
$$
\begin{align*}
\|f-\sigma_Nf\|_2\le \|f-\sigma_Nf\|_\infty\longrightarrow0.
\end{align*}
$$
Hence
$$
\begin{align*}
0\le \|f-S_Nf\|_2\le \|f-\sigma_Nf\|_2\longrightarrow0.
\end{align*}
$$
So the Fourier partial sums \(S_Nf\) converge to \(f\) in \(L^2\). Consequently,
$$
\begin{align*}
\int_0^{2\pi}|f(x)-S_Nf(x)|^2\,dx
=2\pi\|f-S_Nf\|_2^2\longrightarrow0,
\end{align*}
$$
which proves the first conclusion. Next, we use Lemma 0.3:
$$
\begin{align*}
\|f\|_2^2
=
\|f-S_Nf\|_2^2
+\sum_{n=-N}^{N}|\widehat f(n)|^2.
\end{align*}
$$
Since we just showed \(\|f-S_Nf\|_2\to0\), taking \(N\to\infty\) gives
$$
\begin{align*}
\boxed{\|f\|_2^2=\sum_{n\in\mathbb Z}|\widehat f(n)|^2.}
\end{align*}
$$
References
- SFSU Fourier Analysis by Professor Chun-Kit Lai
- Fourier Analysis: An Introduction by Elias M.Stein and Rami Shakarchi