Lab 2 — Question 2

We found this question quite challenging in my group, so after having managed to prove it, I will display said proof here.

The question was as follows:

\begin{indisplay}\begin{split}
&\textrm{The classification boundary of a percept...
...by} \\
&\frac{b}{\left\lVert\mathbf{w}\right\rVert }
\end{split}\end{indisplay} (9)

Firstly, it is worth noting that the expression given for the boundary, is a simple euclidean form line equation, represented using vectors. $\mathbf{w}$ is a vector containing the coefficients of the equation, and $\mathbf{x}$ contains the variables of the equation.

Let us suppose, that this is a simple $y=mx+c$ form equation, if this is to be the case then we must define the following for $\mathbf{w}$ and $\mathbf{x}$.

$\displaystyle \mathbf{w}=\left(\begin{matrix}w_0 \\ w_1\end{matrix}\right),
\mathbf{x}=\left(\begin{matrix}x \\ y\end{matrix}\right)$ (10)

We can then see that,

\begin{indisplay}\begin{split}
\mathbf{w}^T\mathbf{x}+b=0 &\to \left(\begin{matr...
... -w_0x-b \\
&\to y = -\frac{w_0}{w_1}x-\frac{b}{w_1}
\end{split}\end{indisplay} (11)

This is now in a more obvious form of the euclidean line equation ( $m=-\frac{w_0}{w_1}$, $c=-\frac{b}{w_1}$), a form we can work with much more easily.

The aim of the question is to find the shortest distance between this line, and the origin $(0, 0)$. This can be found by finding the perpendicular line which passes through both our boundary, and the origin, then finding the point where this perpendicular line intercepts the boundary, and then finding the distance of that point from the origin, which will simply be the euclidean norm: $\sqrt{x^2+y^2}$.

It is known that for a line $y=mx+c$, a perpendicular line passing through said line would be of the form $y=-\frac{1}{m}x+c_1$. Remember that $c$ indicates the point at which a line passes through the y-axis (the y-intercept), and $m$ is the gradient of the line.

Given this knowledge, we can see that the line perpendicular to our boundary must have a gradient of $\frac{w_1}{w_0}$, i.e. $m=\frac{w_1}{w_0}$.

$\displaystyle y_p=\frac{w_1}{w_0}x+c$ (12)

Note that I am using $y_p$ to refer to perpendicular line, this is not a commonly used notation (to my knowledge), just something I like to do to make my work a little clearer.

Now we must find $c$, the y-intercept. Remember that this line must pass through the origin, so at some point along it, we will have $y=0$, and $x=0$, so let us substitute these values, and solve for $c$:

$\displaystyle 0=\frac{w_1}{w_0}(0)+c \to c=0$ (13)

We have $c$. Note that $c=0$ is commonplace when a line must pass through the origin, since it intercepts the y-axis at $y=0$.

Given what we have found, we can now see that the perpendicular line to our boundary which passes through the origin has the euclidean form:

$\displaystyle y=\frac{w_1}{w_0}x$ (14)

The next step, is to find the point where this line intercepts our boundary line, and for this, we will approach the problem with simultaneous equations.

When the lines intercept, they will have the same values of $x$ and $y$, so we can begin by simply setting them equal to each other (since they are equal at the point of intercept!), and solving for $x$. We solve for $x$, since this will give us the $x$ ordinate of their intercept point. We can then substitute that value back into one of the original line equations to find the $y$ ordinate.

\begin{indisplay}\begin{split}
\frac{w_1}{w_0}x &= -\frac{w_0}{w_1}x-\frac{b}{w_...
..._1^2} & \frac{-bw_1}{w_0^2+w_1^2}
\end{matrix}\right)
\end{split}\end{indisplay} (15)

And now, for the cool bit. If you thought the rest of this was cool, the coolest bit is yet to come.

You might be thinking, `But Nathan, how does this coalesce into the answer¿, just you wait... just you wait. This final bit is one of those moments that made me actually gasp in excitement when I saw it. Because the equation itself looks very scary, but its such an elegant simplification.

We now calculate $\left\lVert I\right\rVert $, the euclidean norm of our intercept point $I$.

\begin{indisplay}
% latex2html id marker 637
\begin{split}
\left\lVert I\right\r...
...rVert &= \frac{b}{\left\lVert\mathbf{w}\right\rVert }
\end{split}\end{indisplay} (16)

And we have our answer! So cool.