Sum & Product

## 2958701

https://math.stackexchange.com/questions/2958701

Nine different chocolate bars are to be distributed to 3 different kids.

a) In how many ways can this be done if there are no restrictions?

b) In how many ways can this be done if the child A receives exactly four chocolate bars?

c) In how many ways can this be done if each kid gets at least one chocolate bar?

E
(
X
)
⋅
E
(
X
)
⋅
E
(
X
)

{\displaystyle E(X)\cdot E(X)\cdot E(X)}

e
x
p
(
x
)

{\displaystyle exp(x)}

e
x
p
(
x
)

{\displaystyle exp(x)}

e
x
p
(
x
)

{\displaystyle exp(x)}

E

4

(
X
)
⋅
E
(
X
)
⋅
E
(
X
)

{\displaystyle E\_{4}(X)\cdot E(X)\cdot E(X)}

x

4

4
!

{\displaystyle x^{4} \over 4!}

e
x
p
(
x
)

{\displaystyle exp(x)}

e
x
p
(
x
)

{\displaystyle exp(x)}

E

(
X
)
⋅

E

(
X
)
⋅

E

(
X
)

{\displaystyle E^{+}(X)\cdot E^{+}(X)\cdot E^{+}(X)}

e
x
p
(
x
)
−
1

{\displaystyle exp(x)-1}

e
x
p
(
x
)
−
1

{\displaystyle exp(x)-1}

e
x
p
(
x
)
−
1

{\displaystyle exp(x)-1}

## 2839811

https://math.stackexchange.com/questions/2839811

Probability of number of balls in the bucket

Suppose we throw 180 balls into 10 bins, choosing a random a bin independently from previous throws. What's the probability that *some bin* has k balls or more?

E

23

(
X
)
⋅

E

23

(
X
)
⋯

E

23

(
X
)

{\displaystyle E\_{23}(X)\cdot E\_{23}(X)\cdots E\_{23}(X)}

1
x
⋯

x

23

23
!

{\displaystyle 1+x\cdots +{\frac {x^{23}}{23!}}}

⋯

{\displaystyle \cdots}

1
x
⋯

x

23

23
!

{\displaystyle 1+x+\cdots +{\frac {x^{23}}{23!}}}

Assume that the capacity of a bucket is 23. The e.g.f. for one bucket is:

1
x
⋯

x

23

23
!

{\displaystyle 1+x+\cdots +{\frac {x^{23}}{23!}}}

for ten distinct buckets one will have :

(
1
x

x

2

2
!

x

3

3
!

⋯

x

23

23
!

)

10

{\displaystyle (1+x+{\frac {x^{2}}{2!}}+{\frac {x^{3}}{3!}}+\cdots +{\frac {x^{23}}{23!}})^{10}}

We are interested in the coefficient of

x

180

180
!

{\displaystyle {\frac {x^{180}}{180!}}}

, which agrees with previous calculus.

316493908895554453369790961313619572009615365012907112082570161990794872355520000505402092717575252190566769024926332221764288309486803949091940966173304490507414724761824000000000

(The probability not to spill something is then 0.3164934.)

## 3300469

https://math.stackexchange.com/questions/3300469

Number of possible ways to pair elements from two datasets

I have a problem counting all the possible ways of "pairing" two datasets of size n and m, including partial pairing.

E
n
s
(
X
)
⋅
E
n
s
(
X
Y
)
⋅
E
n
s
(
Y
)

{\displaystyle Ens(X)\cdot Ens(XY)\cdot Ens(Y)}

## 2853761

https://math.stackexchange.com/questions/2853761

Combinations involving distinct sets of variables

Let's say I have two entirely distinct groupings of things that I wish to combine. The first set contains three items: , while the second set contains five items: .

As shown in the comment, it is about applying many times simple operations.

I will work a larger example, using species and e.g.f. Suppose there are two sorts, M and W and we have 15 M and 17 W. We have to form a team of 3....5 M and say, 6....9 W.

