HP 15c User Manual
Page 96
96
Section 4: Using Matrix Operations
96
Any n × p matrix X can be factored as X = Q
T
U, where Q is an n × n orthogonal matrix
characterized by Q
T
= Q
−l
and U is an n × p upper-triangular matrix. The essential property
of orthogonal matrices is that they preserve length in the sense that
.
)
r
(
)
(
2
2
F
T
T
T
T
F
r
r
r
Qr
Q
r
Q
Qr
r
Q
Therefore, if r = y – Xb, it has the same length as
Qr = Qy – QXb = Qy – Ub.
The upper-triangular matrix U and the product Qy can be written as
.
rows)
(
rows)
(
and
rows)
(
rows)
(
ˆ
p
n
p
p
n
p
f
g
Qy
O
U
U
Then
2
2
2
2
2
2
ˆ
r
F
F
F
F
F
F
f
f
b
U
g
Ub
Qy
Q
r
with equality when
0
b
U
g
ˆ
. In other words, the solution to the ordinary least-squares
problem is any solution to
g
b
U
ˆ
and the minimal sum of squares is
2
F
f
. This is the basis
of all numerically sound least-squares programs.
You can solve the unconstrained least-squares problem in two steps:
1. Perform the orthogonal factorization of the augmented n × (p + 1) matrix
V
Q
y
X
T
where Q
T
= Q
−1
, and retain only the upper-triangular factor V, which you can then
partition as
rows)
1
(
row)
(1
rows)
(
ˆ
p
n
p
q
0
0
0
g
U
V
(1 column)
(p columns)