If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# The Gram-Schmidt process

Finding an orthonormal basis for a subspace using the Gram-Schmidt Process. Created by Sal Khan.

## Want to join the conversation?

• Is there an error at ?
He copies the text, but should the second term he copies also be negative along with the first?
• yes, you are right. should be y_3 = v_3 - [projv_3], and the negative sign will be distributed to all proj terms
• What are practical applications of Gram-Schmidt process?...
Thanks.
• My chemistry professor says that the Gram-Schmidt process was used to develop the hybridization of atomic orbitals in chemistry. Linus Pauling, I think.
I'd be really grateful if Salman could do a video showing the relation between the Gram Schmidt process and hybridization orbitals. :)
• what happens if the Gram-Schmidt procedure is applied to a list of vectors that is not linearly independent?
• Basically, if you have a vector d that is a linear combination of vectors a, b, & c and you apply the Gram-Schmidt procedure, then subtracting each respective projection from d will leave you with a vector of zeroes. [It would be like taking a vector (a,b,c) and subtracting the x-, y-, & z-components--you're left with nothing!] Thus, assuming the procedure is automated, an error will occur because any attempt to "normalize" the zero vector will entail trying to divide by zero.

As a result, you'll need to take this into account in your algorithm, testing to see whether your output is a zero vector, and getting rid of them as they arise...

Hope this helps!
• Question about projection: I have learned that the projection of v onto w = (v dot w / v dot v) times v.

However, I see Sal is calculating projection of v2 onto v1 = (v2 dot u1) times u1
where normally, this would be calculated by projection = (v2 dot v1 / v2 dot v2) times v2

Why not (v2 dot u1 / v2 dot v2) times v2?
Doesn't (v2 dot u1) times u1 just = an orthonormal basis? is the orthonormal basis = projection in this case?

my question is, how do we go from (v2 dot v1 / v2 dot v2) times v2 to (v2 dot u1) times u1? is it because u1 is an orthonormal basis for v1? How were we able to drop out the denominator in the projection equation?
• First, when you project a vector v onto a vector w, the result is a scaled version of the vector w, NOT the vector v:
proj(v) = k w,
where "k" is a constant and:
k = (vw/‖w‖²)

The formula you first mention ["(v dot w / v dot v) times v"] is the correct formula for the projection of w onto v.
Now, the reason why we want to first project the vector v onto w is so that we can then subtract that projection from v, leaving us with a new vector (I'll call it vector "b") that is orthogonal to w Thus,

b = v - proj(v)

(And then, of course, we "normalize" the vector so that it has unit length).

Lastly, the reason why Sal drops out the denominator in the projection equation is because the denominator is the squared length of the vector u_1 which is equal to 1 because it is a unit vector.

Again, to reiterate, the new orthonormal basis vector is NOT the projection vector. Rather, we calculate the projection vector, proj(v) so that we can subtract it from v itself, leaving us with a new vector that's orthogonal to w.

Does this make sense?? Hope this helps!!
• At "", you forgot to put the || signs. You wrote u_1 instead of ||u_1||
• Here the letter "u" is meant to stand for "unit vector", so you don't need to write "||u1||".
• Well, here I noticed something interesting.
The result of the Gram-Schmidt process orthogonal basis is dependent on the vector we choose to start up with and so on.
For example, if I start with projecting into v_1 I will have different results than starting with v_2.
• This is true. It is worth noting that basis sets are not unique, and neither are orthonormal basis sets. Thus, it is not surprising that the Gram-Schmidt process can produce different basis sets depending on how it is performed.
• I have another method.

Just divide every vector in the basis by their lengths. Is my method valid?
• No. You would be missing orthogonality!
• At the beginning of the video it is stated that v1 and v2 are basis vectors for a subspace.
If they are basis vectors then shouldn't they be orthogonal to each other.
If they are orthogonal to each other how can they have a projection onto each other at in the video.