# Find coordinates of third point in the straight line

I can't figure out how to calculate next point on stretch (straight line). I mean, I have points $P_1$ and $P_2$ in one straight line. I need to find the next point ($P_3$) in this line where $P_3$ is in distance $h$ from point $P_2$ ($P_3$ is not between $P_1$ and $P_2$). Also distance from $P_1$ to $P_2$ is known as $r$ So far I was trying to use these expressions:

$h = \sqrt{(x_3-x_2)^2 +(y_3-y_2)^2}$ - distance from $P_3$ to$P_2$

$(h+r) = \sqrt{(x_3-x_1)^2 +(y_3-y_1)^2}$ - distance from $P_3$ to $P_1$

at the beginning I'm solving for $x_3$ in both expressions:

$x_3 = \sqrt{(r+h)^2-(y_3-y_1)^2} +x_1 \hspace{10cm}(1)$

and

$x_3 = \sqrt{h^2-(y_3-y_2)^2} + x_2\hspace{11cm}(2)$

Left side in both equations is $x_3$, so:

$\sqrt{(r+h)^2-(y_3-y_1)^2} +x_1 = \sqrt{h^2-(y_3-y_2)^2}+ x_2$

and that's where I need your help - I tried to solve for $y_3$:

$y3 = (r^2+2\cdot r\cdot h+x_1^2-y_1^2-x_2^2+y_2^2)/(2(y_2-y_1))$

but calculated result is incorrect. Also tried to use wolfram, but result is... https://www.wolframalpha.com/input/?i=sqrt((r%2Bh)%5E2-(y_3-y_1)%5E2)+%2Bx_1+%3D+sqrt(h%5E2-(y_3-y_2)%5E2)%2B+x_2+solve+for+y_3

Did I made a mistake somewhere? Or I should use other methods to solve it?

There is test data:

$P_1(0;0)$
$P_2 (24;8)$
$h = 50$
$r = 25$

• I find it very difficult to follow your post. If you have $(x_1, y_1), \;(x_2, y_2)$, you can determine the equation of the line passing through all three points. That, along with the distance equations you have, should define the coordinates of $(x_3, y_3)$ – Namaste Oct 22 '16 at 20:33

The line can be parameterized by $\mathbf{x}(t) = (x_1 + t(x_2 - x_1),y_1 + t(y_2 - y_1))$ for all $t\in\mathbb{R}$. Since point $P_3 = (x_3,y_3)$ is on this line, there exists a $t$ such that $\mathbf{x}(t) = (x_3,y_3)$. Assuming the point $P_3$ comes after the point $P_2$ on the line, we can solve for $t$ by observing that the distance from $P_1$ to $P_3$ is
$$r + h = \sqrt{(x_3 - x_1)^2 + (y_3 - y_1)^2} = |t|\sqrt{(x_2-x_1)^2 + (y_2 - y_1)^2}$$
$$t = \frac{r + h}{\sqrt{(x_2-x_1)^2 + (y_2 - y_1)^2}}$$
Plugging this value of $t$ into $\mathbf{x}(t)$ will give you the coordinates of $P_3$.