lecture 26 - dartmouth college · 2017. 8. 16. · lecture 26 math 22 summer 2017 august 16, 2017....

150
Lecture 26 Math 22 Summer 2017 August 16, 2017

Upload: others

Post on 20-Mar-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

Lecture 26Math 22 Summer 2017

August 16, 2017

Page 2: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

Just for today

I §6.4 Finish upI §6.5 Least-squares problems

Page 3: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 Gram-Schmidt Review

Consider a basis {x1, . . . , xp} for a subspace W ⊆ Rn. We sawthat the Gram-Schmidt algorithm produces an orthogonal basis{v1, . . . , vp} where v1 = x1 and for k ∈ {2, . . . , p} we have

vk = xk −(k−1∑

i=1

xk · vivi · vi

vi

).

Moreover, Span{v1, . . . , vk} = Span{x1, . . . , xk} for everyk ∈ {1, . . . , p}.

Page 4: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 Gram-Schmidt Review

Consider a basis {x1, . . . , xp} for a subspace W ⊆ Rn.

We sawthat the Gram-Schmidt algorithm produces an orthogonal basis{v1, . . . , vp} where v1 = x1 and for k ∈ {2, . . . , p} we have

vk = xk −(k−1∑

i=1

xk · vivi · vi

vi

).

Moreover, Span{v1, . . . , vk} = Span{x1, . . . , xk} for everyk ∈ {1, . . . , p}.

Page 5: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 Gram-Schmidt Review

Consider a basis {x1, . . . , xp} for a subspace W ⊆ Rn. We sawthat the Gram-Schmidt algorithm produces an orthogonal basis{v1, . . . , vp}

where v1 = x1 and for k ∈ {2, . . . , p} we have

vk = xk −(k−1∑

i=1

xk · vivi · vi

vi

).

Moreover, Span{v1, . . . , vk} = Span{x1, . . . , xk} for everyk ∈ {1, . . . , p}.

Page 6: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 Gram-Schmidt Review

Consider a basis {x1, . . . , xp} for a subspace W ⊆ Rn. We sawthat the Gram-Schmidt algorithm produces an orthogonal basis{v1, . . . , vp} where v1 = x1 and for k ∈ {2, . . . , p} we have

vk = xk −(k−1∑

i=1

xk · vivi · vi

vi

).

Moreover, Span{v1, . . . , vk} = Span{x1, . . . , xk} for everyk ∈ {1, . . . , p}.

Page 7: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 Gram-Schmidt Review

Consider a basis {x1, . . . , xp} for a subspace W ⊆ Rn. We sawthat the Gram-Schmidt algorithm produces an orthogonal basis{v1, . . . , vp} where v1 = x1 and for k ∈ {2, . . . , p} we have

vk = xk −(k−1∑

i=1

xk · vivi · vi

vi

).

Moreover, Span{v1, . . . , vk} = Span{x1, . . . , xk} for everyk ∈ {1, . . . , p}.

Page 8: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns. Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A. Let Q = [u1 · · · un].Since xk ∈ Span{u1, . . . , uk}, we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR. How do we guaranteethat the diagonal of R is nonnegative?

Page 9: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns.

Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A. Let Q = [u1 · · · un].Since xk ∈ Span{u1, . . . , uk}, we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR. How do we guaranteethat the diagonal of R is nonnegative?

Page 10: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns. Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A.

Let Q = [u1 · · · un].Since xk ∈ Span{u1, . . . , uk}, we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR. How do we guaranteethat the diagonal of R is nonnegative?

Page 11: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns. Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A. Let Q = [u1 · · · un].

Since xk ∈ Span{u1, . . . , uk}, we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR. How do we guaranteethat the diagonal of R is nonnegative?

Page 12: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns. Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A. Let Q = [u1 · · · un].Since xk ∈ Span{u1, . . . , uk},

we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR. How do we guaranteethat the diagonal of R is nonnegative?

Page 13: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns. Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A. Let Q = [u1 · · · un].Since xk ∈ Span{u1, . . . , uk}, we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR. How do we guaranteethat the diagonal of R is nonnegative?

Page 14: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns. Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A. Let Q = [u1 · · · un].Since xk ∈ Span{u1, . . . , uk}, we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular

andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR. How do we guaranteethat the diagonal of R is nonnegative?

Page 15: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns. Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A. Let Q = [u1 · · · un].Since xk ∈ Span{u1, . . . , uk}, we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR.

How do we guaranteethat the diagonal of R is nonnegative?

