Complete the Square of Quadratic Form (Linear Algebra)

High School Algebra Version

Solving second-order polynomials is not always easy by inspection alone.  For example, consider the equation below.  We need to go through the pain of the quadratic formula or FOIL factoring to solve it.  Not too difficult, but a bit tedious if you ask me.

If we could cast the above equation to look more like this version, however, the answer would be a bit more obvious just by looking at it (x=2).

Turns out they're both the same equation (of course). A manipulation trick known as completing the square gets us from one to the other.

The trick is all about getting rid of linear terms so the equation is purely in terms of order 2 or order 0 (constant).  We call it "completing the square" because we obtain a squared term from a linear term by some careful manipulation.

In order to be applicable, the linear coefficient in the original equation must be an even integer. When this is the case, we always know that:  x^2 + 2b = (x+b)^2 - b^2 

This allows us to solve the equation below:

Among other useful applications, completing the square can be used to derive the quadratic formula.  Check out the derivation here:

Linear Algebra Version

Hopefully the version above was a piece of cake, because the linear algebra version is a bit more complicated.

Here, we're dealing with Quadratic Forms, which are matrix-vector multiplications like so (assuming dimensions match up so multiplication is valid):

Note that the dimension of the result is a scalar, no matter how many entries x and A have. This scalar will depend on a weighted sum of squared entries of x.  Hence the name "quadratic".

Just like above, we're trying to simplify complicated expression involving lots of vectors and matrices into a form like that above.  This will make a solution more accessible (and notation more concise). 

Consider a complicated expression like so: