# Completing the square in N dimensions

Another one of those things that I’ve had to re-derive 100 times, and so I am posting here for future reference.

Take a quadratic equation for a vector .

.

You want to convert this into the form

.

What are , , and ?

First, assume is **symmetric**. Then we have, in decreasing order of obviousness,

Now, suppose is **non-symmetric**. (Of course, still being symmetric is okay, but you would be using a needlessly complicated formula…) Then,

### Like this:

Like Loading...

I like this. Seems like all of numerics is reducing nonlinear problems to linear ones. Always wondered if there was a generalization of the quadratic equation to operators but never got this far..

love it! Many thanks.

Decompose the matrix in the quadratic term as C = S + K, where S is symmetric and K is skew.

Since x’Kx = 0, without loss of generality you can replace C with S = (C + C’) / 2

in the function definition .

Then the formulae for the symmetric case apply for any matrix, after substituting S for C.

Pingback: About the ‘completing the square’ – Liming Shi's Homepage