Lecture 07
Lecture 07
MATH 22B
Unit 7: Gram-Schmidt
Lecture
7.1. For vectors in the linear space Rn , the dot product is defined as v · w = i vi wi .
P
More generally, in the linear space M (n, m) there is a natural dot product Pv·w =
tr(v T w), where tr is the trace, the sum of the diagonal entries. It is the sum i,j vij wij .
√
The dot product allows to compute length |v| = v · v and angles α between two
vectors defined by the equation v · w = |v||w| cos(α). If the relation v · w = 0 holds,
the vectors v and w are called orthogonal.
7.3. Definition. A basis is called orthonormal if all vectors have length 1 and
are orthogonal. Why do we like to have an orthogonal basis? One reason is that
an orthogonal basis looks like the standard basis. Another reason is that rotations
preserving a space V or orthogonal projections onto a space V are easier to describe
if an orthogonal basis is known on V . Let’s look at projections as we will need them
to produce an orthonormal basis. Remember that the projection of a vector x onto
a unit vector v is (v · x)v. We can now give the matrix of a projection onto a space V
if we know an orthonormal basis in V :
Let Q be the matrix containing the basis vk as columns. We can rewrite the result as
P = QQT . We write Q because it is not a n × n matrix like S. The matrix Q contains
the basis of the subspace V and not the basis of the entire space. We will see next week
a more general formula for P which also holds if the vectors are not perpendicular.
Linear Algebra and Vector Analysis
7.6. The recursive process was stated first by Erhard Schmidt (1876-1959) in 1907.
The essence of the formula was already in a 1883 paper by J.P.Gram in 1883 which
Schmidt mentions in a footnote. The process seems to already have been anticipated
by Laplace (1749-1827) and was also used by Cauchy (1789-1857) in 1836.
Figure 1.
Examples
2 1 1
7.7. Problem. Use Gram-Schmidt on {v1 = 0 , v2 =
3 , v3 =
2 }.
0 0 5
1
v1
Solution. 1. w1 = |v1 | = 0 , u1 = w1 .
0
0 0
w2
2. w2 = (v2 − projV1 (v2 )) = v2 − (u1 · v2 )u1 = 3 . u2 = |w2 |
= 1 .
0 0
0 0
w3
3. w3 = (v3 − projV2 (v3 )) = v3 − (u1 · v3 )u1 − (u2 · v3 )u2 = 0 , u3 =
|w3 |
= 0 .
5 1
7.8. From v1 = |v1 |u1 , v2 = (u1 ·v2 )u1 +|w2 |u2 , and v3 = (u1 ·v3 )u1 +(u2 ·v3 )u2 +|w3 |u3 ,
we get the QR decomposition
2 1 1 1 0 0 2 1 1
A = 0 3 2 = 0 1 0 0 3 2 = QR .
0 0 5 0 0 1 0 0 5
7.9. One reason why we are interested in orthogonality is that in statistics, “orthog-
onal” means “uncorrelated”. Data are often alsoarranged in matrices as relational
1 1 0 3
databases. Let’s take the matrices v1 = and v2 = . They span
1 1 3 0
a two dimensional plane in the linear space M (2, 2) of 2 × 2 matrices. We want to
have an orthogonal set of vectors in that plane. Now, how do we do that? We can
use Gram-Schmidt in the same way as with vectors in Rn . One possibility is to write
T T
the matrices as vectors like v1 = 1 1 1 1 and v2 = 0 3 3 0 and pro-
ceed with vectors. But we can also remain within matrices and do the Gram-Schmidt
procedure in M (2, 2). Let us do that. The first step is to normalize the first vector.
1 1
We get u1 = /2. The second step is to produce w2 = v2 − (u1 · v2 )u1 =
1 1
0 3 1 1 −3/2 3/2
−3 /2 = . Now, we have to normalize this to get
3 0 1 1 3/2 −3/2
−1/2 1/2
u2 = w2 /|w2 | = w2 /3 = . Now, B = {u1 , u2 } is an orthonormal basis
1/2 −1/2
in the space X spanned by {v1 , v2 }.
7.10.
Theorem: If S T = S −1 the map T : A → S −1 AS is an orthogonal
transformation from M (n, n) → M (n, n).
Homework
This homework is due on Tuesday, 2/20/2019.
Problem
7.1: Perform
the Gram-Schmidt process on the three vectors
5 2 1
5 2 −1
5 , 4 , 0 } and then write down the QR decomposition.
{
5 2 0