Assume that following holds for some reals $A,B$ $$\sum_{k=1}^{n} \left[A k(n-k) + B \right]= n^3$$ The problem is to evaluate the coefficients $A,B$. These coefficients are $A = 6, B = 1$, however, I have a problem to evaluate them, my try: $$\sum_{k=1}^{n} \left[A kn - A k^2 + B\right] = n^3$$ $$ A \sum_{k=1}^{n} kn - A \sum_{k=1}^{n}k^2 + \sum_{k=1}^{n} B = n^3$$ $$ An \sum_{k=1}^{n} k- A \sum_{k=1}^{n} k^2 + Bn = n^3$$ Furthermore, by means of Faulhaber's formula we replace the sums $$ An \frac{n^2+n}{2} - A \frac{2n^3 + 3n^2 +n}{6} + Bn = n^3$$ $$ A\frac{n^3+n^2}{2} - A \frac{2n^3 + 3n^2 +n}{6} + Bn = n^3$$ $$ A\frac{3n^3+3n^2}{6} - A \frac{2n^3 + 3n^2 +n}{6} + Bn = n^3$$ $$ A\frac{n^3+n}{6} + Bn = n^3 \ \color{red}{*}$$ Multiply both part by $6$ and moving $6n^3$ to the left part gives $$ An^3 + An + 6Bn - 6n^3 = 0$$ Since that $n>0$, we have to solve the following system of equations $$n^3(A - 6) + n(6B + A) = 0$$ $$A - 6 = 0$$ $$6B + A = 0$$ Which gives $$A = 6$$ $$B = -1$$ Which is wrong answer. Please, advice on my mistakes. Moreover, please advice on the case $$\sum_{k=1}^n Ak^2(n-k)^2 + Bk(n-k) + C = n^5$$
Update: as It mentioned in comments, there is a wrong plus in $A\frac{n^3+n}{6} + Bn = n^3$, if we fix it, it goes well
$$ An^3 - An + 6Bn - 6n^3 = 0$$ Since that $n>0$, we have to solve the following system of equations $$n^3(A - 6) + n(6B - A) = 0$$ $$A - 6 = 0$$ $$6B - A = 0$$ Which gives $$A = 6$$ $$B = 1$$