The set $\{ e^{inx}: n\in \mathbb{Z} \}$ forms an orthonormal basis of $(L_{2}(-\pi,\pi),\langle \cdot , \cdot \rangle)$ where $\langle f, g\rangle = \int_{-\pi}^{\pi} f\bar{g}$.
That is, $\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{ikx}e^{-ilx} dx = \begin{cases}
1, & \text{if }k=l, \\
0, & \text{otherwise},
\end{cases}\quad \quad k,l \in \mathbb{Z}$or equivalently,
> [!NOTE]
>
> $\frac{1}{2\pi}\int_{-\pi}^\pi e^{ikx} = \begin{cases}
> 1, &k= 0, \\
> 0, & k\neq 0
> \end{cases}, \quad k\in \mathbb{Z}.$
###### Proof
This follows from [[Cauchy-Goursat Theorem]], since $\int_{-\pi}^{\pi} e^{inx} \, dx = \frac{1}{i} \int_{|z|=1} z^{n-1} \, dz $and $z\mapsto z^{n-1}$ is entire except when $n= 0$.
###### Proof
If then and the assertion follows immediately.
If $k \neq l$ then we make use of $e^{i\pi}=e^{-i\pi}=-1$: $\begin{align}
\int_{-\pi}^{\pi}e^{\mathrm{i}kx}e^{-\mathrm{i}lx}dx& =\int_{-\pi}^{\pi}e^{\mathrm{i}(k-l)x}dx \\
&=\left.\frac1{\mathrm{i}(k-l)}e^{\mathrm{i}(k-1)x}\right|_{-\pi}^\pi \\
&=\frac1{\mathrm{i}(k-l)}\big(e^{\mathrm{i}(k-1)\pi}-e^{-\mathrm{i}(k-l)\pi}\big) \\
&=\frac1{\mathrm{i}(k-l)}\big((-1)^{(k-l)}-(-1)^{(k-1)}\big) \\
&=0.
\end{align}$