216 CHAPTER 10. A FEW FACTORIZATIONS
where A1 is n×m−1 or else, in case m = 1, the right side is of the form(a0
)
and in this case, the conclusion of the theorem follows. If m− 1 ≥ 1, then by induction,there exists Q2 an orthogonal n×n matrix such that Q2A1 = R1. Then(
1 00 Q2
)Q1A =
(1 00 Q2
)(a b0 A1
)=
(a b0 R1
)≡ R
Since
(1 00 Q2
)Q1 is orthogonal, being the product of two orthogonal matrices, the
conclusion follows. ■▶ ▶
10.8 MATLAB And FactorizationsMATLAB can find an LU factorizaton of a matrix. Here is an example.
>>A=[1,3,2,4;-5,7,2,3;2,3,7,11;1,2,3,4]; [L,U,P]=lu(sym(A))This will give a lower triangular matrix L with ones down the diagonal, an upper trian-
gular matrix U, and a permutation matrix P such that PA = LU . Of course if the matrix Ahas an LU factorization, you will have P = I. This was the case here. After you have typedthe above, you press enter and you get the following listed in a column. If you just typelu(A) , then the answer will come out in decimals.
L=[ 1, 0, 0, 0][ -5, 1, 0, 0][ 2, -3/22, 1, 0][ 1, -1/22, 1/3, 1]
U=[ 1, 3, 2, 4][ 0, 22, 12, 23][ 0, 0, 51/11, 135/22][ 0, 0, 0, -1]
P=1 0 0 00 1 0 00 0 1 00 0 0 1
MATLAB can also find the much more interesting QR factorization. Here is how to doit with an example.
>>A=[1,2,3;4,2,1;2,6,7;1,-4,2];[Q,R]=qr(A)Then press enter and you get the following.
Q=-0.2132 0.1756 -0.2593 0.9255-0.8528 -0.1892 0.4862 -0.0244-0.4264 0.6485 -0.5139 -0.3653-0.2132 -0.7161 -0.6575 -0.0974
R=-4.6904 -3.8376 -4.90360 6.7285 3.44530 0 -5.20430 0 0
If you want to see something horrible, replace qr(A) with qr(sym(A)). This way it givesthe exact values. You can check your work by >>Q*Q’ and press enter. The Q’ means theconjugate transpose. Since everything is real here, this is just the transpose.