The solution for the 3-d case can be found here; I would like to get the generalized version.  There's no simple generalization of the Mathworld algorithm since the cross product is defined only for 3 and 7 dimensions, so I understand.
Distance from point to n-dimensional line
algorithms;measurement
If you use vector algebra (which is easy with a vector algebra library), there is no real difference between the 3-d case and the N-d case.  Unfortunately, the page you link to has written out the vector math element by element, which tends to obscure this.So, paraphrasing from the article:  given a line through two points A and B, the minimum distance d to a point P can be computed as:   n_vector pa = P - A   n_vector ba = B - A   double t = dot(pa, ba)/dot(ba, ba)   double d = length(pa - t * ba)Note that adding two n_vector's is just like adding a 3-vector, except you add N corresponding elements instead of 3 of them, and scaling an n_vector by scalar t is just like scaling a 3-vector except you scale N elements instead of 3.Evaluating the length() of an n_vector is only slightly more complicated:  you sum up the squares of all N elements (instead of just the 3), and take the sqrt() of the result.  Finally, as you may have guessed, the dot() product is the sum of the products of the N corresponding elements (again, instead of just the 3).