acalculator

What is the unit vector?

Type a vector’s components, or the point where it starts and the point where it ends. The unit vector calculator divides the vector by its length and shows the result as decimals and in exact form.

Your numbers

I know
Read as: 3; 4Numbers separated by commas, 1 to 10 of them.
Unit vector û = v ÷ ‖v‖
⟨0.6, 0.8⟩

The unit vector of ⟨3, 4⟩ is ⟨0.6, 0.8⟩.

Exact unit vector
⟨3/5, 4/5⟩
Magnitude ‖v‖
5
Vector v
⟨3, 4⟩
Direction angle
53.1301

Unit vector û = v ÷ ‖v‖: ⟨0.6, 0.8⟩. The unit vector of ⟨3, 4⟩ is ⟨0.6, 0.8⟩.

How to calculate

Finds the unit vector in the direction of a vector, from its components or from a start and an end point, in 2D, 3D or up to 10 dimensions, with the exact form and the magnitude.

Example with the default inputs (I know Components, Components of v [3, 4]): The unit vector of ⟨3, 4⟩ is ⟨0.6, 0.8⟩.

Method: û = v ÷ ‖v‖ with ‖v‖ = √(v₁² + … + vₙ²); from P to Q, v = Q − P.

  • Euclidean length; from two points, v = Q − P (end minus start), coordinate by coordinate.
  • 1 to 10 components. The zero vector has no unit vector.
  • The exact form is shown when the squared length, after dividing by the largest component, is p/q with p × q at most 10¹².

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. I know Components, Components of v 1, 2 gives Unit vector û = v ÷ ‖v‖ ⟨0.447214, 0.894427⟩, Exact unit vector ⟨√5/5, 2√5/5⟩, Magnitude ‖v‖ 2.236068.Source: OpenStax, Calculus Volume 3, §2.1 Vectors in the Plane (unit vector v ÷ ‖v‖; Example 2.7: v = ⟨1, 2⟩ has unit vector ⟨1/√5, 2/√5⟩). https://openstax.org/books/calculus-volume-3/pages/2-1-vectors-in-the-plane
  2. I know Components, Components of v 3, 4 gives Unit vector û = v ÷ ‖v‖ ⟨0.6, 0.8⟩, Exact unit vector ⟨3/5, 4/5⟩, Magnitude ‖v‖ 5, Direction angle 53.130102.Source: OpenStax, Calculus Volume 3, §2.1 Vectors in the Plane (unit vector v ÷ ‖v‖; Example 2.7: v = ⟨1, 2⟩ has unit vector ⟨1/√5, 2/√5⟩). https://openstax.org/books/calculus-volume-3/pages/2-1-vectors-in-the-plane
  3. I know Components, Components of v 2, -1, 2 gives Unit vector û = v ÷ ‖v‖ ⟨0.666667, −0.333333, 0.666667⟩, Exact unit vector ⟨2/3, −1/3, 2/3⟩, Magnitude ‖v‖ 3.Source: OpenStax, Calculus Volume 3, §2.2 Vectors in Three Dimensions (‖v‖ = √(x² + y² + z²)). https://openstax.org/books/calculus-volume-3/pages/2-2-vectors-in-three-dimensions
  4. I know Start and end points, Start point P 1, 2, End point Q 4, 6 gives Vector v ⟨3, 4⟩, Unit vector û = v ÷ ‖v‖ ⟨0.6, 0.8⟩, Magnitude ‖v‖ 5.Source: OpenStax, Calculus Volume 3, §2.1 Vectors in the Plane (unit vector v ÷ ‖v‖; Example 2.7: v = ⟨1, 2⟩ has unit vector ⟨1/√5, 2/√5⟩). https://openstax.org/books/calculus-volume-3/pages/2-1-vectors-in-the-plane

How it works

For a vector v = ⟨v₁, v₂, …, vₙ⟩:

  • Magnitude: ‖v‖ = √(v₁² + v₂² + … + vₙ²).
  • Unit vector: û = v ÷ ‖v‖ = ⟨v₁ ÷ ‖v‖, …, vₙ ÷ ‖v‖⟩. It has length 1 and points the same way as v.
  • From two points: with start P and end Q, v = Q − P, coordinate by coordinate.
  • Direction angle (2D only): θ = atan2(y, x) of the unit vector, in degrees, moved into the range from 0° up to 360° (add 360° to a negative angle).

The page first divides every component by the largest one in absolute value (m). This does not change the unit vector, and it keeps the squares from overflowing. The magnitude is m times the length of the divided vector.

Exact form. Each number is read exactly as typed (0.5 is 1/2). After dividing by m, the squared length is an exact fraction p/q in lowest terms, so the length is √(p × q) ÷ q, and √(p × q) is simplified to k√r with no square factor left in r. Each exact component is then (cᵢ × q ÷ (k × r))√r, where cᵢ is the component divided by m, written with the root on top: 3/5, √5/5, 2√5/5, −√2/2.

Rules

  • 1 to 10 components. From two points, P and Q must have the same number of coordinates; otherwise there is no answer.
  • The zero vector (every component 0) has no answer.
  • A component of Q − P beyond the largest double-precision number has no answer. A magnitude that large is left out; the unit vector still shows.
  • The exact form is shown when p × q is at most 10¹²; it is left out above that.

Output format. Vectors are written ⟨a, b, c⟩ with each component to 6 significant digits, trailing zeros dropped, and a true minus sign (−), also in an exponent (1e−7). The magnitude is a double-precision number. The angle shows up to 4 decimals.

Worked examples by hand

⟨1, 2⟩. ‖v‖ = √(1 + 4) = √5 ≈ 2.236068. û = ⟨1/√5, 2/√5⟩ = ⟨√5/5, 2√5/5⟩ ≈ ⟨0.447214, 0.894427⟩.

⟨3, 4⟩. ‖v‖ = √(9 + 16) = 5. û = ⟨3/5, 4/5⟩ = ⟨0.6, 0.8⟩. Angle atan2(0.8, 0.6) = 53.1301°.

⟨2, −1, 2⟩. ‖v‖ = √(4 + 1 + 4) = 3. û = ⟨2/3, −1/3, 2/3⟩ ≈ ⟨0.666667, −0.333333, 0.666667⟩.

From P(1, 2) to Q(4, 6). v = ⟨4 − 1, 6 − 2⟩ = ⟨3, 4⟩, so û = ⟨0.6, 0.8⟩ and ‖v‖ = 5.

Other questions people ask

How do I find a unit vector?

Divide each component by the vector’s magnitude: û = v ÷ ‖v‖. For v = ⟨3, 4⟩, ‖v‖ = 5, so û = ⟨3/5, 4/5⟩ = ⟨0.6, 0.8⟩.

What is the unit vector of ⟨1, 2⟩?

‖v‖ = √5, so û = ⟨1/√5, 2/√5⟩. With the root moved to the top that is ⟨√5/5, 2√5/5⟩, about ⟨0.447214, 0.894427⟩. This is Example 2.7 in OpenStax Calculus Volume 3.

How do I find the unit vector between two points?

Subtract the start point from the end point, v = Q − P, then divide by its length. From P(1, 2) to Q(4, 6): v = ⟨3, 4⟩ and û = ⟨0.6, 0.8⟩.

Does the zero vector have a unit vector?

No. Its length is 0, so there is nothing to divide by, and it points in no direction.

Why is the length of the unit vector 1?

Dividing every component by ‖v‖ divides the length by ‖v‖ too, so the new length is ‖v‖ ÷ ‖v‖ = 1. The direction stays the same.

Do ⟨3, 4⟩ and ⟨30, 40⟩ have the same unit vector?

Yes. A positive multiple of a vector points the same way, so both give ⟨0.6, 0.8⟩. A negative multiple gives the opposite unit vector.