Click to add points, code is here.

You can break it by choosing two points on the same vertical line, or picking too many points.

## How it works

Say you have points $(1,2), (3,2), (4,5)$ And say you want to find a quadratic which goes through these points.

This is the same as the system of equations

Expressed in linear algebra this becomes

Then you can use elimination to solve $Ax = b$, as I've done here.

## Efficiency

Elimination is $O(n^3)$, Realistically you should use $O(n^2)$ with Lagrange polynomials wiki, video. (also related to how $A$ is a Vandermonde matrix).

But I like the generality of elimination :D

There are also much more sophisticated techniques, like the Fast Fourier transform which (I think?) is $O(n \log n)$. I don't understand it yet though.

## General interpolation

Polynomial interpolation is cool, but useless in practice since high degree polynomials tend to extreme oscillations. There are other more attractive techniques like Fourier series. I recommended you read (or skim) Numerical Methods if you're interested (I've have lost sleep reading this book, it's that good).