Goal of Support Vector Machines (SVM) and How to Compute the Margin

Goal of Support Vector Machines (SVM) and How to Compute the Margin

Verified Sources
Nov 3, 2026

Support Vector Machines (SVMs) are designed to find a decision hyperplane that separates classes with the largest possible margin—i.e., it maximizes the minimum distance from the hyperplane to the closest training points (the support vectors). This “maximal margin” viewpoint is explicitly formalized by defining the geometric margin as the distance from the separating hyperplane to the nearest points, and then choosing the hyperplane that makes this distance as large as possible.

A key practical reason for this goal is that SVMs can be posed as a convex optimization problem that minimizes the norm of the weight vector under constraints, and that corresponds to maximizing the margin (after a suitable scaling choice).2

Footnotes

  1. [A Geometric Approach to Support Vector Machine (SVM) classification] https://math.pku.edu.cn/teachers/ganr/course/pr/paper/A%20geometric%20approach%20to%20Support%20Vector%20Machine%20(SVM)%20classification.pdf - Defines geometric margin and maximal-margin hyperplane. ↩

  2. [Support Vector Machines (SVM) - lecture note PDF] https://www.cs.cornell.edu/courses/cs4780/2018fa/lectures/lecturenote09.html - Presents hard-margin constraints and tight constraints defining support vectors. ↩

  3. [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf - Derives distance to the hyperplane and shows margin equals 1/∥w∥1/\|w\|. ↩

SVM Margin Intuition (Geometric Margin)

Core goal (hard-margin SVM)

Assume binary classification with labels yi∈{−1,+1}y_i\in\{-1,+1\} and linear decision function f(x)=w⊤x+bf(x)=w^\top x+b, so the separating hyperplane is w⊤x+b=0w^\top x+b=0. For linearly separable data, SVM seeks the hyperplane that maximizes the margin while correctly classifying all points. This is commonly written as the constrained optimization: [ \min_{w,b}\ \frac{1}{2}|w|^2 \quad\text{s.t.}\quad y_i(w^\top x_i+b)\ge 1\ \ \forall i ] which is equivalent to maximizing the geometric margin because of the scaling relationship between the canonical constraints and Euclidean distances.2

Keywords to remember: hyperplane , margin , canonical form , support vectors.

Footnotes

  1. [Support Vector Machines (SVM) - lecture note PDF] https://www.cs.cornell.edu/courses/cs4780/2018fa/lectures/lecturenote09.html - Presents hard-margin constraints and tight constraints defining support vectors. ↩

  2. [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf - Derives distance to the hyperplane and shows margin equals 1/∥w∥1/\|w\|. ↩

Compute the SVM margin (hard-margin, linear case)

  1. 1
    Step 1

    Use the canonical scaling yi(w⊤xi+b)≥1y_i(w^\top x_i+b)\ge 1 for all training points; support vectors satisfy yi(w⊤xi+b)=1y_i(w^\top x_i+b)=1.

    Footnotes

    1. [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf - Derives distance to the hyperplane and shows margin equals 1/∥w∥1/\|w\|. ↩

  2. 2
    Step 2

    For any point x0x_0, the orthogonal distance to the hyperplane H:{x:w⊤x+b=0}H:\{x: w^\top x + b = 0\} is d(x0,H)=∣w⊤x0+b∣∥w∥d(x_0,H)=\frac{|w^\top x_0+b|}{\|w\|}.

    Footnotes

    1. [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf - Derives distance to the hyperplane and shows margin equals 1/∥w∥1/\|w\|. ↩

  3. 3
    Step 3

    For a support vector xix_i, we have ∣w⊤xi+b∣=1|w^\top x_i+b|=1, so its distance is d(xi,H)=1∥w∥.d(x_i,H)=\frac{1}{\|w\|}.

    Footnotes

    1. [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf - Derives distance to the hyperplane and shows margin equals 1/∥w∥1/\|w\|. ↩

  4. 4
    Step 4

    The geometric margin is the minimum such distance, so the margin is ρ=1∥w∥\rho=\frac{1}{\|w\|} for the hard-margin linear SVM.

    Footnotes

    1. [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf - Derives distance to the hyperplane and shows margin equals 1/∥w∥1/\|w\|. ↩

Margin width between the two delimiting hyperplanes

In the canonical hard-margin setup, the two class boundary planes are:

  • w⊤x+b=+1w^\top x+b=+1 for the positive class side
  • w⊤x+b=−1w^\top x+b=-1 for the negative class side

For points satisfying the canonical equalities, the distance from the decision hyperplane w⊤x+b=0w^\top x+b=0 to either delimiting hyperplane is 1/∥w∥1/\|w\|, so the total gap (“width”) between them is: [ \text{width}=\frac{2}{|w|} ] and the margin (to the closest side) is the half-width: [ \rho=\frac{1}{|w|} ] This relationship is derived directly from the canonical hyperplane normalization.

Keywords to remember: decision hyperplane , delimiting hyperplanes , width , norm.

Footnotes

  1. [Support Vector Machines guide - inovex] https://www.inovex.de/de/blog/support-vector-machines-guide - Shows width between delimiting hyperplanes equals 2/∥w∥2/\|w\| and distance to decision boundary equals 1/∥w∥1/\|w\|. ↩

type="tip" title="Pro Tip: Why the constraint uses “1”" content="SVM hyperplanes are invariant to scaling of (w,b)(w,b). The choice yi(wTxi+b)≥1y_i(w^T x_i+b)\ge 1 is a normalization that makes the geometric margin directly equal to 1/∥w∥1/\|w\| when equality holds for support vectors."

Footnotes

  1. [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf - Derives distance to the hyperplane and shows margin equals 1/∥w∥1/\|w\|. ↩

Soft-margin note: margin vs. violations

When data are not perfectly separable, SVM uses slack variables ξi≥0\xi_i\ge 0 and constraints: [ y_i(w^\top x_i+b)\ge 1-\xi_i ] Here, points can violate the margin region; ξi\xi_i measures the degree of violation. The “geometric margin” of the classifier is still tied to ww (via the same distance expression), but the training objective now trades off maximizing margin (through ∥w∥2\|w\|^2) against allowing violations (through slack penalties).

Keywords to remember: slack variable , soft margin , trade-off parameter , hinge loss.

^*: Derived from the standard soft-margin optimization formulation described in the provided sources (slack variables allow violations of canonical margin constraints, controlled by CC). See also: [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf.

Footnotes

  1. [Support Vector Machines (SVMs) pdf] https://www.cs.cornell.edu/courses/cs4780/2018fa/lectures/lecturenote09.html - Introduces hard-margin tight constraints and provides the hard-margin framework used before soft-margin extension in lecture materials. ↩

type="warning" title="Warning: Margin formula depends on scaling!" content="The clean formula ρ=1/∥w∥\rho=1/\|w\| assumes the canonical scaling where support vectors satisfy ∣wTxi+b∣=1|w^T x_i + b|=1. If you rescale (w,b)(w,b) without enforcing this normalization, the numeric “1” changes and you must recompute the distance-to-hyperplane using d(x,H)=∣wTx+b∣∥w∥d(x,H)=\frac{|w^T x+b|}{\|w\|}. "

Footnotes

  1. [Support Vector Machines (SVMs) pdf] https://www.stat.cmu.edu/~larry/=sml/SVM.pdf - Derives distance to the hyperplane and shows margin equals 1/∥w∥1/\|w\|. ↩

From Goal to Margin Computation in SVM

Geometric distance

1) Define margin

Margin is the minimum orthogonal distance from points to the separating hyperplane."

Canonical scaling

2) Normalize constraints

Use yi(wTxi+b)≥1y_i(w^T x_i+b)\ge 1 so support vectors satisfy equality."

Maximize margin ↔ minimize $\|w\|^2$

3) Optimize

Hard-margin SVM minimizes 12∥w∥2\tfrac12\|w\|^2 under margin constraints."

Margin equals $1/\|w\|$

4) Compute margin

Use distance formula: d(x,H)=∣wTx+b∣/∥w∥d(x,H)=|w^T x+b|/\|w\| and ∣wTxi+b∣=1|w^T x_i+b|=1."

Relationship between ∥w∥\|w\| and margin

As ∥w∥\|w\| increases, the margin ρ=1/∥w∥\rho=1/\|w\| decreases (hard-margin linear SVM).

Frequently Asked Technical Points

Knowledge Check

Question 1 of 4
Q1Single choice

In hard-margin linear SVM, what is the geometric margin ρ\rho (when using canonical constraints yi(wTxi+b)≥1y_i(w^T x_i+b)\ge 1)?