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.

## Linear algebra

### Unit 2: Lesson 2

Linear transformation examples

# Unit vectors

What unit vectors are and how to construct them. Created by Sal Khan.

## Video transcript

We covered the idea of vector length many, many videos ago. And I realize that I forgot to cover an important topic. This topic's going to be useful when we do some types of transformation -- actually, the projections that I'll do in the next video. The notion that I forgot to do is the notion of a unit vector. And all this is, is a vector that has a length of 1. Has length and we've defined length. It has a length of 1. So if something is a unit vector, let's say that u here is a unit vector, and it's a member of Rn. Then that means that if we have u, u looks like this, has n components, u2 all the way to un. We know what the length of this is, right? We know that the length of u, sometimes called the norm of u, it's just equal to the square root of the squared sums of all of its components. And if you think about it, this is just an extension of the Pythagorean theorem, to some degree. So it's u1 squared plus u2 squared all the way to un squared. And it's the square root of that. If this is a unit vector, if this is a unit vector, so this is a unit vector, that implies that the length of u will be equal to 1. And that doesn't matter in what dimension space we are. This could be R100 this could be R2. For it to have a unit vector in any of those spaces, their length is 1. The next obvious question is, how do you construct a unit vector? Let's say that I have some vector, v. And let's say it's not a unit vector. It's v1 v2 all the way to vn. And I want to turn it into some vector u that is a unit vector, that just goes in the same direction. So u will go in the same direction, as v, but the length of u is going to be equal to 1. How do I construct this vector u here? What I could do is, I could take the length of v. I could find out what the length of v is, and we know how to do that. We just apply this definition of vector length. And what happens if I figure out the length of v, and then I multiply the vector v times that? What if I make my u, what if I say u is equal to, 1 over the length of v times v itself? What happens here? If I take the length of this thing right here, what do I get? The length of u is equal to the length of this scalar. Remember this is just some number, right? It's equal to this scalar, and I'm assuming v is a non-zero vector. The length of whatever this scalar number is times v. And we know that we can take this scalar out of the formula, we can show that -- I think I've shown it in a previous video -- that the length of c times v is equal to c times the length of v. Let me write that down. And that's essentially what I'm assuming right here. That if I take the length of c times some vector, v, that is equal to c times the length of v. I think we showed this when we first were introduced to the idea of length. So we know that this is going to be equal to 1 over the length of vector v -- that's my c -- times, so this thing right here is that thing right there, times this thing, times the length of vector v. Well what's this going to be equal to? 1 over something times that something. Well this is just going to be equal to 1. So that's all a unit vector is. If you want to find a unit vector -- or sometimes it's called a normalized vector -- that goes in the same direction as some vector v, you just figure out the length of v using the definition of vector length in Rn. And then multiply 1 over that length times the vector v -- and this is just a scalar -- and then you get your vector u. Let me to do an example, just to make sure you get the idea. Let's say I have some vector v and it's in R3. Let's say it's 1, 2, minus 1. What is the length of v? The length of v is equal to the square root of 1 squared plus 2 squared plus minus 1 squared, and that is equal to the square root of 1 plus 1 plus 4 -- square root of 6. So that is the length of v. If I want to construct a normalized vector u that goes in the same direction as v, I can just define my vector u as being equal to 1 over the length of v -- 1 over the square root of 6 -- times v. So times 1, 2, minus 1. Which is equal to 1 over square root of 6, 2 over square root of 6, and minus 1 over the square root of 6. And I'll leave it for you to verify that the length of u is going to be equal to 1. I'll just throw out one other idea here that you'll often see. When something is a unit vector, instead of using this little arrow on top of the vector, they'll often write a unit vector with a little hat on top of it, like that. That signifies that we're dealing with a unit vector. And for those of you've taken your vector calculus, or have done a little bit of engineering, you're probably familiar with the vectors i, j, and k. And the reason why they have this little hat here is because these are all unit vectors in R3. They're members of R3 and they're all unit vectors. These are actually the basis vectors in R3. And for those of you who have been watching my transformation videos, these are equivalent to the vectors e1 -- which I could write with a hat on it, really -- e2, and e3. Which are the standard basis vectors in R3. Now that you've been exposed to it, now I can start to use the idea of a unit vector in future videos.