I understand that the general formula for a sum of quadratic sequence is :$\displaystyle \sum_{i=1}^n {i^2} = \frac{n(n+1)(2n+1)}{6}$
However, my question is that does $i$ here has to be single term always? Can I still use the formula if I am calculating $\displaystyle \sum_{i=1}^n {(1+i)^2} $ ?
For example, I was trying to calculate $\displaystyle \sum_{i=1}^3 {(2+i)^2} $, and this is what I did
- $\displaystyle \frac{(2+n)((2+n)+1)(2(2+n)+1)}{6}$
- $\displaystyle \frac{(2+n)(3+n)(2n+5)}{6}$
- $\displaystyle \frac{(5)(6)(11)}{6} = 55$
However, the right answer is 50.
I would like to know what is happening here? And why I can't use this formula directly?
$$\begin{align*}\sum_{i=1}^3(2+i)^2 &= \sum_{j=3}^5 j^2&&(j=2+i)\\ &= \sum_{j=1}^5 j^2 - \sum_{j=1}^2 j^2\\ &= \sum_{j=1}^5 j^2 - 5 \end{align*}$$