# Do splines preserve monotonicity?

Start with a monotone nonincreasing function and sample it at finite set of points $x_0, ..., x_n$, $x_i<x_{i+1}$ so that $f(x_i)<f(x_{i+1})$. If you approximate $f$ with a linear spline then the resulting piecewise-linear approximation will certainly preserve monotonicity.

The question is: if you approximate $f$ with natural cubic spline will monotonicity be preserved as well?

Not only is the answer "no", but for any number $N$ you can construct a monotone function and sample it such that the natural spline approximation will have $N$ extremum points.