Learn Linear Algebra

The Gram–Schmidt Process

Given a basis {x1,,xp} \{ \vec{x}_1, \dots, \vec{x}_p \} for a subspace W W of Rn \mathbb{R}^n , define:

v1=x1 \vec{v}_1 = \vec{x}_1

v2=x2x2v1v1v1v1 \vec{v}_2 = \vec{x}_2 - \frac{\vec{x}_2 \cdot \vec{v}_1}{\vec{v}_1 \cdot \vec{v}_1}\vec{v}_1

v3=x3x3v1v1v1v1x3v2v2v2v2 \vec{v}_3 = \vec{x}_3 - \frac{\vec{x}_3 \cdot \vec{v}_1}{\vec{v}_1 \cdot \vec{v}_1}\vec{v}_1 - \frac{\vec{x}_3 \cdot \vec{v}_2}{\vec{v}_2 \cdot \vec{v}_2}\vec{v}_2

\vdots

vp=xpxpv1v1v1v1xpv2v2v2v2xpvp1vp1vp1vp1. \vec{v}_p = \vec{x}_p - \frac{\vec{x}_p \cdot \vec{v}_1}{\vec{v}_1 \cdot \vec{v}_1}\vec{v}_1 - \frac{\vec{x}_p \cdot \vec{v}_2}{\vec{v}_2 \cdot \vec{v}_2}\vec{v}_2 - \cdots - \frac{\vec{x}_p \cdot \vec{v}_{p-1}}{\vec{v}_{p-1} \cdot \vec{v}_{p-1}}\vec{v}_{p-1}.

Then {v1,,vp} \{ \vec{v}_1, \dots, \vec{v}_p \} is an orthogonal basis for W W . In addition:

Span{v1,,vk}=Span{x1,,xk}for 1kp. \text{Span} \{ \vec{v}_1, \dots, \vec{v}_k \} = \text{Span} \{ \vec{x}_1, \dots, \vec{x}_k \} \quad \text{for } 1 \leq k \leq p.

The QR Factorization

If A A is an m×n m \times n matrix with linearly independent columns, then A A can be factored as A=QR A = QR , where Q Q is an m×n m \times n matrix whose columns form an orthonormal basis for Col A A and R R is an n×n n \times n upper triangular invertible matrix with positive entries on its diagonal.