Derivation of The Margin
Derivation of The Margin
Problem Setup
We are given two parallel hyperplanes:
W · X − b = −1 (First hyperplane),
W · X − b = 1 (Second hyperplane).
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 .
W · X0 − b = −1.
W
X0 + r · .
∥W ∥
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 ∥
−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 .