Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

For a matrix program, the Gram–Schmidt process worksbetter with orthonormal vectors. Starting with \({x_1},......,{x_p}\) asin Theorem 11, let \(A = \left\{ {{x_1},......,{x_p}} \right\}\) . Suppose \(Q\) is an\(n \times k\)matrix whose columns form an orthonormal basis for

the subspace \({W_k}\) spanned by the first \(k\) columns of A. Thenfor \(x\) in \({\mathbb{R}^n}\), \(Q{Q^T}x\) is the orthogonal projection of x onto \({W_k}\) (Theorem 10 in Section 6.3). If \({x_{k + 1}}\) is the next column of \(A\),then equation (2) in the proof of Theorem 11 becomes

\({v_{k + 1}} = {x_{k + 1}} - Q\left( {{Q^T}T {x_{k + 1}}} \right)\)

(The parentheses above reduce the number of arithmeticoperations.) Let \({u_{k + 1}} = \frac{{{v_{k + 1}}}}{{\left\| {{v_{k + 1}}} \right\|}}\). The new \(Q\) for thenext step is \(\left( {\begin{aligned}{{}{}}Q&{{u_{k + 1}}}\end{aligned}} \right)\). Use this procedure to compute the\(QR\)factorization of the matrix in Exercise 24. Write thekeystrokes or commands you use.

Short Answer

Expert verified

The required MATLAB command is:

function ( Q R) = GramSchmidt_N(A)

(m,n) = size(A);

(U, jb) = rref(A);

x = length(jb);

B = zeros(m,x);

for i = 1:x

C(:,i)= A(:,(jb(i)));

end

B=C;

for i = 2:x

for j = 1:i-1

B(:,i) = B(:,i) - dot(C(:,i),B(:,j))/dot(B(:,j),B(:,j))* B(:,j)

end

end

for i=1:size(B,2)

TMP=B(:,i);

TMP=TMP./(sqrt(sum(TMP.^2)));

B(:,i)=TMP;

end

end

R=Q'*A

Step by step solution

01

\(QR\) factorization of a Matrix

A matrix with order \(m \times n\) can be written as the multiplication of an upper triangular matrix \(R\) and a matrix \(Q\) which is formed by applying the Gram–Schmidt orthogonalization processto the \({\rm{col}}\left( A \right)\).

The matrix \(R\) can be found by the formula \({Q^T}A = R\).

02

The matlab Programming

Using Gram-Schmidt orthogonalization command of MATLAB of the matrix \(A = \left( {\begin{aligned}{{}{r}}{ - 10}&{13}&7&{ - 11}\\2&1&{ - 5}&3\\{ - 6}&3&{13}&{ - 3}\\{16}&{ - 16}&{ - 2}&5\\2&1&{ - 5}&{ - 7}\end{aligned}} \right)\).

function ( Q R) = GramSchmidt_N(A)

(m,n) = size(A);

(U, jb) = rref(A);

x = length(jb);

B = zeros(m,x);

for i = 1:x

C(:,i)= A(:,(jb(i)));

end

B=C;

for i = 2:x

for j = 1:i-1

B(:,i) = B(:,i) - dot(C(:,i),B(:,j))/dot(B(:,j),B(:,j))* B(:,j)

end

end

for i=1:size(B,2)

TMP=B(:,i);

TMP=TMP./(sqrt(sum(TMP.^2)));

B(:,i)=TMP;

end

end

R=Q'*A

After using this command, the QR factorization is:

