<s>[INST] Express a quadratic form in three variable in the format $x^tAx$ using a substitution $x=Py$ I was asked to determine if a quadratic form is positive definite. To do so I must convert in the format $x^tAx$ using a substitution x=Py. So that "it can be written in diagonal form".
$$Q(x,y,z) = 3x^2 + 8xz+2y^2+z^2$$
My idea is:
$$(x,y,z) \begin{pmatrix} 3x+4z \\ 2y \\ 4x+z^2 \end{pmatrix} $$ 
$$\begin{pmatrix} 3&0&4 \\0&2&0 \\ 4&0&1 \end{pmatrix} $$ 
Is this correct? And then it would be positive definite if all eigen values of this are equal to or larger than 0?
 [/INST] The matrix should be:
$$\mathbf{A}=\left(\begin{matrix}3&0&4\\0&2&0\\4&0&1\end{matrix}\right)$$
Multiplying $\mathbf{x^TAx}$ out where $\mathbf{x}=\left(\begin{matrix}x&y&z\end{matrix}\right)^T$ gives:
$$\left(\begin{matrix}x&y&z\end{matrix}\right)\left(\begin{matrix}3&0&4\\0&2&0\\4&0&1\end{matrix}\right)\left(\begin{matrix}x\\y\\z\end{matrix}\right)=\left(\begin{matrix}x&y&z\end{matrix}\right)\left(\begin{matrix}3x+4z\\2y\\4x+z\end{matrix}\right)\\=3x^2+4xz+2y^2+4xz+z^2=3x^2+8xz+2y^2+z^2$$
We can orthogonally diagonalise $\mathbf{A}=\mathbf{PDP^T}$ as $\mathbf{A}$ is symmetric. If we let $\mathbf{y}=\mathbf{P^Tx}$, then $$\mathbf{x^TPDP^Tx}=\mathbf{y^TDy}$$
which is in the form $\lambda_1y_1^2+\lambda_2y_2^2+\lambda_3y_3^2$, where $\lambda_i$ are the eigenvalues and $\mathbf{y}=\left(\begin{matrix}y_1&y_2&y_3\end{matrix}\right)^T$.
Hence, a quadratic form being positive definite is equivalent to nonnegative eigenvalues of $\mathbf{A}$.
</s>