TITLE: Is $f(x) = x^T A x$ a convex function?
QUESTION [5 upvotes]: Is $f(x) = x^T A x$ a convex function, where  $x \in \mathbb{R}^n$, and $A$ is a $ n\times n$ matrix? 
If not, my question can be reformed to: when is $f(x)$ convex, any restriction for $A$? For example, like positive definite and symmetric?

REPLY [12 votes]: The necessary and sufficient condition for the function $f(x)=x^TAx$ to be convex is that $A+A^T$ is positive semidefinite. 
Reason: $A+A^T$ is the Hessian matrix of $f$.