How to show the maximizer of a convex function lies on the boundary? I asked the following questions which is special case of the current question:
How to show maximizer of an inner product over a convex set happens on the boundary?
I want to prove it rigorously. 
Let $f: \mathbb{R}^n \rightarrow \mathbb{R}$ be a convex function and $ C \in \mathbb{R}^n$ be a closed and bounded convex set. Rigorously, how one can show the maximizer of a convex set lies on the boundary?
 A: $C$ is compact, so a maximizer does indeed exist. If $f$ is constant, then every point is a maximizer (which of course include every boundary point).
So assume $f$ is not constant and let $c\in C$ be a maximizer. 
As $f$ is not constant, there exists $x\in C$ such that $f(x)\ne f(c)$. As $c$ is a maximizer, $f(x)<c$. 
For $t\in \Bbb R$, let $\gamma(t)=c+t(c-x)$. Assume $\gamma(t)\in C$ for some $t>0$. Then by convexity of $f$ applied to the points $x,c,\gamma(t)$, $$f(\gamma(t))\ge f(c)+t(f(c)-f(x))>f(c),$$ contradiction. Hence $\gamma(t)\notin C$ for all $t>0$. We conclude that $c\in\partial C$.
A: Since $f$ is a convex function, $\exists m\in C$ such that $f(m)$ is minimum.
Suppose $f$ attains maximum at $M\in C$ such that $M\notin \delta C$. Then $\exists c\in C$ such that the line joining $m$ and $M$ can be extended to $c$ and $f(M)\neq f(c)$. If not then, M is in boundary which contradicts our assumption.
Thus $\exists t\in[0,1]$ such that $M=tm+(1-t)c$.
Hence, $f(M)=f(tm+(1-t)c)\leq tf(m)+(1-t)f(c)\leq tf(c)+(1-t)f(c)=f(c)$ which is a contradiction as $f(M)\geq f(x), \forall x\in C$
