There are two completely different ways to solve this problem:

1. Analytic: The distance between P and any point on the line must be a minimum to determine the distance between P and the line:

Re-write the equation of the line:

Now

Plug in this value into the equation of D(d). You'll get

2. Geometrically: Construct a plane which contains the point P(4,1,2) and is perpendicular to the given line:

Let F denote the point of intersection between this plane and the given line: Plug in the term of the line instead of and solve for d:

Now calculate the coordinates of F. Afterwards calculate the distance between the given point P and F: That's the distance between the line and the given point.