Here is an elementary geometric derivation of the formula:
Any (st.)line perpendicular to the line $$Ax+By+C=0\qquad\text{(1)}$$ is given by $$Bx-Ay+C'=0\qquad\text{(2)}$$ Since (2) has to pass through the point $(x_1,y_1)$ (WHY?), we have $C'=Ay_1-Bx_1$. So, (2) becomes $$Bx-Ay+Ay_1-Bx_1=0\Rightarrow \frac{x-x_1}{A}=\frac{y-y_1}{B}=t\text{ (say)}\qquad(3)$$ From (3), $x=At+x_1$ and $y=Bt+y_1$. This is (called) the parametric equation of the line (2). Each $t$ correspond a point in it and vice-verse. Our next task is to determine the value of $t$ such that (1) and (2) meet at that point. To do so, substituting the value of $x$ and $y$ in (1), we get $t=-\frac{Ax_1+By_1+C}{A^2+B^2}$. Hence the required distance is $$\sqrt{(x-x_1)^2+(y-y_1)^2}=\sqrt{A^2t^2+B^2t^2}=|t|\sqrt{A^2+B^2}=\frac{|Ax_1+By_1+C|}{\sqrt{A^2+B^2}}.$$
For a parametric equation of a line $(x,y,z) = (x_0, y_0, z_0) + (a,b,c)s$, the line itself is the set of all points $P(x,y,z)$ such that $x = x_0 + as$, $y = y_0 + bs$, and $z = z_0 + cs$. When $s = 1$, this gives you one point $A$; when $s = 2$, this gives you another point $B$; and when you take all values of $s \in \mathbb{R}$, you get the entire line.
Notice that if instead you had $(x,y,z) = (x_0, y_0, z_0) + (a,b,c)s/2$, you'd still have the same line, except this time, $s$ has to be $2$ to give you point $A$, $s = 4$ gives you point $B$, etc. So when you're trying to find the value of $s$ for any one point, you can just choose any $s$ that you want!
So if $(2,1,1) = (a,b,c)s$, choose any $s$ you want and solve it for $a$, $b$, and $c$.
(By the way, there are two points on the line $(1,2,0) + (2,-1,2)t$ that are $3$ units away from $(1,2,0)$. You found one when you set $t = 1$; what if you set $t = -1$?)
Best Answer
Find the circle with radius $5$ and center $(1,7)$ and then find the lines passing through the origin and which is a tangent to the circle by using the formula $y = mx+r\cdot\sqrt{m^2+ 1}$ and as it passes through tho origin $r.\sqrt{m^2+1}=0$ so your line now becomes $y=mx$ if distance of this line from $(1,7)$ is $5$, then you get a quadratic in $m$.
Solving this you can find out the values of $m$ and substituting in the line equation, we get the required equation.