For what $a \in \mathbb{R}$ does $f_a(x) := \sin x + ax$ attain every value exactly three times? See the title. This is maybe a twist on a classic calculus question.
A reasonable first guess (and indeed my own) would be a value of $a$ such that $f_a(3\pi / 2) = 0$, i.e., $a = \frac{2}{3\pi}$. Unfortunately this just causes more problems, as you can see in this image I made, which is simply a screenshot I took of desmos. 
The red curve is $y = f_{2/3\pi}(x)$, the blue curve is $y = \sin x$, and in green is the line $y = \frac{2}{3\pi}x$.
We can see in the image above that $f_{2/3\pi}(x)$ attains $0$ five times, and so we have a problem. What seems to be happening is that after the 'shift' that adding $\frac{2}{3\pi}x$ gives to $\sin x$, we slightly change the maxima and minima of the function, and thus setting old maxima and minima to zero simply doesn't work. How do we account for this?
 A: First, find the $a$ so that $f_a(x)=0$ for exactly three $x$. Clearly, $x=0$ is one, and by antisymmetry, the zeros of $f_a$ are symmetrically arranged around the origin. So you need $f_a(x)=0$ for exactly one $x>0$. It seems clear that you want the graph to be tangent to the $x$ axis at that point (call it $x_0$, so you should have $f_a(x_0)=f_a'(x_0)=0$, i.e., $\sin x_0+ax_0=\cos x_0+a=0$.
Thus $a=-\cos x_0$, and $0=\sin x_0+ax_0=\sin x_0-x_0\cos x_0$. You want $x_0$ to be the smallest positive solution to this equation. You will need to find it by some numerical method (Newton, say). Then put $a=\cos x_0$.
Edit: I solved the equation with Maple's fsolve and got $x_0=4.493409458$ and $a=0.2172336281$. Plotting the graph with this value of $a$ provides some visual confirmation that $f_a$ has the desired properties (note that the axes are scaled differently though):

Now you need to convince yourself that $f_a$ does indeed take every value three times. The relation $f_a(x+2\pi)=f_a(x)+2\pi a$ should be helpful.
A: Geometrically, I'd say that this happens if the value at the top of a "hill" mathces the value at the bottom of the second next valley (not the one right after the hill). This means that $f(\pi/2+2k\pi) = f(\pi/2+2k\pi+3\pi)$.
