MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Combinatorica questions!!!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20671] Re: [mg20545] Re: [mg20499] Combinatorica questions!!!
  • From: "Tomas Garza" <tgarza at mail.internet.com.mx>
  • Date: Sun, 7 Nov 1999 02:10:06 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

The problem (part 2) posed by Keren Edwards, whether or not a homework
problem, was given an elegant solution by Andrzej Kozlowski. I wonder if it
might be worthwhile to give some background, since the approach taken by
Andrzej seems to have come out of the blue sky.

> The second question is much easier. A choice of 10 balls in your situation
> is exactly the same as a choice of an integer between 0 and 8, an integer
> betwen 0 and 9 and an integer between 0 and 7 so that the sum is
> 10. That's
> the same as the coeficient of x^10 in the following expression:
> In[5]:=
> Sum[x^i, {i, 0, 8}]*Sum[x^i, {i, 0, 9}]*Sum[x^i, {i, 0, 7}] // Expand

The idea would be as follows: there are three independent random variables,
say r, p, w (the number of red, purple and white balls obtained in a
sequence of independent draws), and the total number of balls is r + p + w.
Then introduce the notion of generating function, which is a constant times
Sum[x^i, {i, 0, 8}] for r, and similarly for p and w. Then recall that the
generating function of a sum of independent random variables is equal to the
product of their generating functions. In this case, this product is what
Andrzej gives above in In[5]. Thus the coefficient of the term x^10 is the
probability that r + p + w = 10, which adequately normalized gives the
number of ways in which the 10 balls can be drawn.

But we could use Mathematica in a more straightforward way to compute
directly the 56 cases, thereby illustrating how Mathematica could be useful
in constructing sample spaces in discrete probability problems.

We simply need to determine all triplets where the first element can be any
integer from 0 to 8, and for each of these, the other two must be
nonnegative integers such that the three of them add to 10. Thus

In[1]:=
Cases[Partition[Flatten[Table[{j, i, 10 - i - j}, {j, 8, 0, -1}, {i, 0,
7}]],
    3], {x_, y_, z_} /; 0 <= z <= 9]
Out[1]=
{{8, 0, 2}, {8, 1, 1}, {8, 2, 0}, {7, 0, 3}, {7, 1, 2}, {7, 2, 1}, {7, 3,
    0}, {6, 0, 4}, {6, 1, 3}, {6, 2, 2}, {6, 3, 1}, {6, 4, 0}, {5, 0, 5},
{5,
    1, 4}, {5, 2, 3}, {5, 3, 2}, {5, 4, 1}, {5, 5, 0}, {4, 0, 6}, {4, 1,
    5}, {4, 2, 4}, {4, 3, 3}, {4, 4, 2}, {4, 5, 1}, {4, 6, 0}, {3, 0, 7},
{3,
    1, 6}, {3, 2, 5}, {3, 3, 4}, {3, 4, 3}, {3, 5, 2}, {3, 6, 1}, {3, 7,
    0}, {2, 0, 8}, {2, 1, 7}, {2, 2, 6}, {2, 3, 5}, {2, 4, 4}, {2, 5, 3},
{2,
    6, 2}, {2, 7, 1}, {1, 0, 9}, {1, 1, 8}, {1, 2, 7}, {1, 3, 6}, {1, 4,
    5}, {1, 5, 4}, {1, 6, 3}, {1, 7, 2}, {0, 1, 9}, {0, 2, 8}, {0, 3, 7},
{0,
    4, 6}, {0, 5, 5}, {0, 6, 4}, {0, 7, 3}}

and of course

In[2]:=
Length[%]
Out[2]=
56

the same as obtained through the analytical approach used by Andrzej.

Tomas Garza
Mexico City



  • Prev by Date: Elliptic Curve Arithmetic
  • Next by Date: Re: Color of GridLines
  • Previous by thread: Re: Combinatorica questions!!!
  • Next by thread: Re: Combinatorica questions!!!