Compute the sum of the following series: \( \sum_{i=1}^n i^2 \times 2^i\).


Difficulty level
This exercise is mostly suitable for students
While we can always use principle of mathematical induction (PMI) to solve these kinds of problems, that requires us to know or guess the solution.  If we do not have a good guess, we may need to solve it directly.  The good news is that although it is a bit more complicated, this question can be solved using term sliding.
 S  = 1^2.2  + 2^2.2^2 + 3^2.2^3 + ...     + n^2.2^n
2S =           1^2.2^2 + 2^2.2^3 + 3^2.2^4 + ... + (n-1)^2.2^n + n^2.2^(n+1)
Subtracting the second term from the first one, we obtain that:
- S = 1^2.2 + (2^2-1^2).2^2 + (3^2-3^2).2^3 + ... + (n^2-(n-1)^2).2^n - n^2.2^(n+1)
Since i^2-(i-1)^2 can be written as 2.i-1, we can now write the previous equation as:
- S = sum for i =1 to n   (2.i-1).2^i-n^2.2^(n+1)
    = 2.sum for i =1 to n  i.2^i   -  sum for i =1 to n   2^i - n^2.2^(n+1)

we know that  Sum i=1 to n i . 2^i  = (n-1)2^(n+1) + 2
WE simplify, we obtain that: 
S=n^2.2^(n+1) + 2(n+1)-2-(2n-2)2^(n+1)-4.
That is
Sum i=1 to n i^2.2^i=(n^2-2n+3)^2^(n+1)-6.

It is always prudent to validate the series for a few different of n .  For example, we can confirm that for n=1, both sides evaluate to 2 , and for n=3, both sides evaluate to 90 .

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
UVA 1112 - Mice and Maze