I was pondering convex functions today, and the following questions naturally posed themselves. Call a function $f : \mathbb{R} \rightarrow \mathbb{R}$ $2$-limited iff for all $m,c \in \mathbb{R},$ the cardinality of $\{x \in \mathbb{R} \mid f(x)=mx+c\}$ is at most $2.$
Question 0. Is every continuous 2-limited function $f : \mathbb{R} \rightarrow \mathbb{R}$ convex or concave?
Question 1. Assuming the answer to the above question is "yes," does there exist a (necessarily discontinuous) $2$-limited function $f : \mathbb{R} \rightarrow \mathbb{R}$ that is neither convex nor concave?
For Question $0$:
Suppose points $A,B,C$ are witnesses to the non-concavity of $f$; that is, they are points on the graph of $f$ such that $x_A < x_B < x_C$ and $y_B < y_A + \dfrac{x_B-x_A}{x_C-x_A}(y_C-y_A)$. This is the picture:
Claim: If $f$ is $2$-limited, the graph of $f$ can't enter the interior of the shaded regions. (We call the union of these two shaded regions the forbidden zone for $A,B,C$.)
To see this for the right-hand shaded region, divide it up into three sub-regions:
If $P$ is a point on the graph of $f$ in region $1$, then draw a line through $P$ and $C$, as shown; by the continuity of $f$, this line will cross the graph of $f$ somewhere between $A$ and $B$, contradicting the $2$-limited condition.
Similarly, if $P$ is in region $2$, draw a line through $P$ and $A$; this line will cross the graph of $f$ somewhere between $B$ and $C$.
And if $P$ is in region $3$, the line $AB$ will cross the graph of $f$ between $C$ and $P$.
A similar argument applies to the left-hand shaded region. This establishes the claim.
Similarly, if $D,E,F$ are witnesses to the non-convexity of $f$, then the graph of $f$ can't enter the interior of the shaded region in this diagram:
Now, if $f$ is neither concave nor convex, then there exist witnesses $A,B,C$ to its non-concavity, and witnesses $D,E,F$ to its non-convexity.
Each of the corresponding forbidden zones covers more than $180^{\circ}$. So for large enough $R$, they must intersect for $x > R$ or $x < -R$. For such $x$, the point $(x,f(x))$ has nowhere to go; a contradiction.
QED