ORTHOGONALITY AND LEAST SQUARES
 

Orthogonal Vectors
Norm
Unit Vector
Orthonormal Vectors
Orthogonal Complement
Orthogonal Projection
Cauchy-Schwarz Inequality
Angle Between Two Vectors
Gram-Schmidt Process
QR Factorialization
Transpose
Symmetric and Skew-symmetric Matrices
Orthogonal Matrices
Least Squares Solutions
Matrix of an Orthogonal Projection
Gram-Schmidt Process
How to Examples Exercise
How to:
The Gram-Schmidt process takes a regular
basis of a subspace V and constructs with it an orthonormal basis.

So, we are given a regular basis v1, v2, ... , vM, and we want to find w1, w2, ... , wM, an orthonormal basis. Finding w1 is simple (unlike the others), it is simply v1 as a unit vector:
     w1 = v1/norm(v1)

Finding the other vectors is not as simple and requires an additional computation. To find wJ, we have to find the orthogonal projection of vJ onto a subspace of V which is the span of all the vectors before vJ (that is v1, v2, ... vJminus1). We'll call this subspace VJminus1 (since we can't use the '-' symbol in the name of variables). So, the orthogonal projection, projVJminus1vJ of vJ onto VJminus1 is given by:
     projVJminus1vJ = dot(w1, vJ)*w1 + dot(w2, vJ)*w2 + ... + dot(wJminus1, vJ)*wJminus1

Now, we can use this to calculate wJ:
     wJ = (vJ - projVJminus1vJ)/norm(vJ - projVJminus1vJ)

This process can be very exhausting...luckily MATLAB simplifies it for us with QR-Factorialization.
    

Examples:



Exercise: