Step by step
The question
Question: find the unit vector in the direction of (2, 1, 2).
v = [2; 1; 2]
A unit vector has length 1.
To get one in the same direction, we divide v by its length.
unit vector: length 1, same direction
u = v ÷ ‖v‖
1 Find the length
The length: every entry squared, added, then the square root.
‖v‖ = √22 + 12 + 22
‖v‖ = √4 + 1 + 4
‖v‖ = √9
9 is 3 squared.
So the length is 3.
‖v‖ = 3
2 Divide every entry
Every entry divided by 3.
u = [2 over 3; 1 over 3; 2 over 3]
Careful!
Every entry is divided by the length, not only the first one.
Careful: divide EVERY entry by the length
3 Check
Let's check: the length of u must be 1.
Its entries squared add up to 1, and the root of 1 is 1.
So the answer is right!
(23)2 + (13)2 + (23)2 = 49 + 19 + 49 = 99 = 1
Let's look back.
First: find the length.
Then: divide every entry.
Last: check.
Answer
Careful: divide EVERY entry by the length