# How do I find a point a given distance from another point along a line?

I have $(x_1, y_1), (x_2, y_2)$.

How do I find the point that's $d$ distance away from $(x_1, y_1)$ on a straight line to $(x_2, y_2)$?

I know I can get the length of the line with Pythagoras. I know if I drew a circle I could use the radius as distance and the point would be where the line and the circle intersect.

Could someone briefly explain each step to me please?

I don't understand Finding a point along a line a certain distance away from another point!

-
$(x_1,x_2) + d\dfrac{(x_2-x_1, y_2-y_1)}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}}$ –  Rahul Jun 2 '13 at 22:59
Does this help? en.wikipedia.org/wiki/Distance_from_a_point_to_a_line –  Amzoti Jun 2 '13 at 23:45

If I can move one unit along a line I can move any distance along that line. We'll calculate how much we would have to add to each of $x_1$ and $y_1$ to move one unit along the line and then we'll multiply that by $d$ to get the answer.

Let $d^{\prime}$ be the distance between $(x_1,y_1)$ and $(x_2,y_2)$. It's value is $$d^{\prime}=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$$

If we move from $(x_1,y_1)$ to $(x_2,y_2)$ along the line connecting them we move $d^{\prime}$ units. We can represent this by the function

$$(x_1,y_1)\mapsto (x_1+(x_2-x_1),y_1+(y_2-y_1))$$

To move one unit along the same line, we divide the amount of the change by $d^{\prime}$ to get

$$(x_1,y_1)\mapsto (x_1+\frac{1}{d^{\prime}}(x_2-x_1),y_1+\frac{1}{d^{\prime}}(y_2-y_1))$$

Finally, to move a distance $d$ along the line we multiply the change by $d$ to get

$$(x_1,y_1)\mapsto (x_1+\frac{d}{d^{\prime}}(x_2-x_1),y_1+\frac{d}{d^{\prime}}(y_2-y_1))$$

-

Consider a circle with radius $d$ and center $(x_1, y_1)$. This is the equation:

$$(x - x_1)^2 + (y - y_1)^2 = d^2$$

Let $m$ be the slope of the line from $(x_1, y_1)$ to $(x_2, y_2)$. ($m = \dfrac{y_2 - y_1}{x_2 - x_1}$). Our line must satisfy the equation:

$$y - y_1 = m(x - x_1)$$ $$y = m(x - x_1) + y_1$$

We want to find when these two will intersect, so substituting:

$$(x - x_1)^2 + (m(x - x_1) + y_1 - y_1)^2 = d^2$$ $$(x - x_1)^2 + m^2(x - x_1)^2 = d^2$$ $$(1 + m^2)(x - x_1)^2 = d^2$$ $$(x-x_1)^2 = \frac{d^2}{1+m^2}$$ $$x - x_1 = \pm \sqrt\frac{d^2}{1+m^2}$$ $$x = x_1 \pm \sqrt\frac{d^2}{1+m^2}$$

-