The maximum-margin classifier: hard and soft margin SVMs, support vectors, hinge loss and the role of C, and the kernel trick for non-linear boundaries; GATE asks for margins, distances, hinge losses and kernel values.
The SVM is a convex quadratic program; the dual uses Lagrange multipliers.
Concept notes
1. Margin and the hard-margin SVM
For labels , a linear classifier predicts . The distance of a point from the hyperplane is
Many hyperplanes may separate the data. The SVM picks the one with the largest margin, the gap to the nearest points. Scale so that the nearest points satisfy . Then the two margin hyperplanes are , and the margin width is
Maximising is the same as minimising , so the hard-margin primal is
This is a convex quadratic program with a unique optimal .
It has a solution only if the data are linearly separable.
The quantity is the functional margin of point ; it is positive when the point is correctly classified.
Maximum-margin hyperplane: the margin hyperplanes pass through the support vectors
2. Support vectors and the dual
Using Lagrange multipliers , the optimal weights are
The dual problem is
By complementary slackness, only for points with , the points on the margin. These are the support vectors.
Consequences:
The solution depends only on the support vectors. Deleting or moving any other point (without crossing the margin) does not change or .
is found from any support vector: .
The data enter the dual only through dot products . This is what makes the kernel trick possible.
Prediction is , a sum over support vectors only.
For two points of opposite classes, the maximum-margin boundary is the perpendicular bisector of the segment joining them, and the margin equals the distance between them.
3. Soft margin, slack and hinge loss
Real data are rarely separable. The soft-margin SVM allows violations with slack variables :
: on or outside the correct margin. : inside the margin but correctly classified. : misclassified.
At the optimum , the hinge loss, with . So the SVM minimises
In the dual, the only change is (box constraint).
The role of C:
Large
Small
Penalty on violations
heavy
light
Margin
narrow
wide
Behaviour
close to hard margin; fits training data, may overfit
more errors allowed, smoother, may underfit
Bias / variance
low bias, high variance
high bias, low variance
As the soft-margin SVM becomes the hard-margin SVM (on separable data). Points with have zero hinge loss and do not affect the solution.
4. The kernel trick
To get a non-linear boundary, map to features and run a linear SVM there. Since the dual and the prediction use only dot products, replace by a kernel , computed without ever forming .
Common kernels:
Linear: .
Polynomial: . For , with .
RBF (Gaussian): . Its feature space is infinite-dimensional; and .
A function is a valid kernel (Mercer's condition) when every Gram matrix is symmetric positive semidefinite. Sums, positive multiples and products of valid kernels are valid.
For RBF, large makes each support vector's influence very local, giving wiggly boundaries (overfitting); small gives smoother boundaries. Choose and by cross-validation.
Multiclass SVMs use one-vs-rest or one-vs-one combinations of binary SVMs. Feature scaling matters, as with any distance- or dot-product-based method.
Formulas to remember
Distance to the hyperplane
Margin width
Hard-margin primal
Weights from the dual
Hinge loss,
Polynomial kernel
RBF kernel
Common mistakes
Writing the margin as ; the full width between the margin hyperplanes is (each side is ).
Using labels 0 and 1 in hinge-loss or margin formulas; SVMs use .
Reversing the role of C: large C means a narrower margin and less tolerance for errors, not more.
Thinking every training point affects the SVM; only support vectors (points on or inside the margin) do.
Forgetting that a kernel must give a positive semidefinite Gram matrix; not every similarity function is a valid kernel.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Maximum margin for two points
numerical
Training set: with label and with label . Find the hard-margin SVM , and the margin.
Step 1: Guess the shape of $w$.
Try it on paper first.
Example 2: Hinge loss of a given classifier
numerical
(, ). Points: label ; label ; label ; label . Find each hinge loss and the total.
Step 1: Compute $y f(x)$ for each point.
Try it on paper first.
Example 3: Checking a polynomial kernel
numerical
For with , , compute directly and through .
Step 1: Use the kernel.
Try it on paper first.
Example 4: What does C do?
conceptual
An RBF-kernel SVM gets 100% training accuracy but poor validation accuracy with . What should you change, and why?
Step 1: Diagnose.
Try it on paper first.
Previous year questions
2 official GATE DA questions on this topic, newest first.
10 questions: up to 2 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.
Mark as mastered
Loading your progress…
My revision notes
Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.