Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

Given points $A$ and $C$ in the plane, how do I find the point $B$ on the line segment between $A$ and $C$ that is located at a distance $d$ from $A$?

Example: $$A = (0,3), \qquad C = (3,0), \qquad d=1$$

share|cite|improve this question
Definitely not algebraic geometry. Or multivariable calculus for that matter. – anon Apr 19 '12 at 21:21
Could you be more specific? On a side note, I need to implement this in code. – Glimpse Apr 19 '12 at 21:35

You could use a parametrization:

Given $A=(a_1, a_2)$ and $B=(b_1,b_2)$, the a parametrization of the line segment $AB$ from $A$ to $B$ is $$ \eqalign{ x(t) &= a_1 + (b_1-a_1)t\cr y(t) &= a_2 +(b_2-a_2)t }\ \ ;\ \ \ \ 0\le t\le1. $$

With this parametrization, $t_d\cdot100\%$ of the line segment is traced out as $t$ increases from $t=0$ to $t=t_d$.

So, if you want the coordinates of the point $C$ on the line segment whose distance from $A$ is $d$, first compute the ratio of $d$ to the length of $AB$ and set this equal to $t_d$: $$ t_d={d\over \sqrt{(a_1-b_1)^2+(a_2-b_2)^2 }}. $$

Then evaluate the coordinates of $C=(x_C,y_C)$ as $C=\bigl( x(t_d), y(t_d) \bigr)$.

That is, the coordinates of $C$ are $$ \eqalign { x_C&=a_1+{d(b_1-a_1)\over \sqrt{(a_1-b_1)^2+(a_2-b_2)^2 }}\cr y_C&=a_2+{d(b_2-a_2)\over \sqrt{(a_1-b_1)^2+(a_2-b_2)^2 }}.\cr } $$

share|cite|improve this answer

The following is a very useful fact. The points in the interval from $(a,b)$ to $(c,d)$ are precisely the points $(x,y)$ such that $$x=(1-t)a+ tc,\qquad y=(1-t)b+td,\tag{$\ast$}$$ where $t$ ranges over the interval from $0$ to $1$. Moreover, this point $(x,y)$ divides the interval from $(a,b)$ to $(c,d)$ in the ratio $t:1-t$. To put it another way, the distance from $(a,b)$ to $(x,y)$ is $t$ times the distance from $(a,b)$ to $(c,d)$.

We will use $(\ast)$, with $(a,b)=(0,3)$ and $(c,d)=(3,0)$. The distance from $(0,3)$ to $(3,0)$ is $\sqrt{18}$, or more simply $3\sqrt{2}$. If $B$ is to be at distance $d$ from $A$, we want $t:1 =d:3\sqrt{2}$.

So $t=\dfrac{d}{3\sqrt{2}}$. Finally, use this value of $t$ in $(\ast)$ to find the coordinates $(x,y)$ of $B$.

share|cite|improve this answer

The direction from $\rm A$ to $\rm C$ is parallel to the displacement $\rm \vec{w}=\overline{AC}$. Normalizing (dividing through by the magnitude of the displacement), the direction (as a unit vector) is exactly $$\rm \vec{v} = \frac{\vec{w}}{\|\vec{w}\|}.$$

Now if $\rm \vec{u}=\overline{AB}$ is parallel to $\rm \vec{v}$ and has magnitude $\rm d$, and $\rm \vec{B}=\vec{A}+\vec{u}$, then...

In your example, the displacement from A to C is $\rm \vec{C}-\vec{A}=(3,-3)$. Normalizing,

$$\rm \vec{v}=\frac{(3,-3)}{\sqrt{3^2+(-3)^2}}=\left(\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}}\right).$$

Multiplying this by d and tacking it onto A, we have

$$\rm \vec{C}=\vec{A}+1\left(\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}}\right)=\left(\frac{1}{\sqrt{2}},3-\frac{1}{\sqrt{2}}\right).$$

share|cite|improve this answer
Ok, thank you very much. – Glimpse Apr 19 '12 at 21:53

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.