$f|_{(a, b)}$ convex. Is $f$ convex on $[a, b]$? [closed]

Suppose $f : [a, b] \rightarrow R$ is continuous on $[a, b]$ and convex on the open interval $(a, b).$ Show that $f$ is convex on the closed interval $[a, b].$

closed as off-topic by uniquesolution, Claude Leibovici, mrp, Namaste, ShaileshMar 13 '17 at 14:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – mrp, Namaste
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome Math.SE! Take the tour to get familiar with this site. Mathematical expressions and equations can be formatted using $\LaTeX$ syntax. This appears to be a homework question, please share your thoughts and attempts towards the solution. If you receive useful answers, consider accepting one. – Shailesh Mar 13 '17 at 7:42
• To give you an idea, you will have to use the following very basic property of continuous functions: If $h(x) \geq 0$ on $(a,b)$, then $h(x) \geq 0$ on $[a,b]$. You have to - of course - define $h$ in such a way, that $h(x) \geq 0$ tests convexity of $f$. – MooS Mar 13 '17 at 7:50
• I'm voting to close this question as off-topic because it is another "Do-my-homework" question showing zero effort. – uniquesolution Mar 13 '17 at 8:07

It is enough to check that $f\bigl(tx+(1-t)y\bigr)\le tf(x)+(1-t)f(y)$ for any $t\in[0,1]$ and $x\in[a,b]$. If $x,y\in(a,b)$, then we have it by convexity. If, for instance, $x=a,y\in(a,b)$, then take $x_n=a+\frac{1}{n}$ and pass to a limit with $n\to\infty$. The remaining cases are handled in a similar way.
The statement remains true, if $f(a^+)\le f(a)$ and $f(b^-)\le f(b)$. These limits do exist, because $f$ is either monotone, or unimodal in the sense that $f$ decreases (possibly weakly) on $[a,c]$ and increases (possibly weakly) on $[c,b]$ for some $c\in(a,b)$. The monotonic functions admit one-sided limits.