The species formula is:

E
(
M
)
⋅
[

E

3

(
M
)

E

4

(
M
)

E

5

(
M
)
]
⋅
[

E

6

(
W
)

E

7

(
W
)

E

8

(
W
)

E

9

(
W
)
]
⋅
E
(
W
)

{\displaystyle E(M)\cdot [E\_{3}(M)+E\_{4}(M)+E\_{5}(M)]\cdot [E\_{6}(W)+E\_{7}(W)+E\_{8}(W)+E\_{9}(W)]\cdot E(W)}

The first two factors means that our structure is a subset of size 3 \*\*or\*\* 4 \*\*or\*\* 5 \*\*and\*\* the last two factors means that we have a subset of size 6, \*\*or\*\* 7, \*\*or\*\* 8, \*\*or\*\* 9 for the sort W.

Then we write the e.g.f.

e
x
p
(
m
)
.
(

m

3

3
!

m

4

4
!

m

5

5
!

)
.
(

w

6

6
!

w

7

7
!

w

8

8
!

w

9

9
!

)
.
e
x
p
(
w
)

{\displaystyle exp(m).({\frac {m^{3}}{3!}}+{\frac {m^{4}}{4!}}+{\frac {m^{5}}{5!}}).({\frac {w^{6}}{6!}}+{\frac {w^{7}}{7!}}+{\frac {w^{8}}{8!}}+{\frac {w^{9}}{9!}}).exp(w)}

I personally use the maple mtaylor function to truncate exp(x) to a suitable size that covers the biggest cardinals that occur.

Now we are interested in the coefficient of

m

15

15
!

w

17

17
!

{\displaystyle {\frac {m^{15}}{15!}}{\frac {w^{17}}{17!}}}

 in the above e.g.f. because it represents the answer.

## 2855400

https://math.stackexchange.com/questions/2855400

Number of ordered ways to pick 3 balls out of an urn with 2 black and 3 white balls without replacement

The generating function for all words without restrictions is

G
F
(
x
,
y
,
t
# )

1

1
−
x
t
−
y
t

{\displaystyle GF(x,y,t)={1 \over 1-xt-yt}}

where the coefficient of

x

n

y

k

t

m

{\displaystyle x^{n}y^{k}t^{m}}

 encodes the number of word of length

m

{\displaystyle m}

 that contain

n

{\displaystyle n}

 letters W and

k

{\displaystyle k}

 letters B.

∑

0
⩽
n

N

c
o
e
f
f
(

x

n

)

∑

0
⩽
k

K

c
o
e
f
f
(

y

k

)

∑

# m
M

c
o
e
f
f
(

t

m

)

G
F
(
x
,
y
,
t
)

{\displaystyle \sum \_{0\leqslant n}^{N}coeff(x^{n})\ \sum \_{0\leqslant k}^{K}coeff(y^{k})\ \sum \_{m=M}coeff(t^{m})\ GF(x,y,t)}

for the given case, this "viewport" will extract the polynomials:

x

3

3

x

2

y
3
x

y

2

y

3

{\displaystyle x^{3}+3x^{2}y+3xy^{2}+y^{3}}

x

3

3

x

2

3
x
1

{\displaystyle x^{3}+3x^{2}+3x+1}

7

{\displaystyle 7}

Oh dear me !
here is a nice one :

We have to partition in two subsets a string of length M

x

1

x

2

.
.
.

x

M

{\displaystyle x\_{1}x\_{2}...x\_{M}}

then the exponential generating function is :

(
1
x

x

2

2
!

⋯

x

K

K
!

)
.
(
1
x

x

2

2
!

⋯

x

N

N
!

)

{\displaystyle (1+x+{x^{2} \over 2!}+\cdots +{x^{K} \over K!}).(1+x+{x^{2} \over 2!}+\cdots +{x^{N} \over N!})}

Just take the coefficient of

x

M

M
!

{\displaystyle x^{M} \over M!}

see here https://math.stackexchange.com/questions/2825116