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?

It comes from that fact that the difference operator $$\Delta f(n) = f(n+1)-f(n)$$ acting on polynomials $f(x)$ of degree $d$ will result in polynomials in degree $d-1$ (check this!) - the difference between $f(n)=1^2+2^2+\cdots+n^2$ and $f(n+1)=1^2+\cdots+(n+1)^2$ is simply $(n+1)^2$, which is a quadratic in $n$, hence we should expect $f$ to be cubic.

More rigorously, we can reason by induction, though this is might be too advanced for the OP to follow along. Suppose we have the antidifference $\Delta^{-1}n^p$ for exponents $p=0,1,\dots,k-1$ (there will be arbitrary additive constants, but these cancel when we put definite bounds on the implicit sum so we'll ignore them). Then note that $\Delta n^{k+1}$ can be expanded (via the Binomial theorem) into powers of $n$ from $l=0$ to $k$. If we subtract out all of the powers from $l=0$ to $l=k-1$ and put them side by side with $\Delta n^{k+1}$, then we have all terms we know the antidifference of on one side of an equation and $n^k$ on the other. Apply the antidifference and we now have a formula for $\Delta^{-1} n^k$.
