Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Course is linear algebra. I have attached the theorem as needed. Write a computer program to compute the QR factorization of a 5x5 matrix, either
Course is linear algebra.
I have attached the theorem as needed.
Write a computer program to compute the QR factorization of a 5x5 matrix, either by 1. using rotators. Use the algorithm described in the proof of Theorem 3.2.21; or 3. ysing reflectors Test your algorithm by the following code A rand(5) do the QR factorization of A.. Q*Q, % This should print out the 5x5 identity matrix R % visually verify that it is upper triangular A-Q*R % This should print out the 5x5 zero matrix Some of the entries that should be zero will only be close to zero (e.g. 1e-15). Don't worry about that. Theorem 3.2.21 Let A E R"X". Then there exists an orthogonal matrix Qand an upper triangular matrix R such that A QR. Proof. We will sketch a proof in which Q is taken to be a product of rotators. A more detailed proof using reflectors will be given later. Let Q21 be a rotator acting 196 THE LEAST SQUARES PROBLEM on the r12 plane, such that Qi makes the transformation 011 021 0 a31 041 anl anl Then Q21 A has a zero in the (2,1) position. Similarly we can find a plane rotator Qsi, acting in the r plane, such that Q3A)has a zero in the (3, 1) position. This rotator does not disturb the zero in the (2,1) position because Q3 leaves the second row of Q% A unchanged. Continuing in this manner, we create rotators Q41 Q51, . . . , Qni, such that Q,1 . . . Q31 A has zeros in the entire first column, except for the (1,1) position. Now we go to work on the second column. Let Q32 be a plane rotator acting in the r2r3 plane, such that the (3,2) entry of 2(QQA) is zero. This rotator does not disturb the zeros that were created previously in the first column. (Why not?) Continuing on the second column, let Q42.Qs2.. .. . Qn2 be rotators such that 2TA has zeros in columns 1 and 2 below the main diagonal. Next we take care of the third column, fourth column, and so on. In all we create rotators 21 ni.Qs. Qn.n-1. such that is upper triangular. Let Q21Q3Qn,n-1. Then Q. being a product of orthogonal matrices, is itself orthogonal, and R QTA: that is. A = QR. The proof of Theorem 3.2.21 is constructive; it gives us an algorithm for computing Qand R. Write a computer program to compute the QR factorization of a 5x5 matrix, either by 1. using rotators. Use the algorithm described in the proof of Theorem 3.2.21; or 3. ysing reflectors Test your algorithm by the following code A rand(5) do the QR factorization of A.. Q*Q, % This should print out the 5x5 identity matrix R % visually verify that it is upper triangular A-Q*R % This should print out the 5x5 zero matrix Some of the entries that should be zero will only be close to zero (e.g. 1e-15). Don't worry about that. Theorem 3.2.21 Let A E R"X". Then there exists an orthogonal matrix Qand an upper triangular matrix R such that A QR. Proof. We will sketch a proof in which Q is taken to be a product of rotators. A more detailed proof using reflectors will be given later. Let Q21 be a rotator acting 196 THE LEAST SQUARES PROBLEM on the r12 plane, such that Qi makes the transformation 011 021 0 a31 041 anl anl Then Q21 A has a zero in the (2,1) position. Similarly we can find a plane rotator Qsi, acting in the r plane, such that Q3A)has a zero in the (3, 1) position. This rotator does not disturb the zero in the (2,1) position because Q3 leaves the second row of Q% A unchanged. Continuing in this manner, we create rotators Q41 Q51, . . . , Qni, such that Q,1 . . . Q31 A has zeros in the entire first column, except for the (1,1) position. Now we go to work on the second column. Let Q32 be a plane rotator acting in the r2r3 plane, such that the (3,2) entry of 2(QQA) is zero. This rotator does not disturb the zeros that were created previously in the first column. (Why not?) Continuing on the second column, let Q42.Qs2.. .. . Qn2 be rotators such that 2TA has zeros in columns 1 and 2 below the main diagonal. Next we take care of the third column, fourth column, and so on. In all we create rotators 21 ni.Qs. Qn.n-1. such that is upper triangular. Let Q21Q3Qn,n-1. Then Q. being a product of orthogonal matrices, is itself orthogonal, and R QTA: that is. A = QR. The proof of Theorem 3.2.21 is constructive; it gives us an algorithm for computing Qand RStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started