# Continuity of a convex function

I'm trying to solve the following problem:

Let $f:K\rightarrow \mathbb{R}$, $f$ convex and $K \subseteq \mathbb{R}^n$ convex. Then $f$ is continuous on $K$.

I have proved the only case $n=1$, but for an arbitrary $n$??

-
Hint: consider function $t \mapsto f(x + tv)$, where $x, v \in \mathbb{R}^n$ and $t$ being a scalar. – dtldarek Oct 19 '12 at 7:24
The function $f$ may be discontinuous at every point on the boundary of $K$ (including when $n=1$). You might want to show your proof of the case $n=1$. – Did Oct 19 '12 at 9:01
$K$ should be open! – wj32 Oct 19 '12 at 21:30
@dtldarek ok, $\varphi: \mathbb{R}\rightarrow \mathbb{R}$ such that $t \longmapsto f(x+tv)$ is a convex function, because is given by $f$ on the direction of $v$. Besides I have proved the problem for $n=1$ then $\varphi$ is continuous. For the arbitrariety of $x$ and $v$ $f$ is continuous $\forall \ x$ and $v \in \mathbb{R}^n$ then $f$ is continuous on $K$. It's right? – Madara Oct 20 '12 at 6:49
@Madara: $K$ convex is useless, as did and wj32 already note in their comments and as I show in the answer below even for the simple case $n=1$. And as $did$ noted, this implies that your proof for $n=1$ must be flawed. – Hagen von Eitzen Oct 20 '12 at 8:49

$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^k$ 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|\sqrt n}r$ we obtain $$|f(x)-f(x_0)|\le \frac {(M+|f(x_0)|)\sqrt n}r\cdot |x-x_0|$$ 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)|)\sqrt n}\right\}.$$