Solutions to Partial Differential Equations Using Fourier Series
Definition
For the function $f \in \mathcal{L}^{2} [- \pi , \pi] $ in the Hilbert space, and for $\displaystyle a_{k} = {{1} \over {\pi}} \int_{- \pi}^{\pi} f(x) \cos kx dx$ and $\displaystyle b_{k} = {{1} \over {\pi}} \int_{- \pi}^{\pi} f(x) \sin kx dx$,
$$ f(x) \sim {{a_{0}} \over {2}} + \sum_{k=1}^{\infty} \left( a_{k} \cos kx + b_{x} \sin kx \right) $$
is called the Fourier series of $f$.
Description
Unlike the Taylor series, which approximates a function with polynomials, the Fourier series approximates it with trigonometric polynomials. This complex form of the Fourier series can be applied to a variety of functions that are difficult to approach with the conventional Taylor series, making it useful. However, there is no guarantee that the Fourier series will converge, and even if it does converge, whether it will precisely converge to $f$ is a separate issue. For undergraduate-level solutions to partial differential equations, these issues are set aside for the time being, but one should be aware of these flaws.
For convenience, from now on, we will use $=$ instead of $\sim$. Let’s take a look at why the Fourier series is defined in such a form. Since $\mathcal{L}^2$ is in the case where $\mathcal{L}^{p}$ to $p=2$, it is possible to define the inner product and norm for $f,g : [-\pi, \pi] \to \mathbb{R}$ as follows.
$$ \left< f, g \right> := {{1} \over{\pi}} \int_{-\pi}^{\pi} f(x) g(x) dx \left\| f \right\| : = \left< f, f \right> := \sqrt{ {{1} \over{\pi}} \int_{-\pi}^{\pi} \left| f(x) \right| ^2 dx } $$
For the even function $\sin k x$ and the odd function $\cos k x$, there is $\displaystyle \left< \cos kx , \cos lx \right> = \left< \sin kx , \cos lx \right> = 0$ for $k \ne l$. Of course, $\displaystyle \left< \cos lx , \sin lx \right> = \left< \sin lx , \cos lx \right> = 0$ also holds for $k = l$. The only case where $0$ does not occur in the inner product of trigonometric functions is $\displaystyle \left< \cos lx , \cos lx \right> \ne 0 \ne \left< \sin lx , \sin lx \right>$.
By using the above facts, calculating $\left< f, \cos lx \right> f$, we obtain
$$ \left< f, \cos lx \right> = {{a_{0}} \over {2}} \left< 1 , \cos lx \right> + \sum_{k=1}^{\infty} \left( a_{k} \left< \cos kx , \cos lx \right> + b_{x} \left< \sin kx , \cos lx \right> \right) = a_{l} $$
Similarly, we can obtain $\left< f , \sin lx \right> = b_{l}$, and
$$ \left< f , 1 \right> = {{a_{0}} \over {2}} \left< 1, 1 \right> = {{a_{0}} \over {2}} \left\| 1 \right\| ^2 = {{a_{0}} \over {2}} $$
it is.
Approximating $f$ with trigonometric polynomials means projecting $f$ into the vector space of trigonometric functions. From the perspective of linear algebra, thinking about each term means that it looks like either $\left< f(x) , \cos nx \right> \cos nx$ or $\left< f(x) , \sin nx \right> \sin nx$, which can be seen as projecting the function $f$ onto the basis $\left\{ \cos nx , \sin nx \ | \ n \in \mathbb{N} \right\}$.
Using the properties of odd and even functions, not only this but also the following formula can significantly reduce calculations.
If $f \in \mathcal{L}^{2} [-\pi , \pi ]$ is an odd function, for $\displaystyle a_{k} = {{2} \over {\pi}} \int_{0} \pi f(x) \cos kx dx$
$$ f(x) \sim {{a_{0 } } \over {2 }} + \sum_{k=1}^{\infty} a_{k} \cos kx $$
If $f \in \mathcal{L}^{2} [-\pi , \pi ]$ is an even function, for $\displaystyle b_{k} = {{2} \over {\pi}} \int_{0} \pi f(x) \sin kx dx$
$$ f(x) \sim \sum_{k=1}^{\infty} b_{k} \sin kx $$
Meanwhile, by introducing the following definition for $f,g : [-\pi, \pi] \to \mathbb{C}$, a generalization to complex numbers is possible.
$$ \left< f, g \right> := {{1} \over{2 \pi}} \int_{-\pi}^{\pi} f(x) \overline{ g(x) } dx $$
$$ \left\| f \right\| : = \left< f, f \right> := \sqrt{ {{1} \over{2 \pi}} \int_{-\pi}^{\pi} \left| f(x) \right| ^2 dx } $$
$$ f(x) \sim \sum_{k \in \mathbb{Z}} c_{k} e^{ikx} = \cdots +c_{-2}e^{-i 2 x } + c_{-1}e^{-i x } + c_{0} +c_{1}e^{i x } + c_{2}e^{i 2 x } + \cdots $$
$$ c_{k} = \left<f , e^{ikx} \right> = {{1} \over {2 \pi}} \int_{-\pi}^{\pi} f(x) e^{-ikx} dx $$
From Euler’s formula, since there is $\displaystyle \cos kx = {{e^{ikx} + e^{-ikx} } \over {2}}$ and $\displaystyle \sin kx = {{e^{ikx} - e^{-ikx} } \over {2i}}$,
$$ \begin{align*} c_{k} + c_{-k} =& {{1 } \over {2 \pi }} \int_{-\pi}^{\pi} f(x) \left(e^{ikx} + e^{-ikx} \right) dx \\ =& {{1 } \over { 2 \pi }} \int_{-\pi}^{\pi} f(x) \cdot 2 \cos kx dx \\ =& {{1 } \over { \pi }} \int_{-\pi}^{\pi} f(x) \cos kx dx \\ =& a_{k} \end{align*} $$
Similarly, we can obtain $b_{k} = i (c_{k} - c_{-k})$.
Therefore, although it seems that the standardization constant has changed at first glance, in reality, it properly covers $f,g : [-\pi, \pi] \to \mathbb{R}$. As you can see, to understand these techniques, even roughly, background knowledge in linear algebra, complex analysis, and real analysis is required.