# Show convexity of the quadratic function

Can someone show this function is convex using the definition (without taking gradient)? $$F(x) = x^TAx + b^Tx + c$$

where $A$ is symmetric positive semi-definite.

By definition of convex, for any $x,y\in\mathbb R$, we have $$f(\frac{x+y}2)\leq\frac12(f(x)+f(y))$$ Thus it is sufficient to reduce and prove that $$\frac12(x+y)^TA(x+y)\leq x^TAx+y^TAy\\ x^TAy+y^TAx\leq x^TAx+y^TAy$$ Namely $$(x-y)^TA(x-y)\geq0$$ which is directly followed by positive semi-definite.

• How would this proof change if A were positive definite and not semi-definite? – user2553807 Feb 10 '14 at 22:21
• Nothing except the condition when equality holds. – Shuchang Feb 11 '14 at 6:52
• how do you expand $(x+y)^TA(x+y)$ to the next formula? – Dzung Nguyen Jul 23 '14 at 23:07
• @DzungNguyen According to associative law and distributive law. $(x+y)^TA(x+y)=(x+y)^TAx+(x+y)^TAy$, and similarly for the left $(x+y)^T$. – Shuchang Jul 24 '14 at 2:58
• The first three inequalities should be inverse. – Khue Feb 13 '16 at 5:52

Just to leave the answer for the general case online for future reference. A function is convex if $f(\lambda x + (1-\lambda) y) \leq \lambda f(x) + (1-\lambda) f(y)$ for all $\lambda\in[0,\;1]$.

It suffices to show for a quadratic function $f(x) = x^TQx$. Therefore using the definition of a convex function:

\begin{align} (\lambda x + (1-\lambda) y)^TQ(\lambda x + (1-\lambda) y)\leq \lambda x^TQx + (1-\lambda)y^TQy \end{align} Equality holds for $\lambda = 0\;\text{or}\;1$. Therefore consider $\lambda\in(0,1)$. The left hand side simplifies to: \begin{align} \lambda^2x^TQx + (1-\lambda)^2y^TQy + \lambda(1-\lambda)x^TQy + \lambda(1-\lambda)y^TQx\leq \lambda x^TQx + (1-\lambda)y^TQy \end{align} Rearranging the terms and simplifying one obtains: \begin{align} & \lambda(1-\lambda)x^TQx + \lambda(1-\lambda)y^TQy - \lambda(1-\lambda)x^TQy -\lambda(1-\lambda)y^TQx\geq 0 \\ & \Rightarrow x^TQx + y^TQy -x^TQy-y^TQx \geq 0 \\ & \Rightarrow (x-y)^TQ(x-y) \geq 0 \end{align} which is true for positive semi-definite $Q\succeq 0$.