Welcome to our community

Be a part of something great, join today!

Using matrix to complete the square

PhizKid

New member
Dec 12, 2013
2
Given a quadratic form: [tex]x^2 - 4xy + 6xz + 2xt + 4y^2 + 2yz + 4yt + 5z^2 - 6zt - t^2[/tex], find the symmetric matrix that defines this, row reduce this matrix into row echelon form, and use this upper triangle matrix to complete the square and write the quadratic form as the sum/difference of squares.


So here is the matrix representation using x, y, z, and t as the diagonals from left to right and x being the first order, y second order, z third order, t fourth order:

[tex]\left[ \begin{array}{cccc}1 & -2 & 3 & 1 \\-2 & 4 & 1 & 2 \\3 & 1 & 5 & -3 \\1 & 2 & -3 & -1 \\\end{array} \right][/tex]

Row echelon:

[tex]\left[ \begin{array}{cccc}1 & -2 & 3 & 1 \\0 & 7 & -4 & -6 \\0 & 0 & 7 & 4 \\0 & 0 & 0 & \frac{174}{49} \\\end{array} \right][/tex]

NOTE: Rows 2 and 3 were switched during this process!! (It was unavoidable.)

Now, I'm not sure what to do with this matrix, as it's no longer the same matrix that represents the original quadratic.
 

Sudharaka

Well-known member
MHB Math Helper
Feb 5, 2012
1,621
Given a quadratic form: [tex]x^2 - 4xy + 6xz + 2xt + 4y^2 + 2yz + 4yt + 5z^2 - 6zt - t^2[/tex], find the symmetric matrix that defines this, row reduce this matrix into row echelon form, and use this upper triangle matrix to complete the square and write the quadratic form as the sum/difference of squares.


So here is the matrix representation using x, y, z, and t as the diagonals from left to right and x being the first order, y second order, z third order, t fourth order:

[tex]\left[ \begin{array}{cccc}1 & -2 & 3 & 1 \\-2 & 4 & 1 & 2 \\3 & 1 & 5 & -3 \\1 & 2 & -3 & -1 \\\end{array} \right][/tex]

Row echelon:

[tex]\left[ \begin{array}{cccc}1 & -2 & 3 & 1 \\0 & 7 & -4 & -6 \\0 & 0 & 7 & 4 \\0 & 0 & 0 & \frac{174}{49} \\\end{array} \right][/tex]

NOTE: Rows 2 and 3 were switched during this process!! (It was unavoidable.)

Now, I'm not sure what to do with this matrix, as it's no longer the same matrix that represents the original quadratic.

Hi PhizKid, :)

To find the canonical form of this quadratic form follow the steps outlined in the following link.

Engineering Mathematics, Volume 2 > 2. Quadratic Forms > 2.7 Methods of Reduction of a Quadratic Form to a Canonical Form - Pg. : Safari Books Online
 

PhizKid

New member
Dec 12, 2013
2
Hi, it says I have to pay money to read it.
 

Opalg

MHB Oldtimer
Staff member
Feb 7, 2012
2,706
Given a quadratic form: [tex]x^2 - 4xy + 6xz + 2xt + 4y^2 + 2yz + 4yt + 5z^2 - 6zt - t^2[/tex], find the symmetric matrix that defines this, row reduce this matrix into row echelon form, and use this upper triangle matrix to complete the square and write the quadratic form as the sum/difference of squares.


So here is the matrix representation using x, y, z, and t as the diagonals from left to right and x being the first order, y second order, z third order, t fourth order:

[tex]\left[ \begin{array}{cccc}1 & -2 & 3 & 1 \\-2 & 4 & 1 & 2 \\3 & 1 & 5 & -3 \\1 & 2 & -3 & -1 \\\end{array} \right][/tex]

Row echelon:

[tex]\left[ \begin{array}{cccc}1 & -2 & 3 & 1 \\0 & 7 & -4 & -6 \\0 & 0 & 7 & 4 \\0 & 0 & 0 & \frac{174}{49} \\\end{array} \right][/tex]

