The parametric equations of the line passing through the points A and B are
x = -1 -2t
y = -4 + 4t
z = -t
Let us take a point Q on the line passing through A and B. For t = -1 we get Q ( 1, -8 ,1 )
Then vector QP = < 2, 5 , 2 > and || QP || = √ 22 + 52 + 22 =√29
The length of the projection of the vector QP on the vector AB is ( 2/3) √21
Therefore the distance d of the point P to the line AB using The Pythagorean Theorem is
d2 = ( √29 )2 − ( ( 2/3) √21 )2
d = √(59/3)