# Positive definite matrix proof - why $z^TUDU^Tz \underset {2} = \sum{d_i[U^Tz]^2_i}$ holds

I am studying optimization theory from a german hardcover second hand book I bought lately.

It define:

A symmetric matrix $X$ is positive definite if $z^TXz > 0$ for all $z > \neq 0$.

And then cliams:

$X$ is a positive definite matrix iff it is diagonalizable and its eigenvalues are positive, proof:

$$u^T_jUDU^Tu_j = d_j > 0$$

and on the other hand:

$$z^TXz \underset {1} = z^TUDU^Tz \underset {2} = \sum{d_i[U^Tz]^2_i} \underset{3} \ge 0$$

I don't understand the other hand section. Why does $2$ hold? $1$ and $3$ are obvious.

-

Let $z^{T}U = [a_{1},a_{2}, \dots, a_{n}]$ then $U^{T}z = [a_{1},a_{2}, \dots, a_{n}]^{T}$.

$$z^{T}UDU^{T}z = [a_{1},a_{2}\dots,a_{n}]D[a_{1},a_{2}, \dots, a_{n}]^{T} = [a_1d_1, a_2d_2,\dots a_nd_n] [a_1,a_2,\dots a_n]^{T} = a_1^{2}d_1 + a_{2}^{2}d_{2} +\dots a_n^{2}d_n.$$

-

Let $D =\begin{matrix} \lambda_{1} & 0 & \ldots & 0\\ 0 & \lambda_{2} & \ldots &0\\ \vdots & \vdots & \ddots & \vdots\\ 0 & 0 &\ldots & \lambda_{n} \end{matrix}$

be a diagonal matrix. as proved by the others answers, for every vector $v \in \mathbb{R^n}$

$$v^TDv = \sum_i {\lambda_iv_i^2}$$

-