\(\left( {\begin{aligned}{{}{r}}{ - 10}&{13}&7&{ - 11}\\2&1&{ - 5}&3\\{ - 6}&3&{13}&{ - 3}\\{16}&{ - 16}&{ - 2}&5\\2&1&{ - 5}&{ - 7}\end{aligned}} \right) = \left( {\begin{aligned}{{}{r}}{\frac{1}{2}}&{\frac{1}{2}}&{\frac{1}{{\sqrt 3 }}}&0\\{\frac{1}{{10}}}&{\frac{1}{2}}&0&{\frac{1}{{\sqrt 2 }}}\\{\frac{{ - 3}}{{10}}}&{ - \frac{1}{2}}&{\frac{1}{{\sqrt 3 }}}&0\\{\frac{4}{5}}&0&{\frac{1}{{\sqrt 3 }}}&0\\{\frac{1}{{10}}}&{\frac{1}{2}}&0&{\frac{1}{{\sqrt 2 }}}\end{aligned}} \right)\left( {\begin{aligned}{{}{}}{20}&{ - 20}&{ - 10}&{10}\\0&6&{ - 8}&{ - 6}\\0&0&{6\sqrt 3 }&{ - 3\sqrt 3 }\\0&0&0&{5\sqrt 2 }\end{aligned}} \right)\)

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

In Exercises 1-6, the given set is a basis for a subspace W. Use the Gram-Schmidt process to produce an orthogonal basis for W.

3. \(\left( {\begin{aligned}{{}{}}2\\{ - 5}\\1\end{aligned}} \right),\left( {\begin{aligned}{{}{}}4\\{ - 1}\\2\end{aligned}} \right)\)

In Exercises 13 and 14, the columns of Q were obtained by applying the Gram-Schmidt process to the columns of A. Find an upper triangular matrix R such that \(A = QR\). Check your work.

13. \(A = \left( {\begin{aligned}{{}{}}5&9\\1&7\\{ - 3}&{ - 5}\\1&5\end{aligned}} \right),{\rm{ }}Q = \left( {\begin{aligned}{{}{}}{\frac{5}{6}}&{ - \frac{1}{6}}\\{\frac{1}{6}}&{\frac{5}{6}}\\{ - \frac{3}{6}}&{\frac{1}{6}}\\{\frac{1}{6}}&{\frac{3}{6}}\end{aligned}} \right)\)

In Exercises 5 and 6, describe all least squares solutions of the equation \(A{\bf{x}} = {\bf{b}}\).

6.\(A = \left( {\begin{aligned}{{}{}}{\bf{1}}&{\bf{1}}&{\bf{0}}\\{\bf{1}}&{\bf{1}}&{\bf{0}}\\{\bf{1}}&{\bf{1}}&{\bf{0}}\\{\bf{1}}&{\bf{0}}&{\bf{1}}\\{\bf{1}}&{\bf{0}}&{\bf{1}}\\{\bf{1}}&{\bf{0}}&{\bf{1}}\end{aligned}} \right)\),\({\bf{b}} = \left( {\begin{aligned}{{}{}}{\bf{7}}\\{\bf{2}}\\{\bf{3}}\\{\bf{6}}\\{\bf{5}}\\{\bf{4}}\end{aligned}} \right)\)

In exercises 1-6, determine which sets of vectors are orthogonal.

\(\left[ {\begin{array}{*{20}{c}}5\\{ - 4}\\0\\3\end{array}} \right]\), \(\left[ {\begin{array}{*{20}{c}}{ - 4}\\1\\{ - 3}\\8\end{array}} \right]\), \(\left[ {\begin{array}{*{20}{c}}3\\3\\5\\{ - 1}\end{array}} \right]\)

[M] Let \({f_{\bf{4}}}\) and \({f_{\bf{5}}}\) be the fourth-order and fifth order Fourier approximations in \(C\left[ {{\bf{0}},{\bf{2}}\pi } \right]\) to the square wave function in Exercise 10. Produce separate graphs of \({f_{\bf{4}}}\) and \({f_{\bf{5}}}\) on the interval \(\left[ {{\bf{0}},{\bf{2}}\pi } \right]\), and produce graph of \({f_{\bf{5}}}\) on \(\left[ { - {\bf{2}}\pi ,{\bf{2}}\pi } \right]\).

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free