Quant Memo
Core

Cubic Spline Interpolation

Building a smooth curve through a set of points by stitching together many small, gentle cubic pieces instead of one wild high-degree polynomial — the standard, well-behaved way to construct a full yield or volatility curve from sparse quotes.

Prerequisites: Polynomial Interpolation

Fitting a single high-degree polynomial through many market quotes causes wild oscillation between the points — the previous concept's warning. The fix used almost everywhere in practice, from yield curves to volatility surfaces, is to give up on one global polynomial and use many small, low-degree pieces stitched together so the seams are invisible: matching not just in value but in slope and curvature. That's a cubic spline, the default smooth-curve-through-points tool in quantitative finance.

An analogy: bending a flexible ruler through pins

Picture pinning a thin, flexible strip of plastic (a physical "spline," the tool's namesake) at each data point and letting it bend naturally between the pins under its own stiffness. The strip passes exactly through every pin, but between pins it takes the smoothest, least-curved path physics allows — no sudden kinks, no wild bulges, because a real flexible strip simply can't do that. A cubic spline is the mathematical version: a separate small cubic (degree-3) polynomial on each interval between adjacent data points, chosen so the whole assembled curve looks and behaves exactly like that bent flexible strip.

The math, one piece at a time

A cubic spline uses a different cubic polynomial Si(x)S_i(x) on each interval [xi,xi+1][x_i, x_{i+1}] between consecutive data points, of the general form

Si(x)=ai+bi(xxi)+ci(xxi)2+di(xxi)3.S_i(x) = a_i + b_i(x-x_i) + c_i(x-x_i)^2 + d_i(x-x_i)^3 .

In words: on each small piece, allow a cubic curve — flexible enough to bend and match both a slope and some curvature, but simple enough not to wildly overshoot the way a single global high-degree polynomial does. The coefficients ai,bi,ci,dia_i, b_i, c_i, d_i on every piece are then chosen to satisfy matching conditions at each interior point where two pieces meet: the pieces must agree in value (so there's no gap), agree in first derivative or slope (so there's no visible kink), and agree in second derivative or curvature (so there's no sudden change in how sharply the curve bends) — three separate smoothness conditions enforced at every seam. Solving for all the coefficients across every piece simultaneously, subject to these matching conditions plus a choice of boundary condition at the two outer ends (commonly "natural," setting curvature to zero at the very ends), reduces to solving one linear system — in practice a tridiagonal one, solvable efficiently.

The key practical property: cubic splines match a polynomial's smoothness locally but never need a high global degree, so they don't suffer from Runge's phenomenon — adding more data points adds more small, well-behaved pieces rather than raising one global polynomial's degree.

Worked example 1: matching conditions by hand, conceptually

Suppose two adjacent spline pieces meet at x=5x=5 (the 5-year point on a yield curve): the piece for [1,5][1,5] ends at x=5x=5 with value 4.0%, slope +0.15+0.15, and curvature 0.02-0.02. For the curve to be a genuine cubic spline, the piece for [5,10][5,10] must start at x=5x=5 with exactly the same three numbers. If the two pieces' slopes disagreed even slightly, the assembled curve would show a visible kink — a discontinuity that a genuine spline rules out by solving for all coefficients jointly.

seam at x=5 piece [1,5] piece [5,10]
Both pieces must agree in value, slope, and curvature exactly at the seam — three matching conditions enforced at every interior point, which is what makes the assembled curve look seamless.

Worked example 2: comparing to raw linear interpolation

Given yield points (1y, 3.0%), (5y, 4.0%), (10y, 4.5%), linear interpolation for the 3-year rate would just draw a straight line between the 1y and 5y points: 3.0+3151(4.03.0)=3.0+0.5=3.5%3.0 + \frac{3-1}{5-1}(4.0-3.0) = 3.0 + 0.5 = 3.5\%. A cubic spline through the same three points, because it also has to match slope and curvature at the 5-year seam using information from the 10-year point too, typically produces a slightly different estimate — often closer to how an experienced trader would eyeball a naturally curving rate curve, since it doesn't force an artificial straight-line kink exactly at each quoted maturity the way linear interpolation does.

linear: visible kinks at each point cubic spline: smooth through every point
Both curves pass exactly through the same four data points, but the cubic spline (solid) matches slope and curvature at each seam, producing a visibly smoother curve than piecewise-linear interpolation (dashed).

What this means in practice

Cubic splines are the default method for building a continuous yield curve or discount curve from a sparse set of quoted benchmark rates, for interpolating an implied volatility smile across strikes, and generally for any "smooth curve through market-observed points" task in quant finance. They're preferred over both raw linear interpolation (which has visible kinks, causing artifacts in derivatives computed from the curve, like forward rates) and single high-degree polynomials (which oscillate). The tradeoff for that smoothness is that a spline is a genuinely global construction — changing one input quote can, in principle, slightly perturb the curve everywhere, not just locally, since all the piece coefficients are solved jointly.

A cubic spline builds a smooth curve through data points using a separate small cubic polynomial on each interval, with matching value, slope, and curvature enforced at every seam — this gives smoothness comparable to a high-degree polynomial without that polynomial's tendency to oscillate wildly between the data points.

The classic mistake is assuming a cubic spline is purely a local construction — that changing or adding one data point only affects the curve nearby. Because natural (and most other) boundary conditions and the seam-matching conditions are solved as one linear system across all pieces simultaneously, a single new or corrected data point can, in principle, shift the fitted curve's shape at every other point too, even far away — usually only slightly, but not exactly zero. Don't assume a spline fit is "safe" to patch locally without re-solving the whole curve.

Related concepts

Practice in interviews

Further reading

  • de Boor, A Practical Guide to Splines
  • Press et al., Numerical Recipes, ch. 3
ShareTwitterLinkedIn