4. Determine the polynomial $P(x)$ if it is of the fourth degree, $P(0)=0$ and $P(x)-P(x-1)=x^{3}$, for any real number $x$. Using the obtained result, calculate the sum $1^{3}+2^{3}+\cdots+n^{3}$.
Solution. If in the functional equation $P(x)-P(x-1)=x^{3}$ we substitute $x=0$, we get $P(0)-P(-1)=0$ and since $P(0)=0$, we have $P(-1)=0$. Thus, $x=-1$ is a zero of the polynomial. The polynomial is of the fourth degree, so according to this

$$
P(x)=x(x+1)\left(a x^{2}+b x+c\right)
$$

We get

$$
x(x+1)\left(a x^{2}+b x+c\right)-(x-1) x\left(a(x-1)^{2}+b(x-1)+c\right)=x^{3}
$$

or

$$
x^{2}(4 a-1)+x(3 a-3 b)+2 c+a-b=0
$$

The polynomial on the left side of the last equation is zero if and only if

$$
\left\{\begin{array}{l}
4 a-1=0 \\
3 a-3 b=0 \\
2 c+a-b=0
\end{array}\right.
$$

The solution to the system is $c=0, a=b=\frac{1}{4}$. Thus, the desired polynomial is

$$
P(x)=\frac{1}{4} x^{2}(x+1)^{2}
$$

If in the functional equation we sequentially substitute $x=1,2,3, \ldots, n$, then we obtain the sequence of equations

$$
\begin{aligned}
& P(1)-P(0)=1^{3} \\
& P(2)-P(1)=2^{3} \\
& \cdots \cdots \cdots \cdots \cdots \cdots \\
& P(n)-P(n-1)=n^{3}
\end{aligned}
$$

Since $P(0)=0$, if we add the previous equations, we get

$$
P(n)=1^{3}+2^{3}+\cdots+n^{3}
$$

Now, it is clear that

$$
1^{3}+2^{3}+\cdots+n^{3}=\frac{1}{4} n^{2}(n+1)^{2}
$$