# 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?

## 3 Answers

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}$.

• So i was right about the finding the eigen value of... $\begin{bmatrix} 3&0&8 \\0&2&0 \\ 8&0&1 \end{bmatrix}$ Does $y=P^Tx$ just mean i should find the P of A and then transpose than and multiply A by that? – kingportable Oct 27 '15 at 23:28
• I think you meant, find the transpose of P and multiply x by that. – Element118 Oct 27 '15 at 23:34
• We have $\mathbf{x}=\left(\begin{matrix}x&y&z\end{matrix}\right)^T$ and $\mathbf{y}=\mathbf{P^Tx}$. What are you trying to find? – Element118 Oct 27 '15 at 23:42
• Did you mean you are trying to find $\mathbf{P}$? – Element118 Oct 27 '15 at 23:46
• $\mathbf{y}=\mathbf{P^Tx}$ is the same as $\mathbf{x}=\mathbf{Py}$ as $\mathbf{P}$ is orthogonal and $\mathbf{P^T}=\mathbf{P^{-1}}$. – Element118 Oct 27 '15 at 23:57

Ummm, $$(4x+z)^2 = 16 x^2 + 8 x z + z^2,$$ so $$-13 x^2 + (4x+z)^2 = 3 x^2 + 8 x z + z^2,$$ $$-13 x^2 + (4x+z)^2 + 2 y^2 = 3 x^2 + 8 x z + z^2 + 2 y^2 = Q(x,y,z).$$ Note $Q(1,0,-1) = -4$

If $$D = \left( \begin{array}{ccc} -13 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 2 \end{array} \right)$$ and $$R = \left( \begin{array}{ccc} 1 & 0 & 0 \\ 4 & 0 & 1 \\ 0 & 1 & 0 \end{array} \right),$$ what is $$R^T D R?$$

• Wait so now my matrix is wrong? – kingportable Oct 28 '15 at 0:09
• @kingportable, the product $R^T D R$ is exactly the matrix the other answer is calling $A.$ I see your second matrix, all numbers, is now the same as $A.$ Please confirm the product $R^T D R.$ – Will Jagy Oct 28 '15 at 0:14
• @king, now, given $$v = \left( \begin{array}{c} x \\ y \\z \end{array} \right)$$ is a column vector with row vector $v^T = (x,y,z),$ please confirm $v^T A v$ where $A$ is as in the other answer. I am concerned about the first matrix in your question, it appears you need reinforcement in the way these matrices and the quadratic forms are related. Please. It will help you. Write it out yourself, by hand. – Will Jagy Oct 28 '15 at 0:28
• Hey how come our p-values are different? $\lambda_1 = 2+\sqrt{17}=6.123, \quad \lambda_2 = 2-\sqrt{17}=-2.1231..., \quad \lambda_3 = 2$ – kingportable Oct 28 '15 at 6:39
• Oh wait $R^TDR = \begin{pmatrix} 3&0&4 \\0&2&0 \\ 4&0&1 \end{pmatrix}$ but how is that, that means my eigen values are completely wrong? – kingportable Oct 28 '15 at 6:40

How's this?

$$\begin{pmatrix} 3&0&4 \\0&2&0 \\ 4&0&1 \end{pmatrix}$$

i found the determinant which had the equation.... $$det(A-\lambda I)= -\lambda^3 +6\lambda ^2 +5\lambda -26$$

$\color{green}{ \text{As f(x) = 0 at x=2 (x-2) is a factor and by long divisiong}}$ $$det(A-\lambda I)= -(x-2)(x^2-4x-13)$$ $$\lambda_1 = 2+\sqrt{17}=6.123, \quad \lambda_2 = 2-\sqrt{17}=-2.1231..., \quad \lambda_3 = 2$$

From which we can tell it's positive indefinite

Now i have to find the eigenvectors? Which is the the "P" in x=Py.

$$\begin{pmatrix}-1+\sqrt{17}\:\:\:\: & \:\:\:\:0\:\:\:\: & \:\:\:\:4\:\:\:\: \\0\:\:\:\: & \:\:\:\:-2+\sqrt{17}\:\:\:\: & \:\:\:\:0\:\:\:\: \\4\:\:\:\: & \:\:\:\:0\:\:\:\: & \:\:\:\:-3+\sqrt{17}\end{pmatrix}\:$$

Just wanted to check because this matrix is hard