# Given a vector between points $A$ and $B$, how determine the coordinates of point $C$ when $AC$ is collinear to $AB$ and we know the length of $AC$?

Say we have a vector $$\vec{v}$$ that defines the chemical bond between two atoms, and whose components are known

$$\vec{v} = \begin{bmatrix}v_1 \\ v_2 \\ v_3 \end{bmatrix}$$

Lets define another vector $$\vec{u}$$ that is collinear to $$\vec{v}$$, which represents the same chemical bond but with a different length, and whose length is known

$$\vec{u} = c \vec{v}$$

From

$$\lvert \vec{u} \rvert = \sqrt{(cv_1)^2 + (cv_2)^3 + (cv_3)^2}$$

I was able to derive the following relationship (which I suppose for those who do linear algebra is a well-known quality of collinear vectors)

$$\lvert \vec{u} \rvert = c \lvert \vec{v} \rvert$$

Since the magnitudes of both vectors are known, we can find $$c$$ easily (the initial bond distance is of course known, and we are free to define the new bond distance as we please).

However, and perhaps this is trivial, what I want is to obtain a quantity that I can add to the specific atomic coordinates in my molecule. Say my system consists of two molecules, and I want to adjust the distance between these two molecules, by translating one of the molecules in a direction defined by the vector between one atom of molecule 1 and one atom of molecule $$2$$.

To implement this in my code, I suppose I have to work with the coordinates themselves (since a vector on its own could be anywhere in space). So we have three sets of coordinates: atom $$A$$, initial atom $$B$$, and final atom $$B$$

\begin{align} A &= (A_x, A_y, A_z)\\[3mm] B_i &= (B_{x,i}, B_{y,i}, B_{z,i})\\[3mm] B_f &= (B_{x,f}, B_{y,f}, B_{z,f}) \end{align}

Intuitively I want to set up a set of three linear equations, one for each coordinate, but I am unsure how to proceed. Additionally I sort of want to end up using the result $$\lvert \vec{u} \rvert = c \lvert \vec{v} \rvert$$ (because collinearity is included here....... and because I derived it, lol).

Any thoughts on how to solve this (I think) simple problem?

If I understood Narlin's answer correctly, we should have the following.

Given the unit vector

$$\vec{w} = \frac{\vec{v}}{\lvert \vec{v} \rvert} =$$

and

$$c = \frac{\lvert \vec{u} \rvert }{\lvert \vec{v} \rvert}$$

we should have that

$$(B_{f,x}, B_{f,y}, B_{f_z}) = (A_x, A_y, A_z) + \frac{\lvert \vec{u} \rvert }{\lvert \vec{v} \rvert} \cdot \begin{bmatrix}w_1 \\ w_2 \\ w_3 \end{bmatrix}$$

Or, if we separate the coordinates into their own equations

\begin{align} B_{f,x} &= A_x + \frac{\lvert \vec{u} \rvert }{\lvert \vec{v} \rvert} w_1 \\[3mm] B_{f,y} &= A_y + \frac{\lvert \vec{u} \rvert }{\lvert \vec{v} \rvert} w_2 \\[3mm] B_{f,z} &= A_z + \frac{\lvert \vec{u} \rvert }{\lvert \vec{v} \rvert} w_3 \end{align}

## Numerical example

Defining the points $$A$$ and $$B_i$$

\begin{align} A &= (0,0,0) \\[3mm] B_i &= (0,2,4) \end{align}

we have that the vector $$\vec{AB_i}$$

$$\vec{AB_i} = \begin{bmatrix}0 \\ 2 \\ 4 \end{bmatrix}$$

and $$c=2$$, we have that $$\lvert \vec{AB_i} \rvert = 2\sqrt{5}$$ and that $$\lvert \vec{AB_f} \rvert = 4\sqrt{5}$$. The unit vector $$\vec{w}$$ becomes

$$\vec{w} = \begin{bmatrix}0 \\ 5^{-1/2} \\ 2\cdot 5^{-1/2} \end{bmatrix}$$

We then have everything to find the coordinates of point $$B_f$$.

Using the formula from Narlin's answer, I get that

\begin{align} B_{f,x} &= 0 + 2 \cdot 0 &= 0 \\[3mm] B_{f,y} &= 0 + 2 \cdot 5^{-1/2} &= \frac{2}{\sqrt{5}} \\[3mm] B_{f,z} &= 0 + 2 \cdot 2 \cdot 5^{-1/2} &= \frac{4}{\sqrt{5}} \end{align}

which is clearly wrong. The correct answer should be $$B_f = (0,4,8)$$.

• Is $B_f$ the point $C$ in your question title? Oct 12, 2018 at 21:07
• Yes, that is correct.
– Yoda
Oct 12, 2018 at 21:16

In this answer, variable $$c$$ represents the length of the new vector. This is a change of variable from the ones used in the question. Here, $$c=\Vert u \Vert$$. The OP used $$\Vert u \Vert$$ to represent the new vector length. $$\\$$You know coordinates for A and B. You know the length between A and B. You also know the length $$c$$ of the new vector. Define a unit vector as follows: $$w=(B-A)/|(B-A)|$$ The new point $$C = A + c\cdot w$$. Create a numeric example and this should work for you. $$\\$$(edit) You know coordinates for A and B. You know the length between A and B. In your example, the length between A & B is $$s=\Vert(B-A)\Vert=2\sqrt{5}$$
You also know the length $$c$$ of the new vector. From your example, even though you said $$c=2$$. What you really want is for $$c$$ to double the length of vector $$s$$. That is, you want $$c=2|B-A|=4\sqrt{5}$$ Define a unit vector as follows: $$\mathbf{w}=(B-A)/\Vert(B-A)\Vert$$ The new point $$C = A + c\cdot \mathbf{w}$$. Defining $$c$$ this way is important in order to move away from having point A at $$(0,0,0)$$ $$\mathbf{w}=\frac{B-A}{\Vert B-A\Vert}=\left(\begin{array}{c}0\\\frac{\sqrt{5}}{5}\\\frac{\sqrt{5}}{5}\end{array}\right)$$ $$c=2|B-A|=4\sqrt{5}$$ $$\left(\begin{array}{c} 0\\ 4\\ 8 \end{array}\right)=\left(\begin{array}{c} 0\\ 0\\ 0 \end{array}\right)+c\cdot\left(\begin{array}{c} 0\\ \frac{\sqrt{5}}{5}\\ \frac{\sqrt{5}}{5} \end{array}\right)$$ That is, $$C=A+c\mathbf{w}$$
• A and B are points but are treated as vector points. That is, they have 3 components and are subtracted, multiplied, etc as if they were vectors. $w$ will turn out to be a vector. point A is treated as a vector - again 3 components. Only $c$ is a scalar. Oct 12, 2018 at 22:14