Let $f:[0,2\pi]\rightarrow[-1,1]$ satisfy $f(\theta)=\sum_{r=0}^n(a_r\sin(r\theta)+b_r\cos(r\theta))$ for $a_h,b_i\in \mathbb R$. If $|f(x)|=1$... 
Let $f:[0,2\pi]\rightarrow[-1,1]$ satisfy
$f(\theta)=\sum_{r=0}^n(a_r\sin(r\theta)+b_r\cos(r\theta))$ for
$a_h,b_i\in\mathbb R$. If $|f(x)|=1$ for exactly $2n$ distinct values in $[0,2\pi)$, then prove that the number of distinct solutions of $(f''(x))^2+f'(x)f'''(x)=0$ can be $4n,4n-1$ or $4n-2$.

I know that $-\sqrt{a^2+b^2}+c\leq a\cos(\theta)+b\sin(\theta)+c\leq \sqrt{a^2+b^2}+c$.
But this same formula can't be extended to the entire series since it's not necessary that $\sin(2\theta)$ and $\sin(\theta)$ give the minimum value for the same value of $\theta$.
If we prove that $1$ is the maximum value of $f(\theta)$, we can prove that $f'(x)=0$ has $2n$ roots. This means $f''(x)$ has $2n-1$ roots (by Rolle's theorem).
$f'(x)=\sum_{r=0}^nra_r\cos(r\theta)-rb_r\sin(r\theta)$
$f''(x)=\sum_{r=0}^n-r^2a_r\sin(r\theta)-r^2b_r\cos(r\theta)$
$f'''(x)=\sum_{r=0}^n -r^3a_r\cos(r\theta)+r^3b_r\sin(r\theta)$
 A: The range is $[-1,1]$ and the function is smooth, so the points where $|f(x)|=1$ are actually maxima and minima, and thus also roots of $f'$.
By the degree/maximal frequency, only $2n$ maxima and minima are possible in the fundamental period $[0,2π)$, and thus the values of the extrema strictly alternate between $\pm 1$, $f'$ is zero at the extrema, and the curvature $f''$ again has alternating sign.
The roots that we look for are the ones of $\frac12(f'(x)^2)''$. As $f'$ has $2n$ roots and $2n$ extrema of alternating sign between them in $[0,2π)$, using the periodic behavior for "between them", $f'(x)^2$ has $4n$ distinct extrema, thus $(f'(x)^2)'$ has $4n$ roots at these places. By Rolle now $\frac12(f'(x)^2)''$ has $4n$ roots between them.


Take $f(x)=\sin(nx)$ as illustrative example, then $f'(x)^2=n^2\cos^2(nx)=\frac{n^2}{2}(\cos(2nx)-1)$ indeed has $4n$ extrema, $(f'(x)^2)'=-n^3\sin(2nx)$ has $4n$ roots in $[0,2π)$, as has $\frac12(f'(x)^2)''=-n^4\cos(2nx)$.


It is quite possible that the cursory argument chain above has some slight gaps, as the task states that $4n-1$ and $4n-2$ are possible as root numbers for $\frac12(f'(x)^2)''$.
