The Wobbling Staircase Function

Define the wobbling staircase function as follows:

Informally: The wobbling staircase function consists of $3$ connected line segments with alternating 'size' of gradients. That is, the gradient of the second line segment is smaller than the first and that of the third is greater than the second.

Note: if you sketch this then it does look like a wobbly staircase!

Formally: Assume that the first line segment begins at the origin. If the endpoint of the first line segment is $(a,d)$, that of the second is $(b,e)$ aand that of the third is $(c,f)$, then the wobbling staircase function is \begin{align}y=\begin{cases}\frac dax,\quad &0\le x\le a\\\frac{e-d}{b-a}x+\frac{d(b-a)-a(e-d)}{b-a},\quad & a<x\le b\\\frac{d-e}{c-b}x+\frac{e(c-b)-b(f-e)}{c-b},\quad &b<x\le c\end{cases}\end{align} This means that we have $$\frac da>\frac{e-d}{b-a}\implies \frac de>\frac ab$$

Define also the line joining the origin and $(c,f)$: $$y_{\text{tot}}=\frac fcx.$$

Question: On what condition(s) is $y_{\text{tot}}$ always above each of the line segments, except for the points $(0,0)$ and $(c,f)$?

Note that this is equivalent to asking when $y_{\text{tot}}$ does not cross the second line segment.

Bonus Question: What if I extend this is $2k+1$ connected line segments? What would the constraints then be?

• As long as the line is above the first point $(a,d)$, you're good. For more connected line segments, just check the odd-numbered points. – Rahul Jun 1 '18 at 20:03
• By the way, referring to it as "the wobbling staircase" is wrong; your function should be called "a wobbling staircase" (since there is not just one unique wobbling staircase). – Rahul Jun 1 '18 at 20:04
• It is not equivalent to not crossing the second line segment. $y_{tot}$ could be below them all except at the endpoints. Just turn one where it is above them all upside down. – Ross Millikan Jun 1 '18 at 20:31

Informally, what you want is for the vector $\left(\matrix{c\\f}\right)$ to lie "on the left" of the vector $\left(\matrix{a\\d}\right)$.
Formally, this is saying that the basis $\left(\left(\matrix{c\\f}\right),\left(\matrix{a\\d}\right)\right)$ is negatively oriented, which you check by computing the sign of its determinant. Hence $y_\text{tot}$ lies above all line segments if and only if $$cd-af<0.$$