# Prove $f(x)=(x-3)^2 +4$ is a Convex function?

for convex functions: $$\lambda f(x_1)+(1-\lambda)f(x_2)\geq f(\lambda x_1 +(1-\lambda)x_2)$$ for $\lambda \in [0, 1]$ My solution looks like: $$\lambda (x_1-3)^2 +4\lambda +(1-\lambda)((x-3)^2 +4)\ge\bigl(\lambda x_1+(1-\lambda)x_2 - 3)^2+4$$ $$\lambda (x_1^2+9-6x_1)+4\lambda+(1-\lambda)(x_2^2+13-6x_2) \ge (\lambda x_1+(1-\lambda)x_2-3)^2 +4$$ $$\lambda x_1^2 +x_2^2-\lambda x_2^2-6\lambda x_1-6\lambda x_2+13 \ge \lambda^2x_1^2+x_2^2+\lambda^2x_2^2-\lambda x_2^2+9+2\lambda x_1-2\lambda^2 x_2 x_1-6x_2+6\lambda x_2-6\lambda x_1$$ $$0 \ge\lambda x_1^2 - \lambda^2x_1^2 +\lambda^2x_2^2 +2\lambda x_1+12\lambda x_2 -2\lambda^2x_2x_1-4$$

I am not sure if above solution is correct, but I could not figure out how to proceed from this point.

• The first line of your solution must read $\lambda (x_1-3)^2 +4\lambda +(1-\lambda)((x-3)^2 +4)\ge\bigl(\lambda x_1+(1-\lambda)x_2 - 3)^2+4$ or $\lambda ((x_1-3)^2 +4) +(1-\lambda)((x-3)^2 +4)\ge\bigl(\lambda x_1+(1-\lambda)x_2 - 3)^2+4$ – mfl Oct 12 '16 at 17:52
• yes it should looks like i made a mistake in first step – msj003 Oct 12 '16 at 17:54
• No problem. Correct it and write down your new work. – mfl Oct 12 '16 at 17:55
• Hint: prove that $g(x)=x^2$ is convex. Then prove that, in general, if $g(x)$ is convex then $f(x)=g(x-a) + b$ is also convex. – dxiv Oct 12 '16 at 18:01
• Sum of 2 convex functions is convex – Ahmad Bazzi Oct 12 '16 at 18:04

We need to show that $$\lambda (x_1-3)^2 +4\lambda +(1-\lambda)(x_2-3)^2 +4-4\lambda \ge\bigl(\lambda x_1+(1-\lambda)x_2 - 3)^2+4.$$ That is,

$$\lambda (x_1-3)^2 +(1-\lambda)(x_2-3)^2 \ge\bigl(\lambda x_1+(1-\lambda)x_2 - 3)^2.$$ Equivalently $$\lambda x_1^2+(1-\lambda)x_2^2-6\lambda x_1- 6(1-\lambda) x_2+9$$ $$\ge \lambda^2 x_1^2+(1-\lambda)^2 x_2^2+2\lambda(1-\lambda)x_1x_2-6\lambda x_1-6(1-\lambda)x_ 2+9$$

Simplifying, we arrive at

$$\lambda x_1^2+(1-\lambda)x_2^2+\ge \lambda^2 x_1^2+(1-\lambda)^2 x_2^2+2\lambda(1-\lambda)x_1x_2.$$ Arranging terms

$$\lambda(1-\lambda) x_1^2+\lambda(1-\lambda)x_2^2-2\lambda(1-\lambda)x_1x_2\ge 0.$$ This inequality is equivalent to

$$\lambda(1-\lambda)(x_1-x_2)^2=\lambda(1-\lambda)(x_1^2+x_2^2-2x_1x_2)\ge 0,$$ which clearly holds.

HINT

Use the second derivative

• I want to do it without derivatives but looks like i am stuck in this equation. – msj003 Oct 12 '16 at 17:49

Note that we can write

\begin{align} f(\lambda x_1+(1-\lambda) x_2)&=f(\lambda (x_1-3)+(1-\lambda )(x_2-3))\\\\ &=(\lambda (x_1-3)+(1-\lambda)(x_2-3))^2+4\\\\ &=(\lambda (x_1-3))^2+((1-\lambda)(x_2-3))^2\\\\ &+2\lambda (1-\lambda)(x_1-3)(x_2-3)+4 \tag 1 \end{align}

Furthermore, we can write

$$\lambda f(x_1)+(1-\lambda)f(x_2)=\lambda (x_1-3)^2+(1-\lambda)(x_2-3)^2+4 \tag 2$$

Subtracting $(1)$ from $(2)$ yields

\begin{align} \lambda f(x_1)+(1-\lambda)f(x_2)-f(\lambda x_1+(1-\lambda) x_2)&=\lambda (1-\lambda)(x_1-x_2)^2\\\\ &\ge 0 \end{align}

as was to be shown!

• You're welcome! My pleasure. -Mark – Mark Viola Oct 12 '16 at 18:19
• Please let me know how I can improve my answer. I really want to give you the best answer I can. -Mark – Mark Viola Oct 21 '16 at 16:26
• its a good answer but i can not upvote because i am new here, less than 15 reputation. – msj003 Oct 30 '16 at 23:07
• I believe that you can up vote answers to your own posted questions. – Mark Viola Nov 4 '16 at 21:40
• it says my upvote is recorded but it is not displayed publicly. – msj003 Nov 11 '16 at 4:18