TITLE: Given a point, slope and a distance along that slope, easily (?) find a second point.
QUESTION [13 upvotes]: I have a point  [x1,y1], a slope m of a line that passes through that point. I'd like to find either point [x,y] that is d distance away from that original point.
Work so far:
$$
y = m(x - x_1) + y_1
$$
$$
x = \frac{y + mx_1 - y_1}m
$$
And then (if my algebra is correct)
$$
d = \sqrt{ \left(\frac{y + mx_1 - y_1} m\right)^2 +y^2}
$$
$$
y^2 = d^2 - \left(\frac{y + mx_1 - y_1}{m}\right)\left(\frac{y + mx_1 - y_1}{m}\right)
$$
And then, if I plugged in some real numbers and struggled long enough, I suppose I could solve for y. And then solve for x. My first attempt ended in a few pages of poorly-remembered math and an incorrect answer.
My question is that this seems like a long slog. Is there an easier way?
More details: The general problem I'm trying to solve for a computer program is given a line segment find a point that is perpendicular and a fixed distance away from the mid-point.

REPLY [4 votes]: It might be simpler to work with vectors, here. You can rewrite as a vector equation $$\langle x,y\rangle = \langle x_1,y_1\rangle +t\langle 1,m\rangle,\tag{$\star$}$$ where $t$ is allowed to vary over all real numbers. Then the distance from $\langle x_1,y_1\rangle$ to a point $\langle x,y\rangle$ on the line is precisely the magnitude of the vector $$\langle x,y\rangle-\langle x_1,y_1\rangle=t\langle 1,m\rangle=\langle t,mt\rangle.$$ Hence, we need $$d=\sqrt{t^2+(mt)^2}=\sqrt{t^2(1+m^2)}=|t|\sqrt{1+m^2},$$ and so we need $$t=\pm\frac{d}{\sqrt{1+m^2}}.$$ Substituting these values of $t$ into $(\star),$ we find that the solutions are $$\left\langle x_1\pm\frac{d}{\sqrt{1+m^2}},y_1\pm\frac{dm}{\sqrt{1+m^2}}\right\rangle.$$
Added: Obviously, this doesn't work with vertical lines, but that's even easier, since only the $y$-value is changing.