Unit vector
lastmod 2022-03-21created 2022-03-2112 edits
In linear algebra, a unit vector is a vector whose length is '1'.
The unit vector with the same direction as a vector \(v\) is often written with a circumflex over the letter, read as 'hat'. It is written \({\hat {v}}\) and read 'v hat'.
Normalization
- Vector magnitude and normalization (understanding the concept) | Advanced JS: Natural Simulations | Khan Academy
- Direction vectors - vector normalization (normalized) in Unity
- Understanding vector magnitude and the normalization process
- [Recommended] Vector - a summary of vector concepts
- [Recommended] Vector normalization (ICT glossary)
- [Recommended] EDGERIDER : Naver Blog - (Game math) Understanding Normalize
A vector is
- a physical quantity that has both magnitude and direction
Vector Normalization is
- making the magnitude of a vector 1, turning it into a Unit Vector
- A normalized vector keeps its direction, but its unit becomes 1
Vector-ko.png
\(v = ||v|| * u\)
(\(||v||\) is the length of the vector, i.e. a Scalar value, and u is the unit vector with the same direction as v)
As in the definition, normalization means dividing a vector by its magnitude.
\(u = \frac{v}{||v||}\)
Now let's extend this vector concept to 3D space. In 3D space, a vector can be separated into its components.
\(v = au_x + bu_y + cu_z\)
(Let the unit vectors of each component be ux, uy, uz, and the length of each component be a,b,c)
For reference, a vector built this way is called a Linear Combination.
The magnitude of such a linearly combined vector is computed as follows.
\(||v|| = \sqrt{a^2 + b^2 + c^2}\)
This magnitude of a vector is called the Norm of the vector. The norm defines the length of a vector in 3D space.
Dividing each component of the Vector by this Norm gives a unit vector of length 1 in 3D, i.e. a normalized vector.
The formula below normalizes a Vector.
\(u = (\frac{au_x}{||v||}, \frac{bu_y}{||v||}, \frac{cu_z}{||v||})\)
Example
For example, suppose we normalize a Vector with the value (2,-1,3). The length (Norm) of this vector is:
\(||v|| = \sqrt{2^2 + (-1)^2 + 3^2} = \sqrt{4+1+9} = \sqrt{14}\)
Dividing each component of this vector by its magnitude gives the Normalized Vector.
\(u = (\frac{2}{\sqrt{14}}, \frac{-1}{\sqrt{14}}, \frac{3}{\sqrt{14}})\)
To check that the value is normalized, compute the length again from the divided values; you get a unit vector of exactly length 1.
\(\sqrt{(\frac{2}{\sqrt{14}})^2 + (\frac{-1}{\sqrt{14}})^2 + (\frac{3}{\sqrt{14}})^2} = 1\)
SpeedCrunch code: