Fourier Transform
Inner product
The inner product generalizes the dot product to abstract vector spaces over a field of scalars, being either the field of real numbers $R$ or the field of complex numbers $C$. It is usually denoted using angular brackets by $\braket{\vec{a}, \vec{b}}$. Each vector in the field of real numbers $R$ can be regarded as a discrete functions with domain $\{k\in N:1\le k\le n\}$. And the inner product measures the similarity of two vectors:
$$\vec{a}\cdot\vec{b}=\sum\limits_{i=0}^na_ib_i\Delta n$$
where $\Delta n=1$ , can be regarded as the difference of two dimension. It is easy to generalize this to continuous functions. In this case, the dimension of a vector is infinity and the sum will diverge. Therefore, we average each term, that is $dx$:
$$\braket{f,g}=\int_a^bf(x)g(x)dx$$
Similarly, the inner product of functions measures the similarity of two functions.
Orthogonality of trigonometric functions
We define:
$$\{\sin0x,\cos0x,\sin x,\cos x,...,\sin nx, \cos nx\}$$
as trigonometric space. In this space, the inner product of two different functions with domain $\{x\in R:-\pi\le x\le \pi\}$ is zero, that is, the two functions are orthogonal:
$$\braket{\sin nx, \sin mx}=\int_{-\pi}^\pi\sin nx\sin mxdx=0$$
where $n\ne m$ and either or both of $\sin$ could be $\cos$. If the two functions are the same and are not $0$, their inner product is $\pi$:
$$\braket{\sin nx, \sin nx}=\int_{-\pi}^\pi\sin nx\sin nxdx=\pi$$
Fourier series
Fourier series is another kind of series besides power series. It uses functions in trigonometric space to represent any periodic functions.
$T=2\pi$
For a function of period $2\pi$, $f(x)=f(x+2\pi)$, we can represent it using trigonometric functions:
$$f(x)=\sum\limits_{n=0}^\infty a_n\cos nx+\sum\limits_{n=0}^\infty b_n\sin nx$$
To get $a_n\space(n\ne0)$ , multiply both sides by $\cos nx$ and integrate at $[-\pi, \pi]$:
$$\int_{-\pi}^\pi f(x)\cos nxdx=\sum\limits_{m=0}^\infty[\int_{-\pi}^\pi a_m\cos mx\cdot\cos nxdx+b_m\sin mx\cdot\cos nxdx]\tag{1}$$
Because of the orthogonality of trigonometric functions, formula (1) becomes:
$$\int_{-\pi}^\pi f(x)\cos nxdx=\int_{-\pi}^\pi a_n\cos nx\cdot\cos nxdx=a_n\pi$$
Therefore:
$$a_n=\frac{1}{\pi}\int_{-\pi}^\pi f(x)\cos nxdx$$
If $n=0$:
$$\int_{-\pi}^\pi f(x)dx=a_02\pi\rightarrow a_0=\frac{1}{2\pi}\int_{-\pi}^\pi f(x)dx$$
For unity, we usually use $2a_0\space(A_0)$ as $a_0$:
$$A_0=2a_0=\frac{1}{\pi}\int_{-\pi}^\pi f(x)dx$$
Similarly, if multiply both sides by $\sin nx\space(n\in N)$ and integrate at $[-\pi, \pi]$, we get $b_n$:
$$b_n=\frac{1}{\pi}\int_{-\pi}^\pi f(x)\sin nxdx$$
So, the fourier series of $f(x)=f(x+2\pi)$ is:
$$f(x)=\frac{a_0}{2}+\sum\limits_{n=1}^\infty [a_n\cos nx+b_n\sin nx], \begin{cases}
a_0=\frac{1}{\pi}\int_{-\pi}^\pi f(x)dx &\\
a_n=\frac{1}{\pi}\int_{-\pi}^\pi f(x)\cos nxdx &\\
b_0=0 &\\
b_n=\frac{1}{\pi}\int_{-\pi}^\pi f(x)\sin nxdx &
\end{cases}$$
$T=2L$
More generally, for any function with period $2L$, $f(t)=f(t+2L)$, we assume:
$$t=\frac{L}{\pi}x$$
Then:
$$f(t)=f(\frac{L}{\pi}x)$$
$$f(t+2L)=f(\frac{L}{\pi}x+2L)=f[\frac{L}{\pi}(x+2\pi)]$$
We make:
$$g(x)=f(\frac{L}{\pi}x)$$
Then:
$$g(x)=g(x+2\pi)$$
We have already know the fourier series of functions with period $2\pi$ is:
$$g(x)=\frac{a_0}{2}+\sum\limits_{n=1}^\infty [a_n\cos nx+b_n\sin nx], \begin{cases}
a_0=\frac{1}{\pi}\int_{-\pi}^\pi g(x)dx &\\
a_n=\frac{1}{\pi}\int_{-\pi}^\pi g(x)\cos nxdx &\\
b_0=0 &\\
b_n=\frac{1}{\pi}\int_{-\pi}^\pi g(x)\sin nxdx &
\end{cases}$$
Since $t=\frac{L}{\pi}x$ and $g(x)=f(\frac{L}{\pi}x)=f(t)$, we can replace $x$ with $t$:
$$dx=\frac{\pi}{L}dt$$
$$x\in[-\pi,\pi]\rightarrow t\in[-L,L]$$
Therefore:
$$f(t)=\frac{a_0}{2}+\sum\limits_{n=1}^\infty [a_n\cos \frac{n\pi
}{L}t+b_n\sin \frac{n\pi}{L}t], \begin{cases}
a_0=\frac{1}{L}\int_{-L}^L f(t)dt &\\
a_n=\frac{1}{L}\int_{-L}^L f(t)\cos \frac{n\pi
}{L}tdt &\\
b_0=0 &\\
b_n=\frac{1}{L}\int_{-L}^L f(t)\sin \frac{n\pi
}{L}tdt &
\end{cases}$$
Sometimes, we use $T=2L$ to represent period and $\omega_0$ to represent fundamental frequency $\frac{2\pi}{T}$. Since the integral of a periodic function over a period is constant, we can also write the fourier series as:
$$f(t)=\frac{a_0}{2}+\sum\limits_{n=1}^\infty [a_n\cos n\omega_0 t+b_n\sin n\omega_0 t], \begin{cases}
a_0=\frac{2}{T}\int_{0}^T f(t)dt &\\
a_n=\frac{2}{T}\int_{0}^T f(t)\cos n\omega_0 tdt &\\
b_0=0 &\\
b_n=\frac{2}{T}\int_{0}^T f(t)\sin n\omega_0 tdt &
\end{cases}$$
Complex form
Fourier series can be transformed into complex form using Euler's formula:
$$e^{i\theta}=\cos\theta+i\sin\theta\tag{2}$$
$$e^{-i\theta}=\cos\theta-i\sin\theta\tag{3}$$
By combining (2) and (3), we can get:
$$\cos\theta=\frac{1}{2}(e^{i\theta}+e^{-i\theta})\tag{4}$$
$$\sin\theta=-\frac{1}{2}i(e^{i\theta}-e^{-i\theta})\tag{5}$$
Put the above two formulas into fourier series, we get:
$$\begin{align*}
f(t) &=\frac{a_0}{2}+\sum\limits_{n=1}^\infty [\frac{a_n}{2}(e^{in\omega_0 t}+e^{-in\omega_0 t})-\frac{b_n}{2}i(e^{in\omega_0 t}-e^{-in\omega_0 t})]\\
&=\frac{a_0}{2}+\sum\limits_{n=1}^\infty [\frac{a_n-ib_n}{2}e^{in\omega_0 t}+\frac{a_n+ib_n}{2}e^{-in\omega_0 t}]\\
&=\frac{a_0}{2}+\sum\limits_{n=1} ^{+\infty} \frac{a_n-ib_n}{2}e^{in\omega_0 t}+\sum\limits_{n=-1} ^{-\infty} \frac{a_{-n}+ib_{-n}}{2}e^{in\omega_0 t}\tag{6}\\
&=\sum\limits_{n=-\infty} ^{+\infty}C_ne^{in\omega_0 t}\tag{7}
\end{align*}$$
For (6) to (7), since $e^0=1$, we can treat $\frac{a_0}{2}$ as $C_0$. Therefore:
$$
C_n=
\begin{cases}
\frac{1}{2}a_0=\frac{1}{T}\int_{0}^T f(t)dt,&n=0\\
\frac{1}{2}(a_n-ib_n)=\frac{1}{T}\int_{0}^T f(t)(\cos n\omega_0 t-i\sin n\omega_0 t)dt=\frac{1}{T}\int_{0}^T f(t)e^{-in\omega_0 t}dt,&n=1,2,3...\\
\frac{1}{2}(a_n+ib_n)=\frac{1}{T}\int_{0}^T f(t)(\cos n\omega_0 t+i\sin n\omega_0 t)dt=\frac{1}{T}\int_{0}^T f(t)e^{in\omega_0 t}dt,&n=-1,-2,-3...
\end{cases}
$$
Since $e^0=1$:
$$C_n=\frac{1}{T}\int_{0}^T f(t)e^{-in\omega_0 t}dt,n\in Z$$
Therefore:
$$f(t)=\sum\limits_{n=-\infty} ^{+\infty}C_ne^{in\omega_0 t}
=\sum\limits_{n=-\infty} ^{+\infty}e^{in\omega_0 t}\frac{1}{T}\int_{0}^T f(t)e^{-in\omega_0 t}dt$$
Fourier transform
In the complex form of fourier series, it is $C_n$ that defines the form of $f(t)$ in frequency domain, where $C_n=A_n+iB_n$. Based on the difference of frequency $n\omega_0$, the curve of $f(t)$ in the time domain $[0,T]$ is transformed into a point in frequency domain:
If function $f(t)$ is not a periodic function, that is, its period is $+\infty$, fourier series becomes fuorier transform:
$$T\to+\infty,\space\frac{1}{T}=[(n+1)\omega_0-n\omega_0]\frac{1}{2\pi}=\frac{\Delta\omega}{2\pi}=\frac{\omega_0}{2\pi}\to0$$
Since the difference between $(n+1)\omega_0$ and $n\omega_0$ is rather small, that is, the fundamental frequency $\omega_0$ is rather small, we can turn the discrete $n\omega_0$ into continuous $\omega$. Then:
$$\Delta\omega=d\omega\to0, \space n\omega_0\to\omega$$
$$
\begin{align*}
f(t)
&=\sum\limits_{n=-\infty} ^{+\infty}e^{in\omega_0 t}\frac{1}{T}\int_{0}^T f(t)e^{-in\omega_0 t}dt\\
&=\sum\limits_{n=-\infty} ^{+\infty}e^{in\omega_0 t}\frac{1}{T}\int_{-\frac{T}{2}}^\frac{T}{2} f(t)e^{-in\omega_0 t}dt\\
&=\sum\limits_{n\omega_0=-\infty} ^{+\infty}e^{in\omega_0 t}\frac{\Delta\omega}{2\pi}\int_{-\frac{T}{2}}^\frac{T}{2} f(t)e^{-in\omega_0 t}dt\\
&=\frac{1}{2\pi}\int_{-\infty} ^{+\infty}\int_{-\infty} ^{+\infty}f(t)e^{-i\omega t}dt\space e^{i\omega t}d\omega
\end{align*}
$$
Among the formula above:
$$\int_{-\infty} ^{+\infty}f(t)e^{-i\omega t}dt=F(\omega)$$
is called Fourier Transform and the whole formula is called Inverse Fourier Transform. It's easy for us to understand that $F(\omega)$ is $\frac{1}{2\pi} C_n$ and it is a complex number in frequency domain. More generally, we don't use the form in Fig. 1. to represent $F(\omega)$, instead, we draw the curve of Amplitude-$\omega$:
$$F(\omega)=|F(\omega)|e^{i\phi}$$
It is a continuous curve in frequency domain:
$e^{i\omega t}$ represents different waveforms while $F(w)$ represents the intensity of different waveforms in the original function $f(t)$. Therefore, we can restore the original function by superimposing waveforms of different intensities. And this is Inverse Fourier Transform.