Exam 2 Key

Sorry, the scan above is hard to read. But the author has written

\[ T(n)=1+\sum_{i=2}^{n}\frac{i(i+1)}{2} \]

or \[ T(n)=\sum_{i=1}^{n}\frac{i(i+1)}{2}=\frac{1}{2}\sum_{i=1}^{n}(i^2+i)=\frac{1}{2}\left(\sum_{i=1}^{n}i^2+\sum_{i=1}^{n}i\right) \]

and we can do both of those sums (we get the sum of squares by the hint; the sum of i by Gauss!).

It works out to

\[ T(n)=\frac{n(n+1)(n+2)}{6} \]


Website maintained by Andy Long. Comments appreciated.