Let $$S_n (x) = \frac{4}{\pi} \sum_{k=1}^n \frac{\sin((2k - 1)x)}{2k - 1}, x \in [0, \pi]$$ how to prove that $S_n(x)$ reaches its maximun in $[0, \pi]$ at $x = \frac{\pi}{2n}$?
I've calculated its derivative $$S'_n(x) = \begin{cases} \frac{2}{\pi}\frac{\sin (2nx)}{\sin x}, & \text{if } x \notin \pi \mathbb{Z}; \\[2ex] \frac{4n(-1)^q}{\pi}, & \text{if } x = q \pi, q \in \mathbb{Z}. \end{cases}$$ and proved that it has exactly $2n - 1$ local maxima or minima in $[0, \pi]$ at $x = \frac{k\pi}{2n}, k = 1, 2, \cdots, 2n-1$. But I have no idea how to prove it reaches its global maximum in $[0, \pi]$ at $x = \frac{\pi}{2n}$.