Instead of solving a system of equations, you can Lagrange interpolation, since we know that the sum of quadratic polynomials is itself a quadratic polynomial. The strategy is to express the solution as a sum of three polynomials:
- $p_1(x)$ which passes through $(-1,2)$ and has roots at $0$ and $1$.
- $p_2(x)$ which passes through $(0,1)$ and has roots at $-1$ and $1$.
- $p_3(x)$ which passes through $(1,-4)$ and has roots at $-1$ and $0$.
In each line, the roots are at the $x$ coordinates of the two points we're not hitting. So when we add all three partial solutions, $p_1+p_2+p_3$ will pass through all three points.
For $p_1$, we start by constructing a quadratic with roots at $0$ and $1$ and then scale it such that it has the right value at $-1$. To get roots at $0$ and $1$ we just multiply $x-0$ and $x-1$ to get $x^2-x$. The value of $x^2-x$ at $x=-1$ is $2$, so we don't even need to scale it: $p_1(x)= x^2-x$.
For $p_2$, start by multiplying $x-(-1)$ and $x-1$ to get $x^2-1$. Its value at $0$ is $-1$, so we need to scale by $-1$ to get $p_2(0)=1$. Therefore $p_2(x)=-x^2+1$.
For $p_3$, multiply $x-(-1)$ and $x-0$ to get $x^2+x$. The value at $1$ is $2$, so we scale by $\frac{-4}{2}=-2$ and get $p_3(x)=-2x^2-2x$.
Now add them all together.