Professional Documents
Culture Documents
Projections
Projection Revision
Ar
b a
MATH1151 Algebra
Planes in
Distances
Vector Geometry
Cross Product
AP is perpendicular to b AP b = 0 = (b a) b = 0
lssq1.m
Projb a =
lssq2.m
L14 Projections and Least Squares
Vector Geometry
Projections
Session 1, 2015
1 / 12
b1
r
O
Proj a =OP = 1 b1 + 2 b2 ,
1 , 2 R
Session 1, 2015
2 / 12
d=
b1 a
b2 a
Find the projection of a = (6, 11, 4)T onto the plane spanned by
b1 = (1, 2, 5)T and b2 = (3, 1, 1)T .
b1 (1 b1 + 2 b2 a) = 0
Solution
b2 (1 b1 + 2 b2 a) = 0
Expand to get linear system
B=
1 (b1 b1 ) + 2 (b1 b2 ) = b1 a
1 (b2 b1 ) + 2 (b2 b2 ) = b2 a
L14 Projections and Least Squares
Linear system Bx = d
b1 b1 b1 b2
1
,
, B=
x=
b2 b1 b2 b2
2
Example
MATH1151 (Algebra)
MATH1151 (Algebra)
(a b)
b
(b b)
Plane = Span{b1 , b2 } = {x Rn : x = 1 b1 + 2 b2 , 1 , 2 R}
rA
a
b2
r
P
R3
Matlab M-files
MATH1151 (Algebra)
OP is parallel to b OP = b,
30 0
0 11
Proj a = ( 95 , 57 , 7)T
Session 1, 2015
3 / 12
MATH1151 (Algebra)
d=
36
11
= x =
65
1
B diagonal why?
Session 1, 2015
4 / 12
Vector Geometry
Projections
Vector Geometry
Proposition
Projection of a Rm onto = span{bj , j = 1, . . . , n} Rm is
Proj a =
n
X
Residual r = Ax b Rm
Ax = b r = 0 |r| = 0 |r|2 = 0 r r = 0
P
2
Least Squares Problem Minimize |r|2 = m
j=1 rj
j bj
j=1
)T
b1 b1 b1 b2 b1 bn
b1 a
b2 b1 b2 b2 b2 bn
b2 a
B=
, d = ..
..
..
..
.
.
.
.
bn b1 bn b2 bn bn
bn a
Normal equations
MATH1151 (Algebra)
Pn
j=1 (bj
a) bj
Session 1, 2015
AT A x = AT b
AT A Mn,n (R),
{ b1 , b2 , . . . , bn } orthogonal bi bj = 0, i 6= j B diagonal
{ b1 , b2 , . . . , bn } orthonormal also bi bi = 1 B = I
Proj a =
5 / 12
n = 2 parameters , ,
Find the line y(t) = + t which best fits the data (ti , yi ), i = 1, . . . , m
in the least squares sense.
1 t1
1 t2
A = . . Mm,2 (R),
.
.
. .
+ ti yi ,
x=
Normal Equations AT Ax = AT y
A A=
10
12
MATH1151 (Algebra)
6 / 12
Session 1, 2015
7 / 12
MATH1151 (Algebra)
1 1
t1 t2
i = 1, . . . , m
1 tm
1
2
Session 1, 2015
1
tm
1
1
..
.
t1
t2
..
.
1 tm
y=
y1
y2
..
.
ym
Rm
m
X
ti
m
i=1
=
m
m
X
X
t2i
ti
i=1
i=1
Session 1, 2015
8 / 12
Vector Geometry
Vector Geometry
Exponential fit 1
Normal Equations AT Ax = AT y
1
tm
1 1
t1 t2
m
X
ti
m
i=1
X
m
m
X
t2i
ti
i=1
i=1
Matlab x = A \ y,
MATH1151 (Algebra)
y1
y2
..
.
m
X
yi
i=1
= m
X
ti y i
ym
i=1
m
X
yi
i=1
= X
m
ti y i
i=1
x = (A*A) \ (A*y),
Year t
Cost T
2
2.5
3
2.8
Solution
Log transformation
log(T ) = log(ekt ) = log() + log(ekt ) = log() + kt
Linear in variables x = (log(), k)T
Session 1, 2015
9 / 12
Exponential fit 2
MATH1151 (Algebra)
Session 1, 2015
10 / 12
Exponential fit 3
Solution
Linear system Ax = y where
1 0
1 1
A=
1 2
1 3
Matlab lssq2.m
Normal equations AT Ax = AT y
4 6
T
T
A A=
, A y=
6 14
log(2.0)
log(2.2)
y=
log(2.5)
log(2.8)
2.8
Data
Exponential fit
2.7
2.6
2.5
log(2.0)+log(2.2)+log(2.5)+log(2.8)
log(2.2)+2 log(2.5)+3 log(2.8)
1
2.2
T = ekt
lssq1.m
0
2.0
Session 1, 2015
11 / 12
Claims T ($million)
AT y =
2.4
2.3
2.2
2.1
1.9
1.8
MATH1151 (Algebra)
0.5
1.5
Time t (years)
2.5
Session 1, 2015
12 / 12