# Find a point $p_1$ on the line $l$ with distance d from the point $p_2$ on the same line

I have tried to find posts that are related to the question but they end up with the terms like ‘find a distance’. What I want is not to find the distance: I already have the distance, I want something else.

Assume $(x_1,y_1)$ and $(x_2,y_2)$ are points on the line $y=ax+b$ and the euclidean distance between the points is defined as $d=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$.

### Known:

point $(x_1,y_1)$
line $y=ax+b$
distance $d$

### Unknown:

point(s?) $(x_2,y_2)$

I want to know whether I am on the right path. Should I solve for the line and the distance formula to find $x_2,y_2$? Is this the right way? Is there any faster way of doing this?

• p.s, I used the online latex formula creator to display the distance formula but it did not work. A link to how-to do formulas on math.stackexchange is appreaciated. – Aaron Azhari Jun 2 '14 at 20:11

The vector that traverses parallel to the line is $(1,a)$. Normalize this vector by dividing by $\sqrt{1 + a^2}$ to get vector $v$ in the same direction that has length $1$. Then your desired point is $w \pm d\cdot v$ where $w$ is the original point and $d$ is the desired distance.

• does normalizing (1,a) means $(1/\sqrt{1+a^2},a/\sqrt{1+a^2})$ ? – Aaron Azhari Jun 2 '14 at 20:22
• and what do you mean by w being the point? Do you mean w as $(x1,y1)$ which becomes $(x1\pm d,y1\pm d)$ ? – Aaron Azhari Jun 2 '14 at 20:26
• Yes that's what I mean by normalizing. And $w = (x_1,y_1)$ and $v = (v_1,v_2)$ where $v_1 = 1/\sqrt{1+a^2}$ and $v_2 = a/\sqrt{1+a^2}$ and your desired point is $(x_1\pm dv_1,x_2 \pm dv_2)$. – user2566092 Jun 2 '14 at 20:31

The point(s) that you are looking for are the points at which the circle $$(x-x_1)^2+(y-y_1)^2=d^2$$ and the line $$y=ax+b$$ intersect. Therefore $$(x-x_1)^2+(ax+b-y_1)^2=d^2$$ which is a quadratic equation in $x$.

Let $(x_{1},x_{2})$ be a known point on the line

$y=ax+b$

Now you may denote any point on this line by

$(x,ax+b)$

If $d$ is the distance between the points then

$(x-x_{1})^{2}+(ax+b-x_{2})^{2}=d^{2}$

Hence, you have to solve a quadratic equation in x.