Continuity of a convex function

$K$ need not be convex, but it should be open. (In fact, $K=[0,1]\subset\mathbb R^1$ is convex and $f\colon K\to \mathbb R$ with $f(x)=0$ for $0<x<1$ and $f(0), f(1)$ arbitrary positive is convex but not continuous.)

The proof for $K$ open is by induction on $n$, the case $n=0$ being trivial.

Let $x_0\in K$ be any point in $K$. Then there exists $r>0$ such that the closed cube $$Q=\{x\in\mathbb R^n\mid ||x-x_0||_\infty\le r\}$$ is contained in $K$. The $2^n$ hyperplanes $H_{i,e}$, $1\le i\le n$, $e\in\{\pm1\}$ given by $x^{(i)}=x_0^{(i)}+e r$ can each be identified with $\mathbb R^{n-1}$. Thus the convex function $f|_{K\cap H_{i,e}}$ is continuous and hence $f$ is bounded on each of the $2^n$ compact faces $Q\cap H_{i,e}$ making up the boundary $\partial Q$ of $Q$. Let $M$ be a bound, i.e. $|f(x)|<M$ for all $x\in\partial Q$.

Consider an arbitrary point $x\in Q\setminus\{x_0\}$. Then $$g(t)=x_0+(x-x_0)\cdot t$$ describes the line through $x_0$ and $x$. It passes through $\partial Q$ at $t=t_1=\frac r{||x-x_0||_\infty}\ge 1$ and at $t=-t_1$. Thus $h=f\circ g$ is convex on $[-t_1,t_1]$ and hence $$ h(1)\le \frac {h(t_1)+(t_1-1)h(0)}{t_1}$$ and $$ h(0)\le \frac{t_1h(1)+h(-t_1)}{t_1+1}.$$ Solving both for $h(1)-h(0)$, we find $$ \frac{h(0)-h(-t_1)}{t_1}\le h(1)-h(0)\le \frac{h(t_1)-h(0)}{t_1}. $$ Using $h(0)=f(x_0)$, $h(1)=f(x)$, $|h(-t_1)|< M$, $|h(t_1)|< M$ and $0<\frac1{t_1}=\frac{||x-x_0||_\infty}r\le\frac{||x-x_0||_2}r$ we obtain $$|f(x)-f(x_0)|\le \frac {(M+|f(x_0)|)}r\cdot ||x-x_0||_2$$ and finally that $f$ is continuous at $x_0$: $$|f(x)-f(x_0)|<\varepsilon \text{ for all }x\text{ with }|x-x_0|<\delta:=\min\left\{r, \frac{r\varepsilon}{(M+|f(x_0)|)}\right\}.$$


A hypercube in dimension $n$ has $2n$ hyperfaces, not $2^n$. Apparently Bacon does not like this to be corrected (https://math.stackexchange.com/review/suggested-edits/827072). I do not have enough reputation for a proper comment, I'll delete this as soon as someone put it correctly.