5

Given a set S with n elements, and an integer k. I need to find the sum of products of all n choose k pairs. That is, if S = {1,2,3,4} and k = 2, then I am looking for P = 1*2 + 1*3 + 1*4 + 2*3 + 2*4 +3*4. Note that product-pairs constitute the set -- taking k distinct elements from a set of n elements. I can formulate a simple dynamic programming version of this:

P(n,k) = a_{n}P(n-1,k-1) + P(n-1,k)

That is, take n-1 elements and choose k-1 and add a_{n} as well as leave out a_{n}. Is there some nice theory to find a closed form solution to the above problem? I am a bit lacking on advanced maths, though programming excites me. I was able to derive the aforementioned DP but could not proceed to a closed form which I hope there is!

Michał Powaga
  • 22,561
  • 8
  • 51
  • 62
sanket
  • 259
  • 2
  • 7
  • I find this an interesting question, though perhaps more appropriate for math.SE. As I see it, without knowledge of the elements of the set, the closed form is simply the sum itself. I think that is definitional. If what you are seeking is a more efficient method to compute the sum, I cannot think of any better than your own. – Mr.Wizard Nov 14 '11 at 23:27

2 Answers2

5

I do not know if it is actually helpful, but it occurs to me that you are describing elementary symmetric polynomials.

Further, it appears that this paper may be of use to you:

Computing Elementary Symmetric Polynomials with a Sub-Polynomial Number of Multiplications

Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
0

Given n, k as you have defined them:

the number of products to be summed #(n,k) is given by

(n,k) = C(n+k-1, k-1), where C(a,b) is the combinatoric function, ie,

     a objects selected b at a time. 

Furthermore, #(n,k) = k*#(n-1,k) - (n-1)*#(n,k-1).

Community
  • 1
  • 1