How to Calculate Summation of n square

Reading time ~1 minute

When doing complexity analysis on some algorithms, we might encounter the cases where we need to calcaulate \(S = 1^2 + 2^2 + 3^2 + \cdots + n^2\). However, not like the summation of an arithmetic sequence or geometric sequence, this calculation is not that easy. In this post, I’ll introduce a simple method to finish this calculation.

First of all, let’s define,

Get its first-order derivative as follows,

It’s easy to verify that,

Therefore, our mission is to calculate the value of \(f’(x)\) when \(x = 1\).

As,

By minusing them, we can get,

Therefore,

Dividing by \((1 -x)\) on each side, we can obtain,

Since \(\frac{1 - x^{n - i +1}}{1 - x} = 1 + x + x^2 + \cdots + x^{n - i}\), hence,

Let \(x = 1\), then,

Denote \(S = 1^2 + 2^2 + 3^2 + \cdots + n^2\), we can get,

Therefore,

Useful Linux Software

Ubuntu Software Installation Continue reading

Useful user-defined LaTeX commands

Published on November 27, 2016