### Calculate shortest distance between two lines

 Line passing through the point A(a1,b1,c1) parallel to the vector V1(p1,q1,r1)
 Please enter the values for point A : ,, Please enter the values for vector V1 : ,,
 Line passing through the point B(a2,b2,c2) parallel to the vector V2(p2,q2,r2)
 Please enter the values for point B : ,, Please enter the values for vector V2 : ,,

 Shortest distance between two lines(d)

We are considering the two line in space as line1 and line2. The line1 is passing though point A (a1,b1,c1) and parallel to vector V1 and The line2 is passing though point B(a2,b2,c2) and parallel to vector V2. We can find out the shortest distance between given two lines using following formulas: $$d=| \frac {( \overrightarrow{V_{\,1}} \times \overrightarrow{V_{\,2}}) \cdot \overrightarrow{P_{\,1} P_{\,2}}}{| \overrightarrow{V_{\,1}} \times \overrightarrow{ V_{\,2}} | } | , at | \overrightarrow{V_{\,1}} \times \overrightarrow{ V_{\,2}} | \neq {0}$$ $$=| \frac {( q_{\,1}r_{\,2} - q_{\,2}r_{\,1})a_{\,12} + (r_{\,1}p_{\,2} - r_{\,2}p_{\,1})b_{\,12} + (p_{\,1}q_{\,2} - p_{\,2}q_{\,1})c_{\,12} } { \sqrt{(q_{\,1}r_{\,2} - q_{\,2}r_{\,1})^{2}+(r_{\,1}p_{\,2} - r_{\,2}p_{\,1})^{2} + (p_{\,1}q_{\,2} - p_{\,2}q_{\,1})^{2} }} |$$ $$d=| \frac { \overrightarrow{V_{\,1}} \cdot \overrightarrow{P_{\,1} P_{\,2}}}{| \overrightarrow{V_{\,1}} | } | , at | \overrightarrow{V_{\,1}} \times \overrightarrow{ V_{\,2}} | = {0}$$ $$=|\frac{ \sqrt{ (b_{\,12}r_{\,1} - c_{\,12}q_{\,1})^{2} + (c_{\,12}p_{\,1} - a_{\,12}r_{\,1})^{2} + (a_{\,12}q_{\,1} - b_{\,12}p_{\,1})^{2} } } { \sqrt{ p_{\,1}^{2} + q_{\,1}^{2} + r_{\,1}^{2} } }|$$
where a12 = (a1 - a2), b12 = (b1 - b2) and c12 = (c1 - c2).