How to find the value of this summation equation? The question is:
$$\sum_{i=1}^n (i^2+3i+4)$$
I get that 
$$\sum_{i=1}^n i^2 = \frac{n(n+1)(n+2)}{6}$$ and $$3\sum_{i=1}^n i = \frac{3n(n+1)}{2}$$ so one would get 
I'll call this form1: $$\frac{n(n+1)(n+2)}{6} + \frac{3n(n+1)}{2} + 4n$$
However, the textbook that I using says the answer is: 
I'll call this form2: $$\frac{n(n^2+6n+17)}{3}$$
So the part I am confused with is the steps in between form1 and form2.
On a last note it been a good year since I've done any calculus so it would appreciated if you would point the relevant concepts so I can review. Thanks. 
 A: There are several mistakes. Below is the clarification.
$$\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}$$
$$\sum_{i=1}^n i = \frac{n(n+1)}{2}$$
$$\sum_{i=1}^n 1 = n$$
Hence
\begin{align}
\sum_{i=1}^n (i^2+3i+4) 
& = \sum_{i=1}^n i^2 + 3 \sum_{i=1}^n i + 4\sum_{i=1}^n 1\\
& = \frac{n(n+1)(2n+1)}{6} + 3\frac{n(n+1)}{2} + 4n \\
& = \frac{n}{6}(2n^2 + 3n + 1 + 9n + 9 + 24)\\
& = \frac{n}{6}(2n^2 + 12n + 34)\\
& = \frac{n}{3}(n^2 + 6n + 17)
\end{align}
A: Here's your mistake: $$\sum_{i=1}^ni^2=\frac{n(n+1)(2n+1)}{6}$$
A: The last term $4$ should be $4n$, because you are adding $4$ for $n$ times.
A: $$\sum_{k\le n} c=cn\neq c$$
In your example, $\displaystyle\sum 4=4n,$ yet you wrote $4$.
EDIT:
$$\frac{n(n+1)(n+2)}{6} + \frac{3n(n+1)}{2} + 4n = n(n^2+6n+17)/3$$
$$\frac{n(n+1)(n+2)}{2} + \frac{9n(n+1)}{2} + 12n = n^3+6n^2+17n$$
$$\frac{n^3+3n^2+2n}{2} + \frac{9n^2+9n}{2}  = n^3+6n^2+5n$$
$${n^3+3n^2+2n} + {9n^2+9n}= 2n^3+12n^2+10n$$
$${2n} + {9n}= n^3+10n$$
$$1\neq n^2$$
Therefore one of them is incorrect.
We see that you messed up on $\sum i^2$, it equals $\frac{n(n+1)(2n+1)}{6}$
