where is the energy-based positive definiteness test come to be The energy-based inequality $x^TAx > 0$ can be used for testing if a matrix $A$ is positive definite. I wonder where it is from, e.g. is it derived from the more straightforward definition of all eigenvalues being positive somehow?
 A: One motivation for the definition of a positive definite matrix comes from classifying  critical points of a smooth function $f: \mathbb R^n \to\mathbb R$. Suppose $\nabla f(a) = 0$. We would like to know if $a$ is a local maximizer, a local minimizer, or neither. Using the Taylor approximation
\begin{align}
f(x) &\approx f(a) + \nabla f(a)^T(x -a) + \frac12 (x-a)^T Hf(a)(x-a)\\
&= f(a) + \frac12 (x - a)^T Hf(a) (x -a),
\end{align}
we recognize that if the Hessian matrix $Hf(a)$ satisfies $y^T Hf(a) y > 0$ for all vectors $y \neq 0$ then $a$ is a local minimizer for $f$. Thus we have discovered the concept of a positive definite matrix.
Claim: If a symmetric matrix $H \in \mathbb R^{n \times n}$ satisfies $y^T H y > 0$ for all nonzero $y \in \mathbb R^n$ then all the eigenvalues of $H$ must be positive.
Proof: Suppose that $\lambda$ is an eigenvalue of $H$. Because $H$ is symmetric, we know that $\lambda$ is real and that there is a corresponding nonzero eigenvector $v \in \mathbb R^n$. Note that
$$
v^T H v = v^T (\lambda v) = \lambda \| v \|_2^2 > 0 \implies \lambda > 0.
$$
Claim: Suppose that $H \in \mathbb R^{n \times n}$ is a symmetric matrix and all the eigenvalues $\lambda_1, \ldots, \lambda_n$ of $H$ are positive. Then $y^T H y > 0$ for all nonzero vectors $y \in \mathbb R^n$.
Proof: From the spectral theorem, $H$ can be factored as $H = Q \Lambda Q^T$, where $Q$ is orthogonal and
$$
\Lambda = \begin{bmatrix} \lambda_1 & & \\ & \ddots & \\ & & \lambda_n \end{bmatrix}.
$$
If $y \neq 0$ then
$$
y^T H y = y^T Q \Lambda Q^T y = w^T \Lambda w,
$$
where $w = Q^T y \neq 0$. But clearly
$$
w^T \Lambda w = \sum_i \lambda_i w_i^2 > 0.
$$
(Here $w_i$ is the $i$th component of $w$.)
A: We have to assume that $A$ is symmetric, then it can be decomposed (spectral decomposition) into
$A = P \Lambda P^T $
where $\Lambda$ is a diagonal matrix of its eigenvalues, and $P$ is the associated matrix of orthonormal eigenvectors.  It then follows that,
$x^T A x = x^T P \Lambda P^T x $
We can see now that $x^T A x \gt 0$ for all $x$ is true if and only if all the diagonal entries of $\Lambda$ (the eigenvalues) are positive.  This follows from the fact that $P^T x $ can be any vector in $\mathbb{R}^n$.
A: An alternative and equivalent way as @GeometryLover's answer:
The idea is to prove $x^TAx >0$ is a sufficient and necessary condition for $A$ to have all positive eigenvalues.
Suppose A has

*

*eigenvalues $\lambda_1, \cdots, \lambda_D$, and

*eigenvectors $u_1, \cdots, u_D$, which are orthogonal to each other and have unit length.

The eigenvectors form a basis in $\mathbb{R}^D$, so $x$ can be represented as $a_1 u_1 + \cdots + a_D u_D$, where $a_1, \cdots, a_D$ are some coefficients.
Then
\begin{align*}
x^T A x 
&= (a_1 u_1 + \cdots + a_D u_D)^T A (a_1 u_1 + \cdots + a_D u_D) \\
&= (a_1 u_1 + \cdots + a_D u_D)^T (a_1 \lambda_1 u_1 + \cdots + a_D \lambda_D u_D) \\
&= a_1^2 \lambda_1 + \cdots + a_D^2 \lambda_D
\end{align*}
Note, $u_i^T u_j = 1$ if $i = j$, else $0$ as they'd be orthogonal.
Therefore, if all eigenvalues are positive, then $x^T A x > 0$, so $x^TAx$ is a necessary condition. On other hand, using proof by contradiction, suppose one of the eigenvalues $\lambda_i \le 0$, then by taking $x = u_i$, $x^TAx \le 0$, so if $x^TAx > 0$, all eigenvalues must be positive, hence it's a sufficient condition.
