Finding the unit vector indicating direction from A to B

3.3k Views Asked by At

Given vector A and vector B, how can I find the unit vector indicating the direction from A to B?

For example (U is the found unit vector):

  • A = 2,3
  • B = 2,6
  • U = 0,1

Assume 2D space and low mathematical skills.

1

There are 1 best solutions below

9
On BEST ANSWER

$(B-A)/ \parallel B-A \parallel$

where the numerator is a vector in the direction which is the difference between $B$ and $A$ (think of the arrow as starting at A and ending at B, except that being a vector, it is pointed at the origin).

The denominator is the norm of the above vector, ie, the normalization factor that yields a unit vector.

This works in all finite dimensional vector spaces not just $\mathbb R^2$.