Take a function \(f(x)\) on \([-\pi,\pi]\) and represent it using sines and cosines:
$$
\begin{align*}
f(x) \sim a_0 + \sum_{n=1}^{\infty} \left(a_n\cos(nx)+b_n\sin(nx)\right).
\end{align*}
$$
Basically, given a function \(f(x)\), we want to construct it out of simpler functions:
$$
\begin{align*}
\cos x,\quad \sin x,\quad \cos(2x),\quad \sin(2x),\quad \ldots
\end{align*}
$$
Each of these has a different frequency. For example, \(\sin x\) makes one full
oscillation as \(x\) goes from \(-\pi\) to \(\pi\), while \(\sin(2x)\) makes two
oscillations. Thus, we try an expansion of the form
$$
\begin{align*}
f(x) \approx a_0+a_1\cos x+b_1\sin x
+a_2\cos(2x)+b_2\sin(2x)+\cdots.
\end{align*}
$$
The coefficients \(a_1,b_1,a_2,b_2,\ldots\) tell us how much of each frequency we need. But why use both cosine and sine? The functions \(\cos(nx)\) and \(\sin(nx)\) together form a basis for sinusoidal waves of frequency \(n\). Hence, given a periodic function \(f(x)\), we want to write it in terms of
$$
\begin{align*}
\sin(nx),\quad \cos(nx),\qquad n=1,2,3,\ldots,
\end{align*}
$$
which form an infinite basis. At this point, we still have a lot of questions. Does the sum converge? under what conditions if so? How do we extract the coefficients if we can do this? and so on.
Extracting the Fourier coefficients
Suppose we already know that \(f\) really can be represented using sines and cosine functions. How can we extract the coefficients? The sine and cosine functions are orthogonal on \([-\pi,\pi]\). In particular, for positive integers \(m\) and \(n\),
$$
\begin{align*}
\int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx =
\begin{cases}
\pi,&m=n,\\
0,&m\ne n,
\end{cases}
\end{align*}
$$
and
$$
\begin{align*}
\int_{-\pi}^{\pi}\sin(nx)\sin(mx)\,dx =
\begin{cases}
\pi,&m=n,\\
0,&m\ne n.
\end{cases}
\end{align*}
$$
Also,
$$
\begin{align*}
\int_{-\pi}^{\pi}\sin(nx)\cos(mx)\,dx=0.
\end{align*}
$$
Why? Recall that
\[
\cos A\cos B = \frac12\bigl(\cos(A-B)+\cos(A+B)\bigr)
\]
Set \(A=nx\) and \(B=mx\). Then
\[
\cos(nx)\cos(mx) = \frac12\left[ \cos((n-m)x)+\cos((n+m)x) \right].
\]
There are two cases.
Case 1: \(m\neq n\). Then \(n-m\) and \(n+m\) are nonzero integers. For any nonzero integer \(k\),
\[
\int_{-\pi}^{\pi}\cos(kx)\,dx = \left[\frac{\sin(kx)}{k}\right]_{-\pi}^{\pi} = \frac{\sin(k\pi)-\sin(-k\pi)}{k}=0,
\]
Substituting this back:
\[
\begin{aligned}
\int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx
&=\frac12\int_{-\pi}^{\pi}\cos((n-m)x)\,dx + \frac12\int_{-\pi}^{\pi}\cos((n+m)x)\,dx\\
&=\frac12(0)+\frac12(0)=0,
\end{aligned}
\]
because \(\sin(k\pi)=0\). Therefore,
\[
\int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx=0 \qquad (m\neq n).
\]
Case 2: \(m=n\)
Now the integral becomes
\[
\int_{-\pi}^{\pi}\cos^2(nx)\,dx = \int_{-\pi}^{\pi} \frac{1+\cos(2nx)}{2},
\]
Hence
\[
\begin{aligned}
\int_{-\pi}^{\pi}\cos^2(nx)\,dx &= \frac12\int_{-\pi}^{\pi}1\,dx +\frac12\int_{-\pi}^{\pi}\cos(2nx)\,dx\\
&=\frac12(2\pi)+0 =\pi.
\end{aligned}
\]
Therefore,
\[
\int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx =\begin{cases} \pi,&m=n,\\ 0,&m\neq n.\end{cases}
\]
These identities allow us to isolate each Fourier coefficient. So if we start with
$$
\begin{align*}
f(x)\sim a_0+\sum_{n=1}^{\infty}
\left(a_n\cos(nx)+b_n\sin(nx)\right).
\end{align*}
$$
Choose one particular coefficient, say \(a_m\), where \(m\geq1\). We use \(\cos(mx)\) to “select” that coefficient. Multiply both sides by \(\cos(mx)\):
$$
\begin{align*}
f(x)\cos(mx) \sim a_0\cos(mx) + \sum_{n=1}^{\infty} \left[ a_n\cos(nx)\cos(mx) + b_n\sin(nx)\cos(mx)
\right].
\end{align*}
$$
Assuming we are allowed to interchange the limit/sum with the integral, then integrate from \(-\pi\) to \(\pi\) and swap the sum with integral to get
$$
\begin{align*}
\int_{-\pi}^{\pi}f(x)\cos(mx)\,dx
&=
a_0\int_{-\pi}^{\pi}\cos(mx)\,dx\\
&\quad+
\sum_{n=1}^{\infty}a_n
\int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx\\
&\quad+
\sum_{n=1}^{\infty}b_n
\int_{-\pi}^{\pi}\sin(nx)\cos(mx)\,dx.
\end{align*}
$$
Apply the three orthogonality identities: The constant term vanishes:
$$
\begin{align*}
\int_{-\pi}^{\pi}\cos(mx)\,dx=0.
\end{align*}
$$
Every sine term vanishes:
$$
\begin{align*}
\int_{-\pi}^{\pi}\sin(nx)\cos(mx)\,dx=0.
\end{align*}
$$
Every cosine term vanishes except when \(n=m\):
$$
\begin{align*}
\int_{-\pi}^{\pi}\cos(nx)\cos(mx)\,dx =\begin{cases} \pi,&m=n,\\ 0,&m\neq n.\end{cases}
\end{align*}
$$
Therefore, the entire right side reduces to \(\pi a_m\). Hence,
$$
\begin{align*}
\int_{-\pi}^{\pi}f(x)\cos(mx)\,dx=\pi a_m,
\end{align*}
$$
so
$$
\begin{align*}
a_m=\frac1\pi\int_{-\pi}^{\pi}f(x)\cos(mx)\,dx.
\end{align*}
$$
Because \(m\) represents any positive integer, we rename it \(n\):
$$
\begin{align*}
\boxed{
a_n=\frac1\pi\int_{-\pi}^{\pi}f(x)\cos(nx)\,dx
}
\end{align*}
$$
Similarly, we can get the \(b_n\) coefficient using:
$$
\begin{align*}
\boxed{
b_n=\frac1\pi\int_{-\pi}^{\pi}f(x)\sin(nx)\,dx
}
\end{align*}
$$
and finally
$$
\begin{align*}
\boxed{
a_0=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)\,dx
}
\end{align*}
$$
Does the Fourier Series Converge?
Because the Fourier series is an infinite sum, we must determine whether it
converges. To do this, define the \(N\)th partial sum by
$$
\begin{align*}
S_N(x)
=a_0+\sum_{n=1}^{N}
\left(a_n\cos(nx)+b_n\sin(nx)\right).
\end{align*}
$$
For example,
$$
\begin{align*}
S_1(x)=a_0+a_1\cos x+b_1\sin x,
\end{align*}
$$
and so on. Therefore, \(S_1(x),S_2(x),S_3(x),\ldots\) is a sequence of functions. So the question now becomes whether this sequence of functions converges. In other words, does the following hold?
$$
\begin{align*}
\boxed{\lim_{N\to\infty}S_N(x)=f(x)}.
\end{align*}
$$
The first question to ask is whether the sequence \(S_1(x),S_2(x),\ldots\) converge pointwise to \(f(x)\)? Recall that Pointwise convergence means that, for each fixed \(x\), the numerical sequence \(S_1(x),S_2(x),S_3(x),\ldots\) converges to \(f(x)\). For example, when \(x=1\), we ask whether
$$
\begin{align*}
S_1(1),S_2(1),S_3(1),\ldots
\end{align*}
$$
converges to \(f(1)\). In epsilon notation, this means that for every
\(\varepsilon>0\), there exists \(N_0\) such that for all \(N\geq N_0\),
$$
\begin{align*}
\left|S_N(1)-f(1)\right|<\varepsilon.
\end{align*}
$$
Repeating this condition for every \(x\), we say that \(S_N\) converges pointwise
to \(f\) if
$$
\begin{align*}
\forall x\in[-\pi,\pi],\ \forall\varepsilon>0,\ \exists N_0=N_0(x,\varepsilon)
\text{ such that }N\geq N_0
\implies \left|S_N(x)-f(x)\right|<\varepsilon.
\end{align*}
$$
Thus, for pointwise convergence, \(N_0\) may depend on both \(x\) and \(\varepsilon\).
Complex Formulation
Recall that
$$
\begin{align*}
e^{i\theta}=\cos\theta+i\sin\theta,
\end{align*}
$$
Now replace \(\theta\) by \(nx\) to get
$$
\begin{align*}
e^{inx}=\cos(nx)+i\sin(nx).
\end{align*}
$$
Similarly, we can also replace \(\theta\) by \(-nx\):
$$
\begin{align*}
e^{-inx} = \cos(-nx)+i\sin(-nx).
\end{align*}
$$
Recall that cosine is even and sine is odd:
$$
\begin{align*}
\cos(-nx)=\cos(nx),
\qquad
\sin(-nx)=-\sin(nx).
\end{align*}
$$
Therefore,
$$
\begin{align*}
e^{-inx}=\cos(nx)-i\sin(nx).
\end{align*}
$$
So now we have these two equations:
$$
\begin{align*}
e^{inx} &= \cos(nx) + i\sin(nx), \tag{1}\\
e^{-inx} &= \cos(nx) - i\sin(nx) \tag{2}
\end{align*}
$$
Now consider a single term from the Fourier sum \(a_n\cos(nx)+b_n\sin(nx).\) Using the formulas we just found (1) and (2),
$$
\begin{align*}
\cos(nx) &= e^{inx} - i\sin(nx) \\
\cos(nx) &= e^{inx} + e^{-inx} - \cos(nx)\\
\cos(nx) &= \frac{e^{inx}+e^{-inx}}{2}. \tag{3}
\end{align*}
$$
Similarly, we can find that
$$
\begin{align*}
\sin(nx)=\frac{e^{inx}-e^{-inx}}{2i}. \tag{4}
\end{align*}
$$
If we substitute them in, then
$$
\begin{align*}
a_n\cos(nx)+b_n\sin(nx) &= a_n\left(\frac{e^{inx}+e^{-inx}}{2}\right) + b_n\left(\frac{e^{inx}-e^{-inx}}{2i}\right) \\
&= \frac{a_n}{2}e^{inx} + \frac{a_n}{2}e^{-inx} + \frac{b_n}{2i}e^{inx} - \frac{b_n}{2i}e^{-inx} \\
&= \left(\frac{a_n}{2}+\frac{b_n}{2i}\right)e^{inx} + \left(\frac{a_n}{2}-\frac{b_n}{2i}\right)e^{-inx}
\end{align*}
$$
Now let
$$
\begin{align*}
\boxed{
c_n=\frac{a_n}{2}+\frac{b_n}{2i},
\qquad
c_{-n}=\frac{a_n}{2}-\frac{b_n}{2i},
\qquad
c_0=a_0 \tag{5}
}
\end{align*}
$$
Hence the \(n\)th term becomes
$$
\begin{align*}
a_n\cos(nx)+b_n\sin(nx) &= c_n e^{inx}+c_{-n}e^{-inx}.
\end{align*}
$$
If we do this for every \(n=1,\dots,N\), then
$$
\begin{align*}
a_0+\sum_{n=1}^N\left(a_n\cos(nx)+b_n\sin(nx)\right) = c_0+\sum_{n=1}^N c_n e^{inx}+\sum_{n=1}^N c_{-n}e^{-inx}.
\end{align*}
$$
Now notice the second sum is really using the negative indices \(-1,-2,\dots,-N\). Hence we can combine everything in one sum as follows
$$
\begin{align*}
\boxed{a_0+\sum_{n=1}^N\left(a_n\cos(nx)+b_n\sin(nx)\right) = \sum_{n=-N}^{N} c_n e^{inx}}
\end{align*}
$$
Does the Sum Converge?
So now we go back to the main question using the new formulation. Given a sequence \(\{c_n\}_{n\in\mathbb Z}\)
$$
\begin{align*}
f_N(x)=\sum_{n=-N}^{N} c_n e^{inx}.
\end{align*}
$$
Question 1: Will the function converge to some function \(f(x)\)?
and
Question 2: If it converges to some function \(f(x)\), will \(f\) be continuous?
Is Question 2 an issue? Because every individual \(f_N\) is continuous and each \(e^{inx}\) is continuous. Moreover, \(f_N\) is only a finite sum of them. So \(f_N\) is continuous for every \(N\). However, recall that a pointwise limit of continuous functions does not have to be continuous. We will come back to this later
Extracting the Fourier Coefficients (version 2)
Next, we have the question
Question 3: Given a reasonable function \(f\), can we find the coefficients \(c_n\) such that
\[
f(x)=\lim_{N\to\infty}\sum_{n=-N}^{N}c_ne^{inx}?
\]
We have answered this question previously using the basis made of sines and cosines. We can however answer this question again using the new formulation. This will be Proposition 0.1 in the lecture notes.
Theorem
Suppose that \(f\) is integrable and
\[
f(x)=\sum_{n=-\infty}^{\infty} c_n e^{inx},
\]
and assume that the operation \(\lim_{N\to\infty}\) and
\(\int_{-\pi}^{\pi}\) can be interchanged. Then
\[
c_n=\frac{1}{2\pi}\int_{-\pi}^{\pi}
f(x)e^{-inx}\,dx.
\]
Proof
The key observation is the orthogonality relation
$$
\begin{align*}
\frac{1}{2\pi} \int_{-\pi}^{\pi} e^{i(n-m)x}\,dx =
\begin{cases}
1, & n=m,\\
0, & n\neq m.
\end{cases}
\end{align*}
$$
since if \(n=m\), then \(e^{i(n-m)x}=e^0=1\) and hence
$$
\begin{align*}
\frac{1}{2\pi}
\int_{-\pi}^{\pi}e^{i(n-m)x}\,dx = \frac{1}{2\pi} \int_{-\pi}^{\pi}1\,dx
= \frac{1}{2\pi}(2\pi) = 1.
\end{align*}
$$
If \(n\neq m\), then
$$
\begin{align*}
\frac{1}{2\pi} \int_{-\pi}^{\pi}
e^{i(n-m)x}\,dx &= \frac{1}{2\pi} \left[ \frac{e^{i(n-m)x}}{i(n-m)} \right]_{-\pi}^{\pi} \\
&= \frac{1}{2\pi i(n-m)} \left( e^{i(n-m)\pi} - e^{-i(n-m)\pi} \right).
\end{align*}
$$
Since \(n-m\in\mathbb Z\),
$$
\begin{align*}
e^{i(n-m)\pi} = e^{-i(n-m)\pi} = (-1)^{n-m},
\end{align*}
$$
so the difference is zero. Therefore,
$$
\begin{align*}
\frac{1}{2\pi} \int_{-\pi}^{\pi} e^{i(n-m)x}\,dx=0.
\end{align*}
$$
Now fix \(m\in\mathbb Z\). Since
$$
\begin{align*}
f(x)=\sum_{n=-\infty}^{\infty}c_ne^{inx},
\end{align*}
$$
multiply both sides by \(e^{-imx}\):
$$
\begin{align*}
f(x)e^{-imx} = \sum_{n=-\infty}^{\infty} c_ne^{inx}e^{-imx} = \sum_{n=-\infty}^{\infty} c_ne^{i(n-m)x}.
\end{align*}
$$
Integrating both sides over \([-\pi,\pi]\), and using the assumption that the limit and integral may be interchanged, gives
$$
\begin{align*}
\int_{-\pi}^{\pi} f(x)e^{-imx}\,dx &= \int_{-\pi}^{\pi} \sum_{n=-\infty}^{\infty} c_ne^{i(n-m)x}\,dx\\
&= \sum_{n=-\infty}^{\infty} c_n \int_{-\pi}^{\pi} e^{i(n-m)x}\,dx.
\end{align*}
$$
By the orthogonality relation above,
$$
\begin{align*}
\int_{-\pi}^{\pi}e^{i(n-m)x}\,dx =
\begin{cases}
2\pi, & n=m,\\
0, & n\neq m.
\end{cases}
\end{align*}
$$
Thus every term in the sum vanishes except the term for which \(n=m\). Hence
$$
\begin{align*}
\int_{-\pi}^{\pi} f(x)e^{-imx}\,dx = 2\pi c_m.
\end{align*}
$$
Dividing both sides by \(2\pi\), we obtain
$$
\begin{align*}
\boxed{ c_m= \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x)e^{-imx}\,dx }
\end{align*}
$$
Since \(m\in\mathbb Z\) was arbitrary, we may rename \(m\) to \(n\) as follows
$$
\begin{align*}
\boxed{ c_n= \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x)e^{-inx}\,dx }
\end{align*}
$$
Finally, we can now define
Definition
If \(f\) is Riemann integrable, we define the sequence
\(\{\widehat{f}(n) : n \in \mathbb{Z}\}\), where
\[
\widehat{f}(n) = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(x)e^{-inx}\,dx,
\]
to be the Fourier coefficients of \(f\). The series
\[
\sum_{n=-\infty}^{\infty} \widehat{f}(n)e^{inx}
\]
is called the Fourier series of \(f\).
Converting Between Coefficients
Recall that we defined in (5)
$$
\begin{align*}
c_n=\frac{a_n}{2}+\frac{b_n}{2i},
\qquad
c_{-n}=\frac{a_n}{2}-\frac{b_n}{2i},
\qquad
c_0=a_0
\end{align*}
$$
where
$$
\begin{align*}
a_0+\sum_{n=1}^N\left(a_n\cos(nx)+b_n\sin(nx)\right) = \sum_{n=-N}^{N} c_n e^{inx}
\end{align*}
$$
But now we label them as follows:
$$
\begin{align*}
\widehat f(0)&=a_0,\\
\widehat f(n)&=\frac{a_n}{2}+\frac{b_n}{2i},\\
\widehat f(-n)&=\frac{a_n}{2}-\frac{b_n}{2i},
\qquad n>0.
\end{align*}
$$
Hence, given \(a_n\) and \(b_n\), we can easily recover \(\widehat f(n)\). Moreover, if we’re given \(\widehat f(n)\), then observe that
$$
\begin{align*}
\widehat f(n)+\widehat f(-n) = \left(\frac{a_n}{2}+\frac{b_n}{2i}\right) + \left(\frac{a_n}{2}-\frac{b_n}{2i}\right) = a_n.
\end{align*}
$$
Hence \(a_n = c_n +c_{-n}\). Moreover,
$$
\begin{align*}
\widehat f(n)-\widehat f(-n)
&=
\left(\frac{a_n}{2}+\frac{b_n}{2i}\right)
-
\left(\frac{a_n}{2}-\frac{b_n}{2i}\right)\\
&=
\frac{b_n}{i}.
\end{align*}
$$
Multiplying both sides by \(i\), we obtain
$$
\begin{align*}
\boxed{
b_n=i\left(\widehat f(n)-\widehat f(-n)\right)
=i(c_n-c_{-n}).
}
\end{align*}
$$
References
- SFSU Fourier Analysis by Professor Chun-Kit Lai
- Fourier Analysis: An Introduction by Elias M.Stein and Rami Shakarchi