Properties of preimage of $[b,a]$ through a third degree polynomial $p$ where $p(x) = a$ and $p(x) = b$ both have three real distinct solutions Let $p$ be a third degree polynomial with real coefficients and $b<a$ real numbers such that $p(x) = a$ and $p(x) = b$ both have three real distinct solutions. Show that the preimage of $[b,a]$ (that is, the set $\left\{ x \in \mathbb{R}  | p(x) \in [b,a] \right\}$) is the reunion of three disjoint intervals, one of them having length equal to the sum of the legths of the other two.
My attempt is rather graphical, as follows:
Label the solutions in increasing order. Then the preimage of $[b,a]$ would be $[x_1,x_2] \cup [x_3,x_4] \cup [x_5,x_6]$.
Furthermore, by Viete's relations, $x_2 + x3 + x_6 = x_1 + x_4 + x_5$ thus $(x_2 - x_1) + (x_6 - x_5) = x_4 - x_3$ which proves the lenght reasoning.
My question is: this is not rigorous. The lenght part is, but showing that the preimage is what I stated is not rigorous. Lets assume wlog that the leading coefficient of the polynomial is positive (otherwise flip the whole image and switch a and b). Again label the roots in increasing order. I have to show, first of all, that after $p$ hits the line $y = b$ it hits the line $y = a$ without turning. My idea would be the following:
1) It can't hit $y = b$ and then immediately go back, as in be tangent to $y = b$, because then it would have to return once to hit $y = b$ again, and then turn again to hit $y = b$ a third time. This would give at least 3 turning points, but a cubic can have at most 2.
2) It can't hit $y = b$, go up a bit without hitting $y = a$ and then return, because then again it would have to come back up to hit $y = b$ again and then it would need to turn again at least once more to hit $y = a$ in two points, which again gives 3 turning points.
So it goes up to $x_2$ without turning. Now I have to argue that it can't be tangent to $y = a$ (otherwise again it would have to turn back at least two times more to hit it three times, which gives 3 turning points).
So it travels up a bit and then comes back down hitting again $y = a$ in $x_3$. Then by some similar arguments it must go straight down to $x_4$, travel a bit and then return.
In any case, this is very long and not that rigorous. Is there any other way to show this, much more cleanly and quickly?
 A: I think you have the right idea about how to think about this by analyzing when the cubic can change between being increasing and decreasing, though beware that the picture could be upside-down from the one you're looking at.  Here's how I might formulate it to avoid too much messy casework, the key idea being to start by locatiing the critical points of $p$ rather than just going directly from left to right.
Let $r<s<t$ be the solutions of $p(x)=a$ and $u<v<w$ be the solutions of $p(x)=b$.  By the mean value theorem $p'$ must have a root $m\in(r,s)$ and a root $n\in(s,t)$.  But $p'$ is a quadratic so it only has two roots, and so since $p'$ also has to have roots in $(u,v)$ and $(v,w)$ we must have $m\in (u,v)$ and $n\in(v,w)$.  We also know that $p'$ has constant sign on each of the intervals $(-\infty,m)$, $(m,n)$, and $(n,\infty)$ and moreover that this sign alternates (since if $p'$ didn't change sign at $m$ or $n$, then $p''$ would be $0$ at $m$ or $n$ but $p''$ already has a root in $(m,n)$ by the mean value theorem which must be the only root since $p''$ is linear).
So, there are two cases: $p$ is increasing on $(-\infty,m)$, decreasing on $(m,n)$, and then increasing on $(n,\infty)$, or the reverse of that.  Replacing $p$ with $-p$ (and $a$ and $b$ with their negatives as well) we can reduce the second case to the first case, so it suffices to consider the first case.
Now in the first case we know that $r,u\in (-\infty,m)$, so $u<r$ since $p$ is increasing on that interval.  Similarly we know $s,v\in (m,n)$ so $s<v$ since $p$ is decreasing.  Finally, $t,w\in (n,\infty)$ so $w<t$ since $p$ is increasing.  That is, $u<r<m<s<v<m<w<t$.  Moreover since we know whether $p$ is increasing or decreasing on each of the intervals between these values we can easily identify that the preimage of $[b,a]$ is $[u,r]\cup[s,v]\cup[w,t]$.
