# Sum of products of N

#### mathworker

##### Well-known member
If we are given with set of n natural numbers and asked to find the sum of all possible products of two number..
E.G:
{1,2,3} is given then ,
1*1+1*2+1*3+2*2+2*3+3*3=s
how to find the general formula of SUM for given n-tuple containing consecutive natural numbers not necessarily starts with 1 or at least first N natural numbers

#### mathworker

##### Well-known member
Re: sum of products of N

i tried with following approach ,
S=$$\displaystyle \sum n^2 + \sum n(n-1).......\sum n(n-(n-1))$$...
and tried finding sum by splitting terms but it gone wrong 'cause there are some negative terms which are meant to be ignored #### Opalg

##### MHB Oldtimer
Staff member
Re: sum of products of N

i tried with following approach ,
S=$$\displaystyle \sum n^2 + \sum n(n-1).......\sum n(n-(n-1))$$...
and tried finding sum by splitting terms but it gone wrong 'cause there are some negative terms which are meant to be ignored You should be able to check that the formula for $S_n$ is $S_n = \frac1{24}n(n+1)(n+2)(3n+1)$. Prove this by induction, noting that to get from $S_n$ to $S_{n+1}$ you need to add the terms $(n+1)(1+2+\ldots+(n+1)).$

#### mathworker

##### Well-known member
yeah i got from Opalgs idea,
$$\displaystyle Sn - S(n-1)=n(n(n+1))/2$$
$$\displaystyle S(n-1)-S(n-2)=(n-1)(n-1)n/2$$
and by canceling up to $$\displaystyle S_0$$
$$\displaystyle Sn = \sum n^2(n+1)/2$$
$$\displaystyle =n(n+1)(n+2)(3n+1)/24$$
thanks oplag... 