The Gateway to Computer Science Excellence
+4 votes
119 views
How to Solve series  like this

n(n-1)+ (n-1)(n-2) + (n-2)(n-3) + ...........
in Algorithms by Boss (21.5k points) | 119 views

1 Answer

+11 votes
Best answer
$n(n-1)+(n-1)(n-2)+(n-2)(n-3)+...$

$n(n-1) +(n-1)((n-1)-1)+(n-2)((n-2)-1)+.....$

$=n^2-n + (n-1)^2- (n-1) + (n-2)^2 - (n-2)+...$

$=(n^2 +(n-1)^2 + (n-2)^2 +... ) -  (n +(n-1) + (n-2) +... )$

$=\frac{n(n+1)(2n+1)}{6} - \frac{n(n+1)}{2}$

$=\frac{n(n^2-1)}{3}$

Note:

$\sum ^n_{i=1} i= \frac{n(n+1)}{2}$

$\sum ^n_{i=1} i^2= \frac{n(n+1)(2n+1)}{6}$
by Veteran (57k points)
selected by
0
Thank you very much!
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,385 answers
198,558 comments
105,371 users