# Find point on a line a certain distance away from another point

I have a line defined by two points within the line, $$A(x_1, y_1, z_1)$$ and $$B(x_2, y_2, z_2)$$.

I have a third point $$P(x_3, y_3, z_3)$$.

How do I find the coordinates of the points on the line $$AB$$ which are $$d$$ units away from $$P$$ ?

• Find the perpendicular distance of $P$ from the line, then slide along it either way, through a distance you get from Pythagoras. – J.G. Dec 18 '18 at 23:28
• @J.G. how do I "slide along" it? – theonlygusti Dec 18 '18 at 23:28
• @RossMillikan I don't think that's a dupe. Looks like they asked for finding a point on the line. I have 3 points. 2 define a line, one is away from it. If it is a dupe, idk how to re-apply the answer from the other question to this one. – theonlygusti Dec 18 '18 at 23:46
• Sorry, I misread the question. i have reopened it. J.G.'s hint is a good one to make it a duplicate. If the distance from $P$ to the closest point on the line $Q$ is $p$, you want a point on the line that is $\sqrt {d^2-p^2}$ away from $p$. Now apply the other question – Ross Millikan Dec 18 '18 at 23:48
• Intersect the line with a sphere centered at $P$. – amd Dec 19 '18 at 0:14

If you write out $$\|A+\alpha(B-A)-P\|^2=d^2$$ you get a quadratic equation in $$\alpha$$. You can solve for $$\alpha$$ with standard methods.