Apologies if this question is actually obvious - I'm trying to derive a given result in a textbook, Analog to Digital Conversion by Pelgrom. It's an engineering text but my question is about the mathematical derivation of the maximum horizontal distance between two graphs as shown in the first figure below. (This is the so-called "integral nonlinearity".)
The setup is: There is one real-valued function in green, $y_1=V_{in}$ defined for $V_{in}$ in the range of 0 to a constant, positive real number $V_{ref}$. There is a another function in red which is a nonlinear approximation to $y_1$, defined as:
$$y_2=V_{in}(1+\alpha(V_{ref}-V_{in}))$$
So $y_2$ coincides with $y_1$ at the origin and at $V_{in}=V_{ref}$ but has a quadratic bow between those points. As shown in the figure the maximum horizontal distance between the graphs, is equal to $\alpha V_{ref}^2/4$. This is the result I want to derive.
What I'm uncertain about is that the quantity I want to find the maximum of is defined along between points on the functions' inputs, not the outputs. My first attempts were to try to re-formulate the problem in terms of $y_2$'s inverse, but that was becoming a bit of a mess. So instead I wanted to see what would happen if instead I just calculated the maximum of the difference between $y_2$, $y_1$ (so along the vertical axis), and this gave me the same result of $\alpha V_{ref}^2/4$. But I'm not sure how to justify that this is then equal to the maximum horizontal distance, or maybe it might be a coincidence? If it's not, then under what conditions would this approach work? For example, would the same procedure be valid for the case of a cubic function as shown in the bottommost figure?


Hint.
We have for $\{y_1,y_2\}\in [0, V_r]$
$$ \cases{ y_1 = V\\ y_2 = V(1+\alpha(V_r- V)) } $$
so we need to solve
$$ y^* = \arg\max{\left(y-\frac{\alpha V_r+1\pm\sqrt{(\alpha V_r+1)^2-4\alpha y}}{2\alpha}\right)^2}=\arg\max{\|y-\frac{\alpha V_r+1\pm\sqrt{(\alpha V_r+1)^2-4\alpha y}}{2\alpha}\|}\ \ \ \text{s. t.}\ \ \ 0 < y < V_r $$
NOTE
Considering instead
$$ y^* = \arg\max{\left(y-\frac{\alpha V_r+1+\sigma\sqrt{(\alpha V_r+1)^2-4\alpha y}}{2\alpha}\right)^2}\ \ \ \text{s. t.}\ \ \ 0 < y < V_r $$
we have null derivative at
$$ \cases{ y^*=\frac{(\alpha V_r+1)^2-\sigma^2}{4 \alpha}\\ y^*= -\frac{\sqrt{\sigma^2 \left(a^2 V_r^2+\sigma ^2-1\right)}-\alpha V_r+\sigma ^2-1}{2 \alpha}\\ y^*=\frac{\sqrt{\sigma ^2 \left(\alpha^2 V_r^2+\sigma ^2-1\right)}+\alpha V_r-\sigma ^2+1}{2 \alpha} } $$
or as $\sigma^2=1$ at
$$ \cases{ y^*= \frac{(\alpha V_r+1)^2-1}{4 \alpha}\\ y^*= 0\\ y^*= V_r } $$