Sum of all possible products of elements taken from couples

  1. Hello

    I have N couples of real numbers higher than 1.
    Let's call them like (a0,b0), (a1,b1),...,(aN,bN)
    I have a number R <= N.

    I need the sum of all the possible products of N elements, chosing one from each couple but exactly R times the "b" element and N-R times the "a" element.
    Which is the best way to do it?

    As an example:
    (2,3), (5,7), (11,13)
    N = 3, R = 2
    I need 2x7x13 + 3x5x13 + 3x7x11

    Thank you!
  2. jcsd
  3. As an expression I think what you want to do is:

    [itex]\Sigma^{N}_{k=0} (a_{k}(\Sigma^{N}_{i=0} b_{i}))[/itex]

    I have no idea if there is any way to compute this other than just doing it.

    EDIT: Nevermind, I see you don't want "sum of all possible products of N+1 elements" but sum of all possible products of a choice of R elements from the N+1 elements. No idea, you're probably going to have to write a program for that.
    Last edited: Dec 13, 2013
  4. I got the answer from "Michael":
    It is the coefficient of x^R in (a0+xb0)(a1+xb1)...(aN+xbN)
Know someone interested in this topic? Share this thead via email, Google+, Twitter, or Facebook

Have something to add?

Draft saved Draft deleted