Question: I am having trouble calculating the quadratic curve $f(x)$ that goes through 3 points;
for example a curve that goes through $A(1,3), B(-1,-5), and C(-2,12)$.
I can only guess that the curve is upwards and that I may create the system:
$$
y\_1 = ax^2\_1 + bx\_1 + c\\
y\_2 = ax^2\_2 + bx\_2 + c\\
y\_3 = ax^2\_3 + bx\_3 + c
$$
assuming that the points are in the format $A(x,y)$ and from this point what do I do?
Do I build a matrix and use the Gaussian eliminations?

EDIT: I also know that $f(4) = 120$

Answer: 
The matrix you are about to build is a [Vandermonde Matrix](http://en.wikipedia.org/wiki/Vandermonde_matrix):
$$
\vec y = \pmatrix{1&x\_1&x\_1^2\\1&x\_2&x\_2^2\\1&x\_3&x\_3^2\\}\pmatrix{c\\b\\a}
$$

*A square Vandermonde matrix is thus invertible if and only if the $x\_i$ are distinct; an explicit formula for the inverse is known.[$^{\text[2]}$](http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19660023042.pdf "download me...")*
```
For the three points
P1=(x1,y1), 
P2=(x2,y2), 
P3=(x3,y3), 

use the coefficients a, b and c,

a = y1/(x1*x1 - x1*x2 - x1*x3 + x2*x3) + y2/(-x1*x2 + x1*x3 + x2*x2 - x2*x3) + y3/(x1*x2 - x1*x3 - x2*x3 + x3*x3)

b = - (x2*y1)/(x1*x1 - x1*x2 - x1*x3 + x2*x3) - (x3*y1)/(x1*x1 - x1*x2 - x1*x3 + x2*x3) - (x1*y2)/(-x1*x2 + x1*x3 + x2*x2 - x2*x3) - (x3*y2)/(-x1*x2 + x1*x3 + x2*x2 - x2*x3) - (x1*y3)/(x1*x2 - x1*x3 - x2*x3 + x3*x3) - (x2*y3)/(x1*x2 - x1*x3 - x2*x3 + x3*x3)

c = (x2*x3*y1)/(x1*x1 - x1*x2 - x1*x3 + x2*x3) + (x1*x3*y2)/(-x1*x2 + x1*x3 + x2*x2 - x2*x3) + (x1*x2*y3)/(x1*x2 - x1*x3 - x2*x3 + x3*x3)

for the polynomial
y = a*x² + b*x + c

```