# How do you calculate the unit vector between two points?

I'm reading a paper on fluid dynamics and it references a unit vector between two particles i and j. I'm not clear what it means by a unit vector in this instance. How do I calculate the unit vector between the two particles?

-

Two particles i, j are located in some reference frame at vectorial positions $\vec{r}_i$ and $\vec{r}_j$. Therefore the vector which starts at the position of i and ends at j, is just the difference $\vec{r}_j-\vec{r}_i$; its modulus $||\vec{r}_j-\vec{r}_i||$ is the distance between the particles so one can construct the unit vector in that direction (from i to j) by just $$\vec{u}_{ij}=\frac{1}{||\vec{r}_j-\vec{r}_i||}(\vec{r}_j-\vec{r}_i)$$ Indeed this is a unit vector for its a multiple of the original with unit modulus since $||\vec{u}_{ij}||=\left|\frac{1}{||\vec{r}_j-\vec{r}_i||}\right|\cdot||\vec{r}_j-\vec{r}_i||=1$ using the property $||\lambda\cdot\vec{v}||=|\lambda|\cdot ||\vec{v}||$.

-

If particle $i$'s position is described by a position vector $\vec{r}_i$ and particle $j$'s position is described by a position vector $\vec{r}_j$, then you can define the position of $j$ relative to $i$ as

$$\vec{r}_{ji}= \vec{r}_j-\vec{r}_i$$

Now, if you divide this vector by its length:

$$\frac{\vec{r}_{ji}}{\|\vec{r}_{ji}\|}=\frac{\vec{r}_j-\vec{r}_i}{\|\vec{r}_j-\vec{r}_i\|}$$

you get a vector with unit length and aligned along the direction of the line through particles $i$ and $j$, pointing towards $j$.

-
@McGin: Note that $\vec{r}_{ji}$ and $\vec{r}_{ij}$ are different, even though they have the same length. – J. M. Dec 2 '10 at 11:38