Unit Vector Calculator
Enter your vector components and this calculator instantly finds the unit vector in the same direction. It shows the magnitude, each normalized component, the direction angles in both degrees and radians, and a full step-by-step breakdown of the math. Switch between 2D and 3D mode; the result updates as you type.
Formula
Worked example
For vector v = (3, -4, 0): magnitude = sqrt(9 + 16 + 0) = sqrt(25) = 5. Unit vector = (3/5, -4/5, 0/5) = (0.6, -0.8, 0). Check: sqrt(0.36 + 0.64 + 0) = sqrt(1) = 1. Direction angle with x-axis: arccos(0.6) = 53.13 deg.
What is a unit vector?
A unit vector is a vector that has a magnitude (length) of exactly 1. It points in the same direction as the original vector but is scaled so its length equals 1. Unit vectors are written with a hat notation, such as u-hat, to distinguish them from ordinary vectors. They are useful whenever you need direction information without caring about magnitude: for example, a surface normal in 3D graphics is always a unit vector, and the direction cosines of a flight path are the components of the corresponding unit vector.
How to find a unit vector
To normalize a vector v with components (x, y, z), you first compute the magnitude |v| = sqrt(x^2 + y^2 + z^2). Then divide each component by that magnitude: unit vector = (x / |v|, y / |v|, z / |v|). The resulting vector always has magnitude 1. In 2D the process is identical, just drop the z term. If the original vector is the zero vector (all components are 0), it has no direction and cannot be normalized. A quick sanity check: square all components of your unit vector and sum them; the result must equal 1.
Direction angles and direction cosines
The direction angles of a 3D vector are the angles alpha, beta, and gamma that the vector makes with the positive x-, y-, and z-axes respectively. The cosines of these angles, called direction cosines, are exactly the components of the unit vector: cos(alpha) = ux, cos(beta) = uy, cos(gamma) = uz. A fundamental identity holds: cos^2(alpha) + cos^2(beta) + cos^2(gamma) = 1, which is just a restatement of the unit vector having magnitude 1. This calculator reports all three direction angles and lets you switch between degrees and radians.
Applications of unit vectors
Unit vectors appear throughout science and engineering. In physics, force, velocity, and field equations often separate magnitude from direction by writing the vector as a scalar times a unit vector. In computer graphics, surface normals are unit vectors that determine how light reflects off a surface. In navigation, bearing and heading are encoded in unit vectors. In machine learning, cosine similarity compares two vectors by computing the dot product of their unit forms. Any time you see a formula with a hat over a letter, that is a unit vector.
Standard basis unit vectors
| Name | Components | Direction | Use |
|---|---|---|---|
| i-hat | (1, 0, 0) | Positive x-axis | Horizontal / East |
| j-hat | (0, 1, 0) | Positive y-axis | Vertical / North |
| k-hat | (0, 0, 1) | Positive z-axis | Depth / Up |
| -i-hat | (-1, 0, 0) | Negative x-axis | Horizontal / West |
| -j-hat | (0, -1, 0) | Negative y-axis | Vertical / South |
| -k-hat | (0, 0, -1) | Negative z-axis | Depth / Down |
The three standard Cartesian basis vectors are the simplest unit vectors. Every vector in 3D space is a linear combination of these.
Frequently asked questions
What happens if I enter the zero vector?
The zero vector (0, 0, 0) has no direction and cannot be normalized. Division by zero would occur when you try to divide each component by the magnitude, which is zero. Mathematically, the unit vector for the zero vector is undefined. This calculator leaves the result blank when all components are zero.
Does the order I enter the components matter?
Yes. The components label your vector along specific axes: x is the first axis, y the second, z the third. Swapping components gives a different vector pointing in a different direction. However, the magnitude is the same regardless of order, since squaring eliminates sign differences and addition is commutative.
How do I check my answer manually?
Square each component of the unit vector and sum them. If the normalization is correct, the sum is 1 (or very close to 1 due to floating-point rounding). This calculator shows a verification row labeled "Verify: unit vector magnitude" that should display 1.000000.
Can a vector component be negative?
Yes. Negative components simply mean the vector points partly in the negative direction along that axis. The normalization process works the same way: divide each component (positive or negative) by the magnitude. The resulting unit vector component will carry the same sign as the original component.
What is the difference between a unit vector and a normalized vector?
They are the same thing. "Normalizing" a vector means scaling it to have magnitude 1, producing the unit vector in that direction. The word "normalize" comes from "normal" in the sense of standard or unit-length, not from the statistical normal distribution.
What are direction cosines?
Direction cosines are the cosines of the three angles (alpha, beta, gamma) that a vector makes with the positive x-, y-, and z-axes. They are identical to the components of the unit vector in that direction. The identity cos^2(alpha) + cos^2(beta) + cos^2(gamma) = 1 always holds, because the unit vector has magnitude 1.