# Quadratic Form - Finding the Coefficient matrix [closed]

I'm new here, I would like some help in solving this particular Quadratic form with matrices using the method described:

Quadratic forms - Completing squares

$$A = \begin{bmatrix} 1 & 1 & 2\\ 1 & -1 & 1\\ 2 & 1 & 3\end{bmatrix}$$

I've managed to solve the example given on the link provided and I understand why things are as they are pretty well without much trouble but I can't seem to solve my own problem, why? What I mostly want to know is how to find Q (Coefficient matrix)

## closed as off-topic by A. Goodier, Saad, Shailesh, Xander Henderson, user223391 Apr 7 '18 at 3:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – A. Goodier, Saad, Shailesh, Xander Henderson, Community
If this question can be reworded to fit the rules in the help center, please edit the question.

• A good question should be self-contained. For example, you say that you can follow the example given if we follow the link. Can you please summarize your solution to that example, then try to explain where you are getting stuck in your own example? It would also help if you provided us with some basic definitions (e.g. what is a "coefficient matrix"?). – Xander Henderson Apr 7 '18 at 0:38

## 1 Answer

I show the algorithm below. It is helpful in some ways. However, it need not give the "simplest" expression; here we could also write $$(x+y+2z)^2 - (y+z)^2 - y^2 = x^2 - y^2 + 3 z^2 + 2 yz + 4 zx + 2xy$$

The method used to go in this direction is usually called repeated "completing the square," and hardly requires matrices to do by hand.

$$Q^T D Q = H$$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ 1 & 1 & 1 \\ 2 & 1 & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & - 1 & 0 \\ 0 & 0 & - 1 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 1 & 2 \\ 0 & 1 & 1 \\ 0 & 1 & 0 \\ \end{array} \right) = \left( \begin{array}{rrr} 1 & 1 & 2 \\ 1 & - 1 & 1 \\ 2 & 1 & 3 \\ \end{array} \right)$$

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

As there are just three elementary matrices $E_j,$ we end up with $$P = E_1 E_2 E_3$$ and $$P^{-1} = Q = E_3^{-1} E_2^{-1} E_1^{-1}$$

Algorithm discussed at http://math.stackexchange.com/questions/1388421/reference-for-linear-algebra-books-that-teach-reverse-hermite-method-for-symmetr
$$H = \left( \begin{array}{rrr} 1 & 1 & 2 \\ 1 & - 1 & 1 \\ 2 & 1 & 3 \\ \end{array} \right)$$ $$D_0 = H$$

$$E_j^T D_{j-1} E_j = D_j$$ $$P_{j-1} E_j = P_j$$ $$E_j^{-1} Q_{j-1} = Q_j$$ $$P_j Q_j = Q_j P_j = I$$ $$P_j^T H P_j = D_j$$ $$Q_j^T D_j Q_j = H$$

$$H = \left( \begin{array}{rrr} 1 & 1 & 2 \\ 1 & - 1 & 1 \\ 2 & 1 & 3 \\ \end{array} \right)$$

==============================================

$$E_{1} = \left( \begin{array}{rrr} 1 & - 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{1} = \left( \begin{array}{rrr} 1 & - 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{1} = \left( \begin{array}{rrr} 1 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{1} = \left( \begin{array}{rrr} 1 & 0 & 2 \\ 0 & - 2 & - 1 \\ 2 & - 1 & 3 \\ \end{array} \right)$$

==============================================

$$E_{2} = \left( \begin{array}{rrr} 1 & 0 & - 2 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{2} = \left( \begin{array}{rrr} 1 & - 1 & - 2 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{2} = \left( \begin{array}{rrr} 1 & 1 & 2 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{2} = \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & - 2 & - 1 \\ 0 & - 1 & - 1 \\ \end{array} \right)$$

==============================================

$$E_{3} = \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & - \frac{ 1 }{ 2 } \\ 0 & 0 & 1 \\ \end{array} \right)$$ $$P_{3} = \left( \begin{array}{rrr} 1 & - 1 & - \frac{ 3 }{ 2 } \\ 0 & 1 & - \frac{ 1 }{ 2 } \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; Q_{3} = \left( \begin{array}{rrr} 1 & 1 & 2 \\ 0 & 1 & \frac{ 1 }{ 2 } \\ 0 & 0 & 1 \\ \end{array} \right) , \; \; \; D_{3} = \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & - 2 & 0 \\ 0 & 0 & - \frac{ 1 }{ 2 } \\ \end{array} \right)$$

==============================================

$$P^T H P = D$$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ - 1 & 1 & 0 \\ - \frac{ 3 }{ 2 } & - \frac{ 1 }{ 2 } & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 1 & 2 \\ 1 & - 1 & 1 \\ 2 & 1 & 3 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & - 1 & - \frac{ 3 }{ 2 } \\ 0 & 1 & - \frac{ 1 }{ 2 } \\ 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & - 2 & 0 \\ 0 & 0 & - \frac{ 1 }{ 2 } \\ \end{array} \right)$$ $$Q^T D Q = H$$ $$\left( \begin{array}{rrr} 1 & 0 & 0 \\ 1 & 1 & 0 \\ 2 & \frac{ 1 }{ 2 } & 1 \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 0 & 0 \\ 0 & - 2 & 0 \\ 0 & 0 & - \frac{ 1 }{ 2 } \\ \end{array} \right) \left( \begin{array}{rrr} 1 & 1 & 2 \\ 0 & 1 & \frac{ 1 }{ 2 } \\ 0 & 0 & 1 \\ \end{array} \right) = \left( \begin{array}{rrr} 1 & 1 & 2 \\ 1 & - 1 & 1 \\ 2 & 1 & 3 \\ \end{array} \right)$$

..............

• Thanks a lot for the quick reponse, very much appreciated, apparently I had been mixing up the formulas to PDP and QHQ for some reason... – Math-Templar Apr 6 '18 at 18:08
• @Math-Templar I added a different expression at the beginning. It generally gives better expressions if it works, fewer fractions, but does require some thought. – Will Jagy Apr 6 '18 at 18:13
• Thanks, Yeah I did do this version myself too, although like I've said, I confused the formulas for some reason :) – Math-Templar Apr 6 '18 at 18:19