Closed form for a sum of values of a quadratic? Today in class we were analyzing the number of half-spaces created by $n$ number of planes. For two planes there are 4 spaces, 3 there are 8, 4 there are 15, etc. our teacher challenged us to find the formula for $n$ planes. Me and my friend came up with
$$
1+\sum^n_{x=1} \left(\frac{x(x+1)}{2}+1\right) 
$$
Because based on that when a line cuts a plane in half, the formula for the number of half-planes it creates is
$$
\frac{n(n+1)}{2} + 1
$$
and the difference in the number of half-spaces between each $n$ plane is equal to adding on the same number of half-planes.
+--#of planes--+--1--+--2--+--3--+--4--+--5--+--50--+
|separates into|  2  |  4  |  8  |  15 | 26  |20,876|
| _ half-spaces|     |     |     |     |     |      |
+--difference--+-----2-----4-----7----16----etc-----+

My teacher said that this was correct, but it would be better if it was a formula/function, where you plug in the variables rather than have to evaluate the summation. I know that the final answer is
$$
\frac{n^3+5n+6}{6}
$$
but I need to show my work, and am unsure of how to get from a sum to that formula. Am I approaching this incorrectly? How was the original formula derived?
 A: Your question amounts to evaluating 
$$\sum_{x=1}^n x^2\,\,\,\text{and}\;\;\sum_{x=1}^n x$$
(upon expanding your original sum). Specifically,
$$\sum_{x=1}^nx=\frac{x(x+1)}{2}$$
$$\sum_{x=1}^n x^2=\frac{x(x+1)(2x+1)}{6}$$
which can be shown by induction.
A: The reasoning is basically right, with slight glitches in the details. The desired number is
$$2+\sum_{x=1}^{n-1} \left(\frac{x(x+1)}{2}+1\right).\tag{$1$}$$
Or else, if you want to sum from $1$ to $n$, the desired number is 
$$1+\sum_{x=1}^{n} \left(\frac{x(x-1)}{2}+1\right).\tag{$2$}$$
Note that $(x+1)^3-x^3=3x^2+3x+1$. So 
$$\frac{x^2+x}{2}=\frac{1}{6}\left((x+1)^3-x^3-1\right).$$ 
Adding $1$, we get
$$\frac{x^2+x}{2}+1=\frac{1}{6}\left((x+1)^3-x^3+5\right).$$
We will add up $(x+1)^3-x^3+4$ from $x=1$ to $x=n-1$, and divide by $6$ at the end. We have $n-1$ $5$'s, which add up to $5n-5$. 
Now add up the $(x+1)^3-x^3$ from $x=1$ to $x=n-1$. 
The sum is 
$$(2^3-1^3)+(3^3-2^3)+(4^3-3^3)+\cdots +(n^3-(n-1)^3).$$
Note the beautiful cancellations! Almost everything disappears, and we end up with $n^3-1^3$. Add the $5n-5$. We get $n^3+5n-6$. 
So our answer is $2+\dfrac{n^3+5n-6}{6}$, which simplifies to  $\dfrac{n^3+5n+6}{6}$.
Remarks: $1$. If you want to work with expression $(2)$ instead of $(1)$, you may want to use the identity $x^3-(x-1)^3=3x^2-3x+1$, though the one we used works fine.
$2$. The kind of collapsing that we saw comes up surprisingly often. You may want to look into telescoping sums. 
$3$. There are many many other ways to find a closed form for the sm. Here is another idea. It is known that for any quadratic $q(k)$, $\sum_{k=1}^{n-1}$ is a cubic. (And for any cubic $c(k)$, $\sum_{1}^{n-1}c(k)$ is a quartic, and so on.). So our answer must have shape $p(n)=an^3+bn^2+cn+d$. If we know the  values of our function at $4$ different $n$, we get $4$ linear equations in the coefficients $a$, $b$, $c$, $d$. Solve.
