Derivation (cosine and sine series as Fourier series of periodic extensions)

Given some $f: [0,L)\to\C$, we can define a $2L$-periodic even or odd extensions $$ \begin{align*} f_\text{even}(\theta) &= \begin{cases} f(\theta), &\theta\in [0, L), \\ f(-\theta), &\theta\in [-L, 0), \end{cases}, \\ f_\text{odd}(\theta) &= \begin{cases} f(\theta), &\theta\in [0, L), \\ -f(-\theta), &\theta\in [-L, 0). \end{cases} \end{align*} $$

Since $f_\text{even}$ is even, its Fourier series is $$ \begin{align*} f_\text{even}(\theta) &\sim \frac{1}{2}A_0 + \sum_{n=1}^{\infty} A_n \cos \frac{2\pi n\theta}{2 L} \\ A_n &= \frac{2}{2L} \int_{-L}^{L} f_{\text{even}}(\theta) \cos \frac{2\pi n\theta}{2L} \d \theta \\ &= \frac{2}{L}\int_{0}^{L} f(\theta) \cos \frac{\pi n \theta}{L} \d \theta \end{align*} $$ and since $f_\text{odd}$ is odd, its Fourier series is $$ \begin{align*} f_{\text{odd}}(\theta) &\sim \sum_{n=1}^{\infty} B_n \sin \frac{2\pi n \theta}{2L} \\ B_n &= \frac{2}{2L} \int_{-L}^{L} f_\text{odd}(\theta) \sin \frac{2\pi n \theta}{2L} \d \theta \\ &= \frac{2}{L}\int_{0}^{L} f(\theta) \sin \frac{\pi n\theta}{L} \d \theta \end{align*} $$ which are the cosine and sine series.