Page 16: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.4 QR factorization review

Let A = [x1 · · · xn] be an m × n matrix with linearly independentcolumns. Via the Gram-Schmidt algorithm we can construct anorthonormal basis {u1, . . . , un} for Col A. Let Q = [u1 · · · un].Since xk ∈ Span{u1, . . . , uk}, we can write

xk = r1ku1 + · · ·+ rkkuk + 0uk+1 + · · ·+ 0un = Qrk , rk =

r1k...

rkk0...0

Then R := [r1 · · · rn] is upper triangular andA = [x1 · · · xn] = [Qr1 · · · Qrn] = QR. How do we guaranteethat the diagonal of R is nonnegative?

Page 17: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 18: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

Definition

Let A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 19: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix.

Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 20: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn.

A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 21: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 22: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 23: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 24: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖

(the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 25: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 26: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection.

LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 27: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A.

Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 28: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b.

Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 29: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent,

and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 30: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution.

Why? Best approximationtheorem.

Let’s see how the details work.

Page 31: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why?

Best approximationtheorem.

Let’s see how the details work.

Page 32: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 33: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Least-squares solutions

DefinitionLet A be an m × n matrix. Let b ∈ Rn. A least-squares solutionof the matrix equation Ax = b is a vector x̂ ∈ Rn such that

‖Ax̂− b‖ ≤ ‖Ax− b‖

for all x ∈ Rn.

The least-squares error is ‖b− Ax̂‖ (the distance between b andAx̂).

We can obtain a least-squares solution via projection. LetW = Col A. Let b̂ = projW b. Then Ax = b̂ is consistent, and anysolution x̂ is a least-squares solution. Why? Best approximationtheorem.

Let’s see how the details work.

Page 34: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 35: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

.

Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 36: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 37: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No!

Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 38: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 39: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis.

Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 40: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b.

To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 41: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options.

One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 42: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W .

Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 43: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these!

Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 44: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1.

Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 45: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 46: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K

Let A = [a1 a2] =

2 15 17 18 1

, and b =

1233

. Is Ax = b consistent?

No! Let’s find a least-squares solution.

Let W = Col A and verify that {a1, a2} is a basis. Letb̂ = projW b. To compute b̂ there are many options. One is to usean orthogonal basis for W . Glad we know how to find these! Letv1 = a1. Let

v2 = a2 −a2 · v1v1 · v1

v1 =

49/7116/71−6/71−17/71

.

So W has orthogonal basis {v1, v2}.

Page 47: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We can now compute

b̂ = b · v1v1 · v1

v1 + b · v2v2 · v2

v2 =

1

29/1439/14

22/7

.

Now to find a least-squares solution we can simply use theaugmented matrix

[A b̂] ∼

1 0 5/140 1 2/70 0 00 0 0

to get that x̂ =

[5/14

2/7

]is a least-squares solutions to Ax = b.

Page 48: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We can now compute

b̂ = b · v1v1 · v1

v1 + b · v2v2 · v2

v2 =

1

29/1439/14

22/7

.

Now to find a least-squares solution we can simply use theaugmented matrix

[A b̂] ∼

1 0 5/140 1 2/70 0 00 0 0

to get that x̂ =

[5/14

2/7

]is a least-squares solutions to Ax = b.

Page 49: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We can now compute

b̂ = b · v1v1 · v1

v1 + b · v2v2 · v2

v2 =

1

29/1439/14

22/7

.

Now to find a least-squares solution we can simply use theaugmented matrix

[A b̂] ∼

1 0 5/140 1 2/70 0 00 0 0

to get that x̂ =

[5/14

2/7

]is a least-squares solutions to Ax = b.

Page 50: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We can now compute

b̂ = b · v1v1 · v1

v1 + b · v2v2 · v2

v2 =

1

29/1439/14

22/7

.

Now to find a least-squares solution we can simply use theaugmented matrix

[A b̂] ∼

1 0 5/140 1 2/70 0 00 0 0

to get that x̂ =[

5/142/7

]is a least-squares solutions to Ax = b.

Page 51: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We can now compute

b̂ = b · v1v1 · v1

v1 + b · v2v2 · v2

v2 =

1

29/1439/14

22/7

.

Now to find a least-squares solution we can simply use theaugmented matrix

[A b̂] ∼

1 0 5/140 1 2/70 0 00 0 0

to get that x̂ =

[5/14

2/7

]is a least-squares solutions to Ax = b.

Page 52: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

Alternatively, we can use the QR factorization of A tocompute b̂. Let ui = vi/ ‖vi‖ for i = 1, 2. Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

and

R = QT A =[√

142 (11/71)√

1420

√42/71

]and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂? b̂ = QQT b. We then find x̂ = [5/14 2/7]T as before.

Page 53: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedAlternatively, we can use the QR factorization of A tocompute b̂.

Let ui = vi/ ‖vi‖ for i = 1, 2. Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

and

R = QT A =[√

142 (11/71)√

1420

√42/71

]and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂? b̂ = QQT b. We then find x̂ = [5/14 2/7]T as before.

Page 54: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedAlternatively, we can use the QR factorization of A tocompute b̂. Let ui = vi/ ‖vi‖ for i = 1, 2.

Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

and

R = QT A =[√

142 (11/71)√

1420

√42/71

]and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂? b̂ = QQT b. We then find x̂ = [5/14 2/7]T as before.

Page 55: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedAlternatively, we can use the QR factorization of A tocompute b̂. Let ui = vi/ ‖vi‖ for i = 1, 2. Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

andR = QT A =

[√142 (11/71)

√142

0√

42/71

]and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂? b̂ = QQT b. We then find x̂ = [5/14 2/7]T as before.

Page 56: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedAlternatively, we can use the QR factorization of A tocompute b̂. Let ui = vi/ ‖vi‖ for i = 1, 2. Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

and

R = QT A =[√

142 (11/71)√

1420

√42/71

]

and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂? b̂ = QQT b. We then find x̂ = [5/14 2/7]T as before.

Page 57: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedAlternatively, we can use the QR factorization of A tocompute b̂. Let ui = vi/ ‖vi‖ for i = 1, 2. Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

and

R = QT A =[√

142 (11/71)√

1420

√42/71

]and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂? b̂ = QQT b. We then find x̂ = [5/14 2/7]T as before.

Page 58: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedAlternatively, we can use the QR factorization of A tocompute b̂. Let ui = vi/ ‖vi‖ for i = 1, 2. Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

and

R = QT A =[√

142 (11/71)√

1420

√42/71

]and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂?

b̂ = QQT b. We then find x̂ = [5/14 2/7]T as before.

Page 59: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedAlternatively, we can use the QR factorization of A tocompute b̂. Let ui = vi/ ‖vi‖ for i = 1, 2. Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

and

R = QT A =[√

142 (11/71)√

1420

√42/71

]and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂? b̂ = QQT b.

We then find x̂ = [5/14 2/7]T as before.

Page 60: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedAlternatively, we can use the QR factorization of A tocompute b̂. Let ui = vi/ ‖vi‖ for i = 1, 2. Then

Q = [u1 u2] =

2/√

142 (49/71)/√

42/715/√

142 (16/71)/√

42/717/√

142 (−6/71)/√

42/718/√

142 (−17/71)/√

42/71

and

R = QT A =[√

142 (11/71)√

1420

√42/71

]and

QQT =

5/6 1/3 0 −1/61/3 11/42 3/14 4/21

0 3/14 5/14 3/7−1/6 4/21 3/7 23/42

.

What is b̂? b̂ = QQT b. We then find x̂ = [5/14 2/7]T as before.

Page 61: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 13

In the previous example, most of the work was in computing theprojection b̂. It turns out that we don’t need to do this to obtain aleast-squares solution x̂.

TheoremThe set of least-squares solutions of Ax = b is precisely thesolutions of AT Ax = AT b . The linear system represented by theboxed equation represents a system of linear equations called thenormal equations for Ax = b.

Page 62: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 13

In the previous example, most of the work was in computing theprojection b̂.

It turns out that we don’t need to do this to obtain aleast-squares solution x̂.

TheoremThe set of least-squares solutions of Ax = b is precisely thesolutions of AT Ax = AT b . The linear system represented by theboxed equation represents a system of linear equations called thenormal equations for Ax = b.

Page 63: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 13

In the previous example, most of the work was in computing theprojection b̂. It turns out that we don’t need to do this to obtain aleast-squares solution x̂.

TheoremThe set of least-squares solutions of Ax = b is precisely thesolutions of AT Ax = AT b . The linear system represented by theboxed equation represents a system of linear equations called thenormal equations for Ax = b.

Page 64: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 13

In the previous example, most of the work was in computing theprojection b̂. It turns out that we don’t need to do this to obtain aleast-squares solution x̂.

Theorem

The set of least-squares solutions of Ax = b is precisely thesolutions of AT Ax = AT b . The linear system represented by theboxed equation represents a system of linear equations called thenormal equations for Ax = b.

Page 65: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 13

In the previous example, most of the work was in computing theprojection b̂. It turns out that we don’t need to do this to obtain aleast-squares solution x̂.

TheoremThe set of least-squares solutions of Ax = b is precisely thesolutions of AT Ax = AT b .

The linear system represented by theboxed equation represents a system of linear equations called thenormal equations for Ax = b.

Page 66: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 13

In the previous example, most of the work was in computing theprojection b̂. It turns out that we don’t need to do this to obtain aleast-squares solution x̂.

TheoremThe set of least-squares solutions of Ax = b is precisely thesolutions of AT Ax = AT b . The linear system represented by theboxed equation represents a system of linear equations called thenormal equations for Ax = b.

Page 67: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13

Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 68: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.

Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 69: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 70: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)

Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 71: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂.

Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 72: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥.

