The question is a carry on from this question. I don't understand how the math works out that the minimum distances of the points on a line to the origin is the same as the length of the perpendicular line. Moreover, it is not clear why normalizing the vector would give the length of that perpendicular line.


2 Answers 2


This is really two questions in one.

As regards the first question, it’s a basic geometric fact that the shortest distance from a point to a hyperplane (line in 2-D, plane in 3-D, &c) is along the perpendicular to the hyperplane. You can prove it to yourself by using calculus to minimize the distance between the fixed point and a point on the hyperplane, but it’s easier to use basic trigonometry:

enter image description here

If $d_\perp$ is the perpendicular distance from the origin to the pictured line, then the distance $d$ measured along a line that makes an angle $\theta$ with the perpendicular is $d={d_\perp\over\cos\theta}$, which is obviously minimized when $\cos\theta$ is maximized, i.e., when $\theta=0$. This holds in any number of dimensions.

As for the second part, one form of the equation for a hyperplane is $$\mathbf n\cdot\mathbf x=-d\tag{1}$$ where $\mathbf n$ is a vector (not necessarily of unit length) normal to the hyperplane. From above, we know that $\mathbf x$ will have minimal length when it is parallel to $\mathbf n$, i.e., when $\mathbf x=\lambda\mathbf n$ for some scalar $\lambda$. If we normalize $\mathbf n$ to get a unit vector, this scalar will be equal to the (signed) distance of the hyperplane to the origin. Substituting this back into the equation of the line: $$\mathbf n\cdot\lambda{\mathbf n\over\|\mathbf n\|}=\lambda{\mathbf n\cdot\mathbf n\over\|\mathbf n\|}=\lambda\|\mathbf n\|=-d$$ therefore $\lambda={-d\over\|\mathbf n\|}$. Equation (1) tells us that the dot product of $\mathbf n$ with any point on the hyperplane is equal to the constant value $-d$, so the distance of the hyperplane to the origin is ${\mathbf n\cdot\mathbf x\over\|\mathbf n\|}$, where $\mathbf x$ is any point that satisfies (1). Of course, $\mathbf n\cdot\mathbf x$ can also be expressed as $\mathbf n^T\mathbf x$, and if we set $\mathbf n=(w_1,w_2,w_3)^T$, we have your boundary equation (with $d=w_0$) and distance formula from the preceding question.

Observe that ${\mathbf n\over\|\mathbf n\|}\cdot\mathbf x=\|\mathbf x\|\cos\theta$, where $\theta$ is again the angle between the normal and $\mathbf x$, so this quantity can be understood to be the length of the projection of the vector from the origin to any point on the hyperplane onto the hyperplane’s normal, which is again simply $\|\mathbf x\|$ when $\theta=0$, i.e., the perpendicular distance to the hyperplane.

  • $\begingroup$ P.S.: One can instead derive the distance formula directly from the first part by using $\mathbf v_\perp\cdot\mathbf x=d_\perp\|\mathbf x\|\cos\theta=d_\perp^2$, where $\mathbf v_\perp$ is the min. distance vector, and then noting that you can replace it by any normal vector $\mathbf n$, with a change of sign as appropriate. This also gives you a derivation of equation (1). $\endgroup$
    – amd
    Commented Oct 11, 2016 at 7:54
  • $\begingroup$ This is lecture status answer. Thank you for the very informative answer. $\endgroup$
    – Jonathan
    Commented Oct 11, 2016 at 17:37

You can convert it into a calculus minimization problem. The external point is fixed and denote it as $(a,b)$. A variable point on the line denote it as $(x,mx+c)$ (assuming the line is not $x$-axis.). Now minimize the distance between these two points. For the minimum point $(x_0, mx_0+c)$ calculated using one-variable calculus, find the slope of the line joining this with $(a,b)$. It will be $-1/m$.

Now for intuition. Assume you are in a vast agricultural field. You see cars going on a highway (assumed to be a straightline) far from where you are standing. You want to go to the highway and get a lift. Which point of the highway should you walk towards?


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .