# QR Factorization

1. Jan 23, 2007

### hotvette

Can someone tell me what I'm doing wrong? Starting with normal equation for least squares:

(1) ATAx = ATb

and introducing a diagonal permutation matrix P such that PA = K:

(2) A = P-1K

(3) AT = KT[P-1]T = KTP-1 since P is diagonal, PT = P

Substituting (2) and (3) into (1):

(4) (KTP-1)(P-1K)x = KTP-1b

(5) KTP-1P-1Kx = KTP-1b

Introducing QR factorzation of K, where Q is orthogonal and R is upper triangular:

(6) K = QR, KT = RTQT

Equation (5) becomes:

(7) RTQTP-1P-1QRx = RTQTP-1b

Pre multiplying both sides by [RT]-1:

(8) QTP-1P-1QRx = QTP-1b

Pre-multiplying both sides by Q (QQT = I since Q is orthogonal):

(9) P-1P-1QRx = P-1b

Pre-multiplying both sizes by P:

(10) P-1QRx = b

Pre-multiplying both sizes by P:

(11) QRx = Pb

Pre-multiplying both sizes by QT:

(12) Rx = QTPb, where PA = K = QR

Since R is upper triangular, x can be solved via back substitution. But, something the wrong the above development because a numerical example doesn't work out correct. The standard QR factorization of the least squares normal equation results in:

(13) R'x = Q'Tb, where A = Q'R'

When I solve an actual numerical example, I get different results using (12) and (13). Where did I go wrong? :yuck:

Last edited: Jan 23, 2007