Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have point $A$ which is traveling towards point $B$. Both points have $x,y,z$ coordinates. Point $A$ has a speed. For a given time period how much would I add to the $x,y,z$ coordinates of $A$ in order to make it travel at that speed?

Multiplying speed by the time would give me the distance traveled. I assume I could use trig to figure out all the distances that need to be added to $x$, $y$, and $z$. But, I get the feeling that there is a more efficient way to use matrices for this.

There's also the issue of overshooting point $B$ during any given time period, but I can just prevent that by getting the distance between the points and determining how much the distance traveled overshoots.

share|cite|improve this question
If your point is actually a vehicle, your problem is a guidance problem. Do you need to consider the dynamics of the point? Do you need determine the acceleration of the point? If the point only travels along with the straight line between A and B, I think it is trivial. – Shiyu Aug 29 '11 at 0:53
Note that Arturo's and Ross's answers are more or less the same... :) – J. M. Aug 29 '11 at 1:14
up vote 1 down vote accepted

If $A=(a_1,a_2,a_3)$ and $B=(b_1,b_2,b_3)$, then let $C=(b_1-a_1,b_2-a_2,b_3-a_3)$, and let $\mathbf{u}=C/\lVert C\rVert$ be the unit vector in the direction of $C$.

The function $A + t\mathbf{u}$ parametrizes the line through $A$ and $B$; and has value $A$ when $t=0$ and value $B$ when $t = \lVert C\rVert$; the derivative is $\mathbf{u}$, and thus the speed (which is the size of the velocity) is given by $\lVert u\rVert = 1$. To get it to be $s$, the speed you want, you just need to take $s\mathbf{u}$ instead of $\mathbf{u}$. So the function you want is $$A + st\left(\frac{B-A}{\lVert B-A\rVert}\right),$$ where the variable is $t$.

share|cite|improve this answer
That works except it's B-A like you mentioned for the definition of C. Thanks! Also, I needed to look up what those vertical lines mean. Apparently they indicate the "Norm" which is just the square root of the sums of the squares. – HappyEngineer Aug 29 '11 at 3:38
@HappyEngineer: Indeed! Sorry about the transposition. Yes, the double vertical bars are the (Euclidean norm) of the vector. – Arturo Magidin Aug 29 '11 at 3:42

If the coordinates of $A$ are $(x_a,y_a,z_a)$, those of $B$ are $(x_b,y_b,z_b)$ and you want to arrive at time $t_0$, the coordinates at time $t$ are $(x_a+\frac{t}{t_0}(x_b-x_a),y_a+\frac{t}{t_0}(y_b-y_a),z_a+\frac{t}{t_0}(z_b-z_a))$. To get $t_0$ if you have speed $s$, you have $t_0=\sqrt{(x_b-x_a)^2+(y_b-y_a)^2+(z_b-z_a)^2}/s$. Not a trig function in sight.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.