Let Pick two random point on the line say t=0 and t=1 (can be anything really) So let A=(1,-1,2) and B=(3,-1,-1) Then and
The vector projection of v onto u is defined as
In our case the u is AB vector (2.0.-3) and the v is AX (1.2.1). The red line represents the projection but we are interested in the dotted line. Let the point of interesesction between the dotted line and the red line be C. Then by vector addition:
So plugging in the values for the projection: whatever that is. Now we know what AC vector is and what AX vector is so we can find CX vector. From there take the magnitude of this vector and you have found your perpendicular distance.