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 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 , as I've done here.
Efficiency
Elimination is , Realistically you should use with Lagrange polynomials wiki, video. (also related to how 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 . 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).