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?

  • $\begingroup$ 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. $\endgroup$ – user856 Jun 1 '18 at 20:03
  • $\begingroup$ 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). $\endgroup$ – user856 Jun 1 '18 at 20:04
  • 1
    $\begingroup$ 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. $\endgroup$ – 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.$$

For more line segments, you have more determinants to compute.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.