This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 73: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A

(every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 74: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).

But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 75: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0

so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 76: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 77: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)

Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 78: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b.

Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 79: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT

(columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 80: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A).

Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 81: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥.

Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 82: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 83: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W .

That is, Ax̂ = b̂.

Page 84: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Proof of Theorem 13Proof.Let A = [a1 . . . an]. Let W = Col A.

(⊆)Suppose Ax̂ = b̂. Then b− b̂ = b− Ax̂ is in W⊥. This meansthat b− Ax̂ is orthogonal to every column of A (every row of AT ).But this means that AT (b− Ax̂) = 0 so that AT Ax̂ = AT b.

(⊇)Conversely, suppose AT Ax̂ = AT b. Then AT (b− Ax̂) = 0 so thatb− Ax̂ is orthogonal to the rows of AT (columns of A). Thusb− Ax̂ ∈W⊥. Moreover, we have

b = Ax̂︸︷︷︸∈W

+ b− Ax̂︸ ︷︷ ︸∈W ⊥

By the uniqueness of orthogonal decompositions, Ax̂ must be theprojection of b onto W . That is, Ax̂ = b̂.

Page 85: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

Let’s revisit our example using the previous theorem.We are given A and b. We compute

AT A =[

2 5 7 81 1 1 1

]2 15 17 18 1

