Source: https://web.stanford.edu/class/math114/lecture_notes/splines.pdf