2
Derivation of the Margin ∥W ∥
Problem Setup
We are given two parallel hyperplanes:
W · X − b = −1 (First hyperplane),
W · X − b = 1 (Second hyperplane).
Here: - W = (w1 , w2 , . . . , wn ) is the normal vector, which is perpendicular to both
hyperplanes. - b is the bias term. - X = (x1 , x2 , . . . , xn ) represents points on the hyper-
planes.
Our goal is to compute the perpendicular distance (or margin) between these two
hyperplanes.
Perpendicular Distance
To compute the perpendicular distance between the hyperplanes, the following steps are
followed:
Normal Vector W
The vector W defines the orientation of the hyperplanes and is perpendicular to the
surfaces of both hyperplanes. The unit normal vector is given by:
W
,
∥W ∥
p
where ∥W ∥ = w12 + w22 + · · · + wn2 is the magnitude of W .
Point on the First Hyperplane
Let X0 be a point on the first hyperplane W · X − b = −1, so:
W · X0 − b = −1.
Moving Perpendicularly to the Second Hyperplane
To compute the distance to the second hyperplane, move along the direction of the unit
W
normal vector ∥W ∥
by a distance r. The new point becomes:
W
X0 + r · .
∥W ∥
This point lies on the second hyperplane W · X − b = 1.
1
Substitute into the Second Hyperplane Equation
W
Substitute X0 + r · ∥W ∥
into the equation of the second hyperplane:
W
W · X0 + r · − b = 1.
∥W ∥
Expand this equation:
W
W · X0 + r · W · − b = 1,
∥W ∥
∥W ∥2
W · X0 + r · − b = 1,
∥W ∥
W · X0 + r · ∥W ∥ − b = 1.
Use the First Hyperplane Equation
From the first hyperplane equation W · X0 − b = −1, substitute W · X0 − b = −1 into
the equation:
−1 + r · ∥W ∥ = 1.
Solve for r:
r · ∥W ∥ = 2,
2
r= .
∥W ∥
Conclusion
The perpendicular distance (or margin) between the two hyperplanes is:
2
r= .
∥W ∥
This shows that the margin depends inversely on the norm of the normal vector ∥W ∥.
Geometric Interpretation
- The hyperplanes are separated by the shortest distance along the direction of the normal
vector W . - The goal of SVM is to maximize the margin ∥W2 ∥ , which is equivalent to
minimizing ∥W ∥2 .