Understanding the distance between a line and a point in 3D space

You have ignored completely the constraint $Q$ being a point on $L$. That imposes $b=3a$, for example, which your proposed $a=0,b=1$ does not satisfy.


You need to find the point $Q$ on $L$ minimizing the distance from $P$. Since $Q=(a,b,c)$ lies in $L$, $a,b,c$ must satisfy the relations $a=-2c$ and $b=-6c$. Further, $QP$ must be orthogonal to $L$, so $(a+6,b-3,c-3) \cdot (-2,-6,1)=0$.


Let $v = (-6,3,3), u = (-2,-6,1)$

$v - \frac {u\cdot v}{\|u\|^2} u$

Describes a vector from a the line defined by $(0,0,0) + ut$ to the point $v$ that is orthogonal to $u.$

$\|v - \frac {u\cdot v}{\|u\|^2} u\|$ will be your distance.

$\big(v - \frac {u\cdot v}{\|u\|^2} u\big)\cdot\big(v - \frac {u\cdot v}{\|u\|^2} u\big) = \|v\|^2 - \frac {(u\cdot v)^2}{\|u\|^2}$

Alternatively.

$d^2 = (-6+2t)^2 + (3+6t^2) + (3-t)^2\\ d^2 = 54 +6t +41t^2\\ d^2 = 41(t + \frac {3}{41})^2 - \frac {9}{41} + 54$

Distance is minimized when $t = -\frac {3}{41}$

and $d^2 = 54 - \frac 9{41}\\ d = \sqrt {54 - \frac 9{41}}$

It is worth noting that

$54 = (-6,3,3)\cdot(-6,3,3) = \|v\|^2\\ -3 = (-6,3,3)\cdot(-2,-6,1) = u\cdot v\\$

and $41 = (-2,-6,1)\cdot(-2,-6,1) = \|u\|^2$