=[

142 2222 4

]

AT b =[

2 5 7 81 1 1 1

]1233

=[

579

]

How do we find x̂?[142 22 57

22 4 9

]∼[

1 0 5/140 1 2/7

].

Page 86: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedLet’s revisit our example using the previous theorem.

We are given A and b. We compute

AT A =[

2 5 7 81 1 1 1

]2 15 17 18 1

=[

142 2222 4

]

AT b =[

2 5 7 81 1 1 1

]1233

=[

579

]

How do we find x̂?[142 22 57

22 4 9

]∼[

1 0 5/140 1 2/7

].

Page 87: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedLet’s revisit our example using the previous theorem.We are given A and b.

We compute

AT A =[

2 5 7 81 1 1 1

]2 15 17 18 1

=[

142 2222 4

]

AT b =[

2 5 7 81 1 1 1

]1233

=[

579

]

How do we find x̂?[142 22 57

22 4 9

]∼[

1 0 5/140 1 2/7

].

Page 88: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedLet’s revisit our example using the previous theorem.We are given A and b. We compute

AT A =[

2 5 7 81 1 1 1

]2 15 17 18 1

=[

142 2222 4

]

AT b =[

2 5 7 81 1 1 1

]1233

=[

579

]

How do we find x̂?[142 22 57

22 4 9

]∼[

1 0 5/140 1 2/7

].

Page 89: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedLet’s revisit our example using the previous theorem.We are given A and b. We compute

AT A =[

2 5 7 81 1 1 1

]2 15 17 18 1

=[

142 2222 4

]

AT b =[

2 5 7 81 1 1 1

]1233

=[

579

]

How do we find x̂?[142 22 57

22 4 9

]∼[

1 0 5/140 1 2/7

].

Page 90: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedLet’s revisit our example using the previous theorem.We are given A and b. We compute

AT A =[

2 5 7 81 1 1 1

]2 15 17 18 1

=[

142 2222 4

]

AT b =[

2 5 7 81 1 1 1

]1233

=[

579

]

How do we find x̂?[142 22 57

22 4 9

]∼[

1 0 5/140 1 2/7

].

Page 91: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedLet’s revisit our example using the previous theorem.We are given A and b. We compute

AT A =[

2 5 7 81 1 1 1

]2 15 17 18 1

=[

142 2222 4

]

AT b =[

2 5 7 81 1 1 1

]1233

