JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Diagonalizing a form by congruence

A quadratic form is messy with cross-terms in one basis and a clean sum of squares in another. The right notion of equivalence is congruence, not similarity, and completing the square is the algorithm that always works.

How a form's matrix changes with the basis

Change coordinates by an invertible P, writing x = P x'. Then B(x, y) = x^T A y = (x')^T (P^T A P) y', so in the new basis the form's matrix is P^T A P, not P^-1 A P. This is congruence, and it is the correct equivalence for forms — distinct from the similarity P^-1 A P that governed operators in Vol I.

The goal: a sum of squares

Diagonalizing a quadratic form means finding coordinates in which it has no cross-terms: q = d_1 y_1^2 + d_2 y_2^2 + ... + d_n y_n^2. Equivalently, finding an invertible P with P^T A P diagonal, i.e. an orthogonal basis for the form — basis vectors that are mutually B-orthogonal, B(e_i, e_j) = 0 for i != j. The remarkable theorem: over any field of characteristic not 2, every symmetric form can be diagonalized.

Complete the square on  q(x) = x1^2 + 4 x1 x2 + x2^2

Group the x1 terms and complete the square:
   q = (x1^2 + 4 x1 x2) + x2^2
     = (x1 + 2 x2)^2 - 4 x2^2 + x2^2
     = (x1 + 2 x2)^2 - 3 x2^2

New coordinates:   y1 = x1 + 2 x2 ,   y2 = x2
   => q = y1^2 - 3 y2^2          (a clean sum of squares)

Matrix view:  A = [1, 2; 2, 1]   congruent to   diag(1, -3)
Signs of the diagonal: one +, one -  (remember this for Guide 4).
Completing the square diagonalizes a quadratic form by congruence.

The completing-the-square algorithm

  1. Pick a variable that appears squared with a nonzero coefficient; gather every term containing it and complete the square, introducing a new variable for the completed group.
  2. What remains is a quadratic form in the other variables only; recurse on it until every variable is used up.
  3. If no squared term is available (e.g. q = 2 x1 x2), first substitute x1 = u + v, x2 = u - v to manufacture squares, then continue.
  4. Compose all the linear substitutions into one P; the result writes q as a sum of squares and exhibits the congruence P^T A P = D.