Determine $\frac{1}{\pi}\int_{-\pi}^{\pi}\left[D_{m}(t)\right]^{2}dt$ for $m=100$ where $D_{m}(t)=\frac{1}{2}+\sum_{n=1}^{m}\cos{nt}$ (Dirichlet's kernel).
Initially, I thought of using the identity $\frac{1}{2}+\sum_{n=1}^{m}\cos{nt}=\frac{\sin{(m+\frac{1}{2}})t}{2\sin{\frac{t}{2}}}$ to solve the problem. However, it became immediately clear that this strategy would be not be particularly fruitful. So instead I turned to the definition of Dirichlet's kernel and looked at simpler cases, like when $m=1,2,3$. For $m=1$ I obtained:
\begin{align} \frac{1}{\pi}\int_{-\pi}^{\pi}\left[D_{1}(t)\right]^{2}dt &=\frac{1}{\pi}\int_{-\pi}^{\pi}\left[\frac{1}{2}+\cos{nt} \right]^{2}dt \\ &=\frac{1}{\pi}\int_{-\pi}^{\pi}\left[\frac{1}{4}+\cos{nt}+\cos^{2}{nt} \right]dt \\ &=\frac{2}{\pi}\left[\frac{3t}{4}+\sin{nt}+\frac{1}{4}\sin{2t} \right]_{0}^{\pi} \\ &=\frac{3}{2} \end{align} In a similar fashion, all be a bit more complicated, I obtained that $\frac{1}{\pi}\int_{-\pi}^{\pi}[D_{2}(t)]^{2}dt=\frac{5}{2}$ and $\frac{1}{\pi}\int_{-\pi}^{\pi}[D_{3}(t)]^{2}dt=\frac{7}{2}$. From these cases I (heuristically) claim that the solution to the question should be $100\frac{1}{2}$. What I would really like to have is an answer as to how one could solve this problem directly, instead of my weak method. Thus, I humbly submit to you my reasoning in the hope that someone enlighten may step forth and rescue me from this state of ignorance.
Recall the following identities: $$\int_{-\pi}^{\pi} \cos(mt)\cos(nt) dt = \pi \delta_{mn}$$ $$\int_{-\pi}^{\pi} \cos(mt) dt = 2\pi \delta_{m}$$ Now expand the square $$\left(\dfrac12 + \sum_{n=1}^m\cos(nt)\right)^2 = \dfrac14 + \sum_{n=1}^m \cos^2(nt) + \sum_{n=1}^m \cos(nt) + \sum_{n_1\neq n_2} \cos(n_1t) \cos(n_2t)$$ Now if we integrate, the last two terms are zero. Hence, we have the integral to be $$\dfrac1{\pi}\left(\dfrac{2 \pi}4 + \pi m \right) = (m+1/2)$$