=[

579

]

How do we find x̂?

[142 22 57

22 4 9

]∼[

1 0 5/140 1 2/7

].

Page 92: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continuedLet’s revisit our example using the previous theorem.We are given A and b. We compute

AT A =[

2 5 7 81 1 1 1

]2 15 17 18 1

=[

142 2222 4

]

AT b =[

2 5 7 81 1 1 1

]1233

=[

579

]

How do we find x̂?[142 22 57

22 4 9

]∼[

1 0 5/140 1 2/7

].

Page 93: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example

Are least-squares solutions always unique? No!

Let A =

1 1 0 01 1 0 01 0 1 01 0 1 01 0 0 11 0 0 1

, b =

−3−1

0251

. Then

AT A =

6 2 2 22 2 0 02 0 2 02 0 0 2

, AT b =

4−4

26

,

and[

AT A AT b]∼

1 0 0 1 30 1 0 −1 −50 0 1 −1 −20 0 0 0 0

.

Page 94: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 ExampleAre least-squares solutions always unique?

No!

Let A =

1 1 0 01 1 0 01 0 1 01 0 1 01 0 0 11 0 0 1

, b =

−3−1

0251

. Then

AT A =

6 2 2 22 2 0 02 0 2 02 0 0 2

, AT b =

4−4

26

,

and[

AT A AT b]∼

1 0 0 1 30 1 0 −1 −50 0 1 −1 −20 0 0 0 0

.

Page 95: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 ExampleAre least-squares solutions always unique? No!

Let A =

1 1 0 01 1 0 01 0 1 01 0 1 01 0 0 11 0 0 1

, b =

−3−1

0251

. Then

AT A =

6 2 2 22 2 0 02 0 2 02 0 0 2

, AT b =

4−4

26

,

and[

AT A AT b]∼

1 0 0 1 30 1 0 −1 −50 0 1 −1 −20 0 0 0 0

.

Page 96: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 ExampleAre least-squares solutions always unique? No!

Let A =

1 1 0 01 1 0 01 0 1 01 0 1 01 0 0 11 0 0 1

, b =

−3−1

0251

.

Then

AT A =

6 2 2 22 2 0 02 0 2 02 0 0 2

, AT b =

4−4

26

,

and[

AT A AT b]∼

1 0 0 1 30 1 0 −1 −50 0 1 −1 −20 0 0 0 0

.

Page 97: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 ExampleAre least-squares solutions always unique? No!

Let A =

1 1 0 01 1 0 01 0 1 01 0 1 01 0 0 11 0 0 1

, b =

−3−1

0251

. Then

AT A =

6 2 2 22 2 0 02 0 2 02 0 0 2

, AT b =

4−4

26

,

and[

AT A AT b]∼

1 0 0 1 30 1 0 −1 −50 0 1 −1 −20 0 0 0 0

.

Page 98: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 ExampleAre least-squares solutions always unique? No!

Let A =

1 1 0 01 1 0 01 0 1 01 0 1 01 0 0 11 0 0 1

, b =

−3−1

0251

. Then

AT A =

6 2 2 22 2 0 02 0 2 02 0 0 2

, AT b =

4−4

26

,

and[

AT A AT b]∼

1 0 0 1 30 1 0 −1 −50 0 1 −1 −20 0 0 0 0

.

Page 99: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14

Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 100: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 101: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

Theorem

Let A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 102: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix.

The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 103: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 104: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 105: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent

3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 106: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 107: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 108: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 109: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question:

What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 110: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 111: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 14Given the contrast between example K and example ,one might like to know when a least-squares solution is unique...

TheoremLet A be an m × n matrix. The following are equivalent:

1. The equation Ax = b has a unique least-squares solution forevery b ∈ Rm

2. The columns of A are linearly independent3. AT A is invertible

When these hold, we have x̂ = (AT A)−1AT b.

Due to time constraints we will omit the proof.

Question: What does this theorem tell us about AT A and thecolumns of A from example .

AT A is not invertible, and the columns of A are linearly dependent.

Page 112: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We found previously, that this example has a unique least-squaressolution. By the previous theorem we can compute

x̂ = (AT A)−1AT b

=[

1/21 −11/42−11/42 71/42

]AT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Page 113: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We found previously, that this example has a unique least-squaressolution.

By the previous theorem we can compute

x̂ = (AT A)−1AT b

=[

1/21 −11/42−11/42 71/42

]AT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Page 114: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We found previously, that this example has a unique least-squaressolution. By the previous theorem we can compute

