Formula for $1^2+2^2+3^2+...+n^2$ In example to get formula for $1^2+2^2+3^2+...+n^2$ they express $f(n)$ as:
$$f(n)=an^3+bn^2+cn+d$$ also known that $f(0)=0$, $f(1)=1$, $f(2)=5$ and $f(3)=14$
Then this values are inserted into function, we get system of equations solve them and get a,b,c,d coefficients and we get that $$f(n)=\frac{n}{6}(2n+1)(n+1)$$
Then it's proven with mathematical induction that it's true for any n.
And question is, why they take 4 coefficients at the beginning, why not $f(n)=an^2+bn+c$ or even more? How they know that 4 will be enough to get correct formula?

As the comments indicate, there are many possibilities. One first assumes that it's a polynomial (perhaps for no good reason, you know?). One might consider that the polynomial grows asymptotically like a cubic from the integral. 
Or one might repeatedly apply the difference operator. For example, the first few values are 0, 1, 5, 14, 30, 55... Then the first set of differences is 1, 4, 9, 16, 25... The second set of differences is 3, 5, 7, 9... The third set of differences is 2, 2, 2, 2, 2...
Thus we suspect a cubic polynomial will do.
