Unit Vector Calculator (2D and 3D, with Direction Angles and Graph)

Unit Vector Calculator

x
y
z

Quick examples:

Drag the tip of the blue arrow to change the vector. The orange arrow is the unit vector: it has length 1 and its tip sits on the dashed circle.


Unit vector û:

-

Unit vector in decimals:

-

Written with i, j, k:

-

Magnitude |v|:

-

Check: magnitude of û:

-

Direction cosines:

-

Direction angles:

-

Angle θ from the positive x-axis:

-

Calculation:

-

Enter the components of a vector and the calculator turns it into its unit vector: the one that points the same way and has length exactly 1. You get the magnitude, the unit vector in exact form (roots rationalized) and in decimals, a check that its length is 1, the direction cosines and angles, and a drawing of both arrows, in the plane or in space.

Below you will find the formulas, worked examples, a table of common vectors and the most frequent questions.

How to use the unit vector calculator

Step 1: Pick 2D vector if your vector lies in the plane or 3D vector if it lives in space.

Step 2: Enter the components. Decimals with a point or a comma and negative numbers all work. You can also move the sliders, tap a quick example or, in 2D, drag the tip of the blue arrow.

Step 3: The result updates as you type, and also with the Calculate button or the Enter key.

Step 4: Read the unit vector in exact form, in decimals and written with i, j, k. The Calculation box shows each step with your numbers.

Unit vector formulas

To find the unit vector of v = (x, y, z), divide each component by the magnitude of the vector. This is called normalizing the vector.

|v| = √(x² + y² + z²)
û = v ÷ |v| = (x ÷ |v|, y ÷ |v|, z ÷ |v|)

The components of û are the direction cosines of the vector: the cosines of the angles α, β and γ it makes with the x, y and z axes. That is why their squares always add up to 1.

cos α = x ÷ |v|, cos β = y ÷ |v|, cos γ = z ÷ |v|, cos²α + cos²β + cos²γ = 1

In the plane one angle θ is enough, measured from the positive x-axis counterclockwise. It is adjusted to the quadrant: add 180° when x is negative, or 360° when x is positive and y is negative.

θ = arctan(y ÷ x)

When the magnitude is a root, such as √14, rationalize the denominator: 1 ÷ √14 = √14 ÷ 14. You can also write the unit vector with i, j, k, for example û = (3/5) i + (4/5) j. Many calculus books use angle brackets, ⟨3/5, 4/5⟩, but the numbers are the same.

Unit vector examples

Example 1: unit vector of v = (3, 4)

|v| = √(3² + 4²) = √25 = 5

û = v ÷ |v| = (3 ÷ 5, 4 ÷ 5) = (3/5, 4/5) = (0.6, 0.8)

|û|² = (3/5)² + (4/5)² = 9/25 + 16/25 = 25/25 = 1

θ = arctan(4 ÷ 3) ≈ 53.13°

cos α = 3/5 → α = arccos(3/5) ≈ 53.13°

cos β = 4/5 → β = arccos(4/5) ≈ 36.87°

û = (3/5, 4/5) = (0.6, 0.8)

The magnitude comes out exact (5), so the components are simple fractions. The check adds up to 1, as it should.

Example 2: v = (-5, 12), with a negative component

|v| = √((-5)² + 12²) = √169 = 13

û = v ÷ |v| = (-5 ÷ 13, 12 ÷ 13) = (-5/13, 12/13) ≈ (-0.3846, 0.9231)

θ = arctan(y ÷ x) = arctan(12 ÷ (-5)) ≈ -67.38°

Since x is negative, add 180°: -67.38° + 180° ≈ 112.62°

û = (-5/13, 12/13) ≈ (-0.3846, 0.9231)

The vector sits in the second quadrant. The arctangent alone gives -67.38°, an angle from the fourth quadrant, so you add 180°. The unit vector keeps the signs of v.

Example 3: unit vector of v = (2, 3, 6) in 3D

|v| = √(2² + 3² + 6²) = √49 = 7

û = v ÷ |v| = (2 ÷ 7, 3 ÷ 7, 6 ÷ 7) = (2/7, 3/7, 6/7) ≈ (0.2857, 0.4286, 0.8571)

|û|² = (2/7)² + (3/7)² + (6/7)² = 4/49 + 9/49 + 36/49 = 49/49 = 1

cos α = 2/7 → α = arccos(2/7) ≈ 73.4°

cos β = 3/7 → β = arccos(3/7) ≈ 64.62°

cos γ = 6/7 → γ = arccos(6/7) ≈ 31°

û = (2/7, 3/7, 6/7) ≈ (0.2857, 0.4286, 0.8571)

The direction cosines are 2/7, 3/7 and 6/7, and the direction angles are α ≈ 73.4°, β ≈ 64.62° and γ ≈ 31°.

Example 4: v = (1, 2, 3), with a root in the magnitude

|v| = √(1² + 2² + 3²) = √14 ≈ 3.742

û = v ÷ |v| = (1 ÷ √14, 2 ÷ √14, 3 ÷ √14)

Rationalize: (1/√14, 2/√14, 3/√14) = (√14/14, √14/7, 3√14/14) ≈ (0.2673, 0.5345, 0.8018)

cos α = √14/14 → α = arccos(√14/14) ≈ 74.5°

cos β = √14/7 → β = arccos(√14/7) ≈ 57.69°

cos γ = 3√14/14 → γ = arccos(3√14/14) ≈ 36.7°

û = (√14/14, √14/7, 3√14/14) ≈ (0.2673, 0.5345, 0.8018)

Since √14 is not a whole number, the exact answer keeps a root. The direction angles are α ≈ 74.5°, β ≈ 57.69° and γ ≈ 36.7°.

Table of vectors and their unit vectors

Vector vMagnitude |v|Unit vector (exact)Unit vector (decimals)
(3, 4)5(3/5, 4/5)(0.6, 0.8)
(5, 12)13(5/13, 12/13)(0.3846, 0.9231)
(1, 1)√2 ≈ 1.414(√2/2, √2/2)(0.7071, 0.7071)
(2, -3)√13 ≈ 3.606(2√13/13, -3√13/13)(0.5547, -0.8321)
(1, 2, 2)3(1/3, 2/3, 2/3)(0.3333, 0.6667, 0.6667)
(2, 3, 6)7(2/7, 3/7, 6/7)(0.2857, 0.4286, 0.8571)
(4, 4, 7)9(4/9, 4/9, 7/9)(0.4444, 0.4444, 0.7778)
(1, 1, 1)√3 ≈ 1.732(√3/3, √3/3, √3/3)(0.5774, 0.5774, 0.5774)

Frequently asked questions

What is a unit vector?

It is a vector with magnitude 1. It only gives a direction, whatever the length. The best known are i = (1, 0, 0), j = (0, 1, 0) and k = (0, 0, 1), which point along the axes.

How do you find the unit vector of a vector?

Divide each component by the magnitude. For v = (3, 4) the magnitude is 5, so û = (3/5, 4/5) = (0.6, 0.8).

Why does the zero vector have no unit vector?

Its magnitude is 0 and you cannot divide by 0. The zero vector also points nowhere, so there is no direction to keep.

What are direction cosines?

They are the cosines of the angles a vector makes with the x, y and z axes, and they equal the components of the unit vector. For v = (2, 3, 6) they are 2/7, 3/7 and 6/7, and their squares add up to 1.

Can a unit vector have a component larger than 1?

No. When the magnitude is 1, no component can exceed 1 in absolute value, because its square would already be above 1. Every component stays between -1 and 1.

Learn more

Related calculators

You can explore other calculators here.