NOTE: Rows 2 and 3 were switched during this process!! (It was unavoidable.)

Now, I'm not sure what to do with this matrix, as it's no longer the same matrix that represents the original quadratic.
The usual echelon process is used on a matrix that encodes a system of linear equations. The matrix here encodes a quadratic form, so a slightly different form of echelon process is needed. I have not seen this process before, but it must work like this: For the matrix $\begin{bmatrix}1 & -2 & 3 & 1 \\-2 & 4 & 1 & 2 \\3 & 1 & 5 & -3 \\1 & 2 & -3 & -1\end{bmatrix}$, you start in the usual way, getting zeros down the first column. This reduces the matrix to $\begin{bmatrix}1 & -2 & 3 & 1 \\0&0&7&4 \\0&7&-4&-6 \\0&4&-6&0\end{bmatrix}$.

Next, you want to exchange rows 2 and 3. In the usual Gaussian reduction process where the matrix represents a system of linear equations, that corresponds to switching the order of two equations. But the situation here is different. Each row and each column of the matrix is associated with one of the variables $x,\ y,\ z,\ t$ in the quadratic form. When you interchange rows 2 and 3, you are effectively switching the variables $y$ and $z$, and this means that you must also interchange columns 2 and 3. So instead of getting the matrix $\begin{bmatrix}1 & -2 & 3 & 1 \\0&7&-4&-6 \\ 0&0&7&4 \\0&4&-6&0\end{bmatrix}$, you get $\begin{bmatrix}1 & 3&-2 & 1 \\0&-4&7&-6 \\ 0&7&0&4 \\0&-6&4&0\end{bmatrix}$. You can now continue the echelon process in the usual way. If I have not made arithmetic mistakes, the reduced matrix is $\begin{bmatrix}1 & 3&-2 & 1 \\0&-4&7&-6 \\ 0&0& \frac{49}4& -\frac{13}2 \\0&0&0& \frac{272}{49} \end{bmatrix}$.

The next stage of the problem is to read off the information from the echelon form of the matrix to get a sum of squares. This also is new territory for me, but it seems to work like this: Use the top row of the matrix as coefficients for a linear combination of $x,\ z,\ y,\ t$ (remembering that $y$ and $z$ have been interchanged!), to get $(x + 3z - 2y + t)^2$. For the remaining rows, the coefficient on the main diagonal of the matrix stays outside the brackets, and all the coefficients inside the bracket get divided by that coefficient. So the next row of the matrix gives $-4\bigl(z - \frac74y + \frac32t \bigr)^2$. The final result is that $$\begin{aligned}x^2 - 4xy\! &{}+ 6xz + 2xt + 4y^2 + 2yz + 4yt + 5z^2 - 6zt - t^2 \\ &= (x + 3z - 2y + t)^2 - 4\bigl(z - \tfrac74y + \tfrac32t \bigr)^2 + \tfrac{49}4\bigl(y - \tfrac{26}{49}t \bigr)^2 + \tfrac{272}{49}t^2. \end{aligned}$$ I have not checked it in detail, but it does seems as though that is a correct algebraic identity. Amazing! (Nod) In 40 years of teaching linear algebra, I never came across this procedure. It is not at all obvious why it works, and I would be interested to know the theory behind it.
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,780
It is not at all obvious why it works, and I would be interested to know the theory behind it.
It looks like an LDL Cholesky decomposition, which is guaranteed to exist for a symmetric matrix.
That is,
$$x^TAx= x^T L D L^T x = (L^T x) D (L^T x)$$
where L is a lower unitriangular matrix and D is a diagonal matrix.

It's new to me as well, although Sudharaka posted a thread a little while ago to bring a quadric in a normal form that looks like this.
It's quite a bit faster to classify a quadric, than the regular procedure to find eigenvalues and eigenvectors. :)