Problem 2: QR Factorization (7 points) 2.1 (2/7) Orthogonality (textbook sections

Question
Problem 2: QR Factorization (7 points)

2.1 (2/7) Orthogonality (textbook sections 3.6 and 4.2) Two vectors w, v ER" are orthogonal

(i.e., perpendicular) if (u, v) = 0. Two subspaces S1, S2 of R" are orthogonal if every vector in Si is

orthogonal to every vector in S₂. To check that two subspaces S₁, S₂ are orthogonal, we only need

to verify that their basis vectors are orthogonal: suppose that the columns of B₁ form a basis for S₁,

and columns of B₂ form a basis for S₂. Then we only need to confirm that every column of B₁ is

orthogonal to every column of B₂, or equivalently BB₂ = 0, where O is the all-zero matrix.

Take the matrix

[10-2

R 0 1 2.5

10 0 0

and find and write down a basis B₁ for its row space, i.e., col(RT), and a basis B₂ for its null space,

i.e., null(R). Write the code to numerically check that col(RT) is orthogonal to null(R), i.e.,

BB₂

B₁F B₂ F

(review HW1 on how to compute the matrix norm; see also https://numpy.org/doc/stable/

reference/generated/numpy.linalg.norm.html) should be very close to 0.

(w, v- Pwv) = 0,

AT (PAV) = 0.

2.2 (2/7) Projection (partially by textbook section 4.3.3) For a given vector v R", the projection

of v onto a vector w R" is:

PV =

ww

||w||20₁

(7)

where the projection matrix is P =

Moreover, the projection onto the column space of a

||1||²

matrix A € Rnxk with independent columns, i.e., the projection onto the subspace for which the

columns of A form a basis, is

(projection error orthogonal to w)

(projection error orthogonal to the subspace col(A))

|(w, v - Pwv)|

||w|| ||v|||

(8)

PAU = A (A¹A)¹ A¹v,

(10)

where the projection matrix is P₁ = A (A¹A) AT. A crucial property of projection is orthogonal-

ity, i.e.,

and

(9)

||AT (v - PAV)||

||A||F ||v|||

In the Colab file, we provide v, w and A. Please write the code to compute the numerical

values of P and P₁v. Then numerically check the orthogonality in Eq. (11), i.e., show that both

numbers,

(11)

(12)

(13)

Question image 1