Skip to content

Orthogonal Matrices and Gram-Schmidt

In this lecture we finish introducing orthogonality. Using an orthonormal basis or a matrix with orthonormal columns makes calculations much easier. The Gram-Schmidt process starts with any basis and produces an orthonormal basis that spans the same space as the original basis.

Orthonormal Vectors

The vectors q1,q2,,qn are orthonormal if:

qiTqj={0, if ij1, if i=j

In other words, they all have (normal) length 1 and are perpendicular(orthonormal) to each other. Orthonormal vectors are always independent.

Orthonormal Matrix

If the columns of Q=[q1qn] are orthonormal, then QTQ=I is the identity.

Matrices with orthonormal columns are a new class of important matrices to add to those on our list:

  • triangular
  • diagonal
  • permutation
  • symmetric
  • reduced row echelon
  • projection

We'll call them orthonormal matrices.

A square orthonormal matrix Q is called an orthogonal matrix. If Q is square, then QTQ=I tells us that:

QT=Q1

For example, if Q=[001100010] then QT=[010001100]. Both Q and QT are orthogonal matrices, and their product is the identity.

The matrix Q=[cosθsinθsinθcosθ] is orthogonal. The matrix [1111] is not, but we can adjust that matrix to get the orthogonal matrix Q=12[1111]. We can use the same tactic to find some larger orthogonal matrices called Hadamard matrices:

Q=12[1111111111111111]

An example of a rectangular matrix with orthonormal columns is:

Q=13[122122]

We can extend this to a (square) orthogonal matrix:

13[122212221]

These examples are particularly nice because they don't include complicated square roots.

Orthonormal Columns are Good

Suppose Q has orthonormal columns, The matrix that projects onto the column space of Q is:

P=Q(QTQ)1QT

If the columns of Q are orthonormal, then QTQ=I and P=QQT. If Q is square, then P=I because the columns of Q span the entire space.

Many equations become trivial when using a matrix with orthonormal columns. If our basis is orthonormal, the projection component xi^ is just qiTb because ATAx^=ATb becomes x^=QTb.

Gram-Schmidt

With elimination, our goal was make the matrix triangular. Now our goal is make the matrix orthonormal.

We start with two independent vectors a and b and want to find orthonormal vectors q1 and q2 that span the same plane. We start by finding orthogonal vectors A and B that span the same space as a and b. Then the unit vectors q1=A||A|| and q2=B||B|| from the desired orthonormal basis.

Let A=a. We get a vector orthogonal to A in the space spanned by a and b by projecting b onto a and letting B=bp. (B is what we previously called e.)

B=bATbATAA

If we multiply both sides of this equation by AT, we see that ATB=0

What if we had started with three independent vectors, a, b and c? Then we'd find a vector C orthogonal to both A and B by subtracting from c its components in the A and B directions:

C=cATcATAABTcBTBB

For example, suppose a=[111] and b=[102]. Then A=a and:

B=[102]ATbATA[111]=[102]33[111]=[011]

Normalizing, we get:

Q=[q1q2]=[1/301/31/21/31/2]

The column space of Q is the plane spanned by a and b.

When we studied elimination, we wrote the process in terms of matrices and found A=LU. A similar equation A=QR relates our starting matrix A to the result Q of the Gram-Schmidt process. Where L was lower triangular, R is upper triangular.

Suppose A=[a1a2], then:

A=QR
[a1a2]=[q1q2][a1Tq1a2Tq1a1Tq2a2Tq2]

If R is upper triangular, then it should be true that a1Tq2=0. This must be true because we chose q1 to be a unit vector in the direction of a1. All the latter qi were chosen to be perpendicular to the earlier ones.

Notice that R=QTA. This makes sense; QTQ=I.