x̂ = (AT A)−1AT b

=[

1/21 −11/42−11/42 71/42

]AT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Page 115: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

We found previously, that this example has a unique least-squaressolution. By the previous theorem we can compute

x̂ = (AT A)−1AT b

=[

1/21 −11/42−11/42 71/42

]AT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Page 116: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15

TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 117: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15Theorem

Let A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 118: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns.

LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 119: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A.

Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 120: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm,

Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 121: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution

given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 122: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 123: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.

By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 124: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution,

so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 125: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works.

But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 126: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Theorem 15TheoremLet A be an m × n matrix with linearly independent columns. LetA = QR be a QR factorization of A. Then for every b ∈ Rm, Theequation Ax = b has a unique least-squares solution given by

x̂ = R−1QT b.

Proof.By the previous theorem, Ax = b has a unique least-squaressolution, so we just need to check that the given x̂ works. But

Ax̂ = QR x̂= QRR−1QT b= QQT b = b̂.

Page 127: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

Using the previously computed Q and R, we verify the theorem inthis example as follows.

x̂ = R−1QT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Note that this also shows the unilluminating fact that(AT A)−1AT = R−1QT when defined.

Page 128: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

Using the previously computed Q and R,

we verify the theorem inthis example as follows.

x̂ = R−1QT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Note that this also shows the unilluminating fact that(AT A)−1AT = R−1QT when defined.

Page 129: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

Using the previously computed Q and R, we verify the theorem inthis example as follows.

x̂ = R−1QT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Note that this also shows the unilluminating fact that(AT A)−1AT = R−1QT when defined.

Page 130: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

Using the previously computed Q and R, we verify the theorem inthis example as follows.

x̂ = R−1QT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Note that this also shows the unilluminating fact that(AT A)−1AT = R−1QT when defined.

Page 131: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K continued

Using the previously computed Q and R, we verify the theorem inthis example as follows.

x̂ = R−1QT b

=[−1/6 −1/42 1/14 5/42

7/6 8/21 −1/7 −17/42

]1233

=[

5/142/7

].

Note that this also shows the unilluminating fact that(AT A)−1AT = R−1QT when defined.

Page 132: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 133: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane.

How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 134: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata?

Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 135: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error.

One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 136: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”.

Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 137: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture.

Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 138: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 139: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

],

then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 140: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2.

This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 141: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when

you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 142: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it

x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 143: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b.

x̂ = [5/14 2/7]T .

Page 144: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

Consider the quantitative data (2, 1), (5, 2), (7, 3), (8, 3) in the(t, y)-plane. How do we find a line y = ct + d that “best fits” thisdata? Well, to do this we need a notion of error. One mightmeasure this error using “squared residuals”. Draw a picture. Inour case, this error is given by

4∑i=1

(yi−cti−d)2 = (1−2c−d)2+(2−5c−d)2+(3−7c−d)2+(3−8c−3)2.

If we let A =

2 15 17 18 1

, b =

1233

, x =[

cd

], then the above

error for a given x is precisely ‖b− Ax‖2. This quantity isminimized precisely when you guessed it x is a least-squaressolution to Ax = b. x̂ = [5/14 2/7]T .

Page 145: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

From the least-squares solution we obtainthe line y = (5/14)t + (2/7)that best fitsthe data (2,1),(5,2),(7,3),(8,3) :

t

y

Page 146: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

From the least-squares solution we obtain

the line y = (5/14)t + (2/7)that best fitsthe data (2,1),(5,2),(7,3),(8,3) :

t

y

Page 147: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

From the least-squares solution we obtainthe line y = (5/14)t + (2/7)

that best fitsthe data (2,1),(5,2),(7,3),(8,3) :

t

y

Page 148: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

From the least-squares solution we obtainthe line y = (5/14)t + (2/7)that best fits

the data (2,1),(5,2),(7,3),(8,3) :

t

y

Page 149: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

From the least-squares solution we obtainthe line y = (5/14)t + (2/7)that best fitsthe data (2,1),(5,2),(7,3),(8,3) :

t

y

Page 150: Lecture 26 - Dartmouth College · 2017. 8. 16. · Lecture 26 Math 22 Summer 2017 August 16, 2017. Just for today I §6.4 Finish up I §6.5 Least-squares problems §6.4 Gram-Schmidt

§6.5 Example K concluded

From the least-squares solution we obtainthe line y = (5/14)t + (2/7)that best fitsthe data (2,1),(5,2),(7,3),(8,3) :

t

y