Advertisement

Unit vector calculator

Enter a nonzero vector to normalise it, or supply the known components of a unit vector.

Calculator

Unit vector
(0.6, 0.8)
Vector with target magnitude
(0.6, 0.8)
Original magnitude
5.00000000
Direction from positive x, for 2D
53.1301

Advertisement

How this calculator works

Normalisation divides each component by the Euclidean magnitude. Direction stays the same while magnitude becomes one. Multiplying that unit vector by a target magnitude gives a rescaled vector. A missing unit-vector component is determined only up to sign unless its value is zero. The known components can occupy any positions; the returned values fill the one omitted position.

Formula

u = A/|A|; rescaled vector = target times u. Missing component = plus or minus sqrt(1 - sum(known components squared)).

Worked example

The vector (3, 4) has magnitude 5, so its unit vector is (0.6, 0.8). With one known unit component 0.6, the missing component can be 0.8 or -0.8.

Advertisement

Frequently asked questions

Why cannot zero be normalised?

Division by its zero magnitude is undefined, and it has no preferred direction.

Why are there two missing values?

Squaring loses the sign. Both signs give length one unless extra directional information is supplied.

Can the target magnitude be zero?

Yes. A nonzero input still defines a direction, and rescaling it to zero returns the zero vector.

Sources

Advertisement