Store and Inventory

## 3283154

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

The number of ways in which a score of  can be made from a throw by three persons, each throwing a single die once

we are interested in the coefficient of  in the expression

(
t

t

2

t

3

t

4

t

5

t

6

)

3

{\displaystyle (t+t^{2}+t^{3}+t^{4}+t^{5}+t^{6})^{3}}

which is

27

{\displaystyle 27}

.

## 2976301

https://math.stackexchange.com/questions/2976301/combinatorial-problem-using-generating-functions

Every day we buy exactly one of the following products:
pretzel (1 euro), candy (2 euro), icecream (2 euros).
What is the number of possible ways of spending all the money
(the order of the bought products counts)?

If

k

{\displaystyle k}

 is the number of days and

n

{\displaystyle n}

 the number of euros, the number of possibilities is :

(

k

n
−
k

)

2

n
−
k

{\displaystyle {\binom {k}{n-k}}2^{n-k}}

The generating function for one day is:

o
n
e
d
a
# y
p
d
e
c
d

e

2

i
d

e

2

{\displaystyle oneday=pde+cde^{2}+ide^{2}}

where

d

{\displaystyle d}

 is a counter for the number of days,

e

{\displaystyle e}

 for the number of euros, and

p

{\displaystyle p}

,

c

{\displaystyle c}

,

i

{\displaystyle i}

 for candies number.

k days will be described by :

o
n
e
d
a

y

k

=
(
p
e
c

e

2

i

e

2

)

k

{\displaystyle oneday^{k}=(pe+ce^{2}+ie^{2})^{k}}

( I dropped d as redundant)

Examining the computed numbers for small

k

{\displaystyle k}

 and

n

{\displaystyle n}

's, the pattern occurs.

In

k

{\displaystyle k}

 days we can spend

k
.
.
.2
k

{\displaystyle k...2k}

 euros. If we spends

k
l

{\displaystyle k+l}

 this is because in some

l

{\displaystyle l}

 days we buy

l

{\displaystyle l}

 expensive candies. These candies may be one of two types.

The sum for fixed

k

{\displaystyle k}

 is

3
k

{\displaystyle 3^k}

.

The sum for fixed

n

{\displaystyle n}

 is "Jacobsthal number" : see https://oeis.org/A001045 .

0
,
1
,
1
,
3
,
5
,
11
,
21
,
43
,
85
,
171...

{\displaystyle 0,1,1,3,5,11,21,43,85,171...}

The recurrence

a

n

=

a

n
−
1

2

a

n
−
2

{\displaystyle a\_{n}=a\_{n-1}+2a\_{n-2}}

 is nice and simple to explain.

Take for example the recurrence above

a
[
n
1
,
k
1
# ]
a
[
n
,
k
]
a
[
n
−
1
,
k
]

{\displaystyle a[n+1,k+1]=a[n,k]+2.a[n-1,k]}

. It is valid either if we think in terms of days and euros, or if we think it in terms of polynomial coefficients and the effort is mainly the same.

The specific of GF's is that they are self-referring.

o
n
e
d
a
# y
p
d
e
c
d

e

2

i
d

e

2

{\displaystyle oneday=pde+cde^{2}+ide^{2}}

 may be read as

a

t
e
r
m

i
s

p
d
e

o
r

c
d

e

2

o
r

i
d

e

2

{\displaystyle a\ term\ is\ pde\ or\ cde^{2}\ or\ ide^{2}}

c

e

2

c
o
n
t
a
i
n
s

o
n
e

c

a
n
d

t
w
o

e
′

s

{\displaystyle ce^{2}\ contains\ one\ c\ and\ two\ e's}

Behind both GF and a problem there is something deeper, sometimes named "a combinatorial species", or a "combinatorial class", or a "combinatorial structure".

The GF and the initial problem have the same "combinatorial structure" and this is why this stuff works.

## 2820559

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

Number of ways to distribute 10 things among 6 people given that the number of things given to two people doesn't exceed 4

Assume for the moment that we have an unlimited supply of boxes to be distributed to 6 individuals, whereby the first two together may obtain no more than 4 boxes. In a generating functions approach the combined allocations to A and B then are counted as

1
2
x
3

x

2

4

x

3

5

x

4

=

1
−
6

x

5

5

x

6

(
1
−
x

)

2

{\displaystyle 1+2x+3x^{2}+4x^{3}+5x^{4}={1-6x^{5}+5x^{6} \over (1-x)^{2}}}

and the allocations to the remaining four people as

(
1
x

x

2

x

3

…

)

4

=

1

(
1
−
x

)

4

{\displaystyle (1+x+x^{2}+x^{3}+\ldots )^{4}={1 \over (1-x)^{4}}}

The generating function for the full problem then becomes

F
(
x
# )

1
−
6

x

5

5

x

6

(
1
−
x

)

6

=
(
1
−
6

x

5

5

x

6

)

∑

k
≥
0

(

−
6

k

)

(
−
x

)

k

=
(
1
−
6

x

5

5

x

6

)

∑

k
≥
0

(

5
k

k

)

x

k

{\displaystyle F(x)={1-6x^{5}+5x^{6} \over (1-x)^{6}}=(1-6x^{5}+5x^{6})\sum \_{k\geq 0}{-6 \choose k}(-x)^{k}=(1-6x^{5}+5x^{6})\sum \_{k\geq 0}{5+k \choose k}x^{k}}

We now have to extract the coefficient of

x

10

{\displaystyle x^{10}}

 in this expansion:

# N

(

15
10

)

−
6

(

10
5

)

5

(

9
4

)

=
2121

{\displaystyle N={15 \choose 10}-6{10 \choose 5}+5{9 \choose 4}=2121}

Christian Blatter

## 648649

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

What is the probability no slots contain more than two balls given I am trying to sort 5 balls into 6 slots?

Five balls can be distributed in 6 slots following the GF

(
1
b

b

2

b

3

b

4

b

5

)
(
1
b

b

2

b

3

b

4

b

5

)
.
.
.
(
1
b

b

2

b

3

b

4

b

5

)

{\displaystyle (1+b+b^{2}+b^{3}+b^{4}+b^{5})(1+b+b^{2}+b^{3}+b^{4}+b^{5})...(1+b+b^{2}+b^{3}+b^{4}+b^{5})}

 (six factors)

The coefficient of

b

5

{\displaystyle b^{5}}

 is

252

{\displaystyle 252}

 and represents the ways of placing

5

{\displaystyle 5}

 balls without restrictions in six slots.

With the given restriction, the GF is

(
1
b

b

2

)
(
1
b

b

2

)
.
.
.
(
1
b

b

2

)

{\displaystyle (1+b+b^{2})(1+b+b^{2})...(1+b+b^{2})}

The coefficient of

b

5

{\displaystyle b^{5}}

 is now

126
$

{\displaystyle 126\$}

, that gives a probability of

50
%

{\displaystyle 50\%}

, as pointed above.

## 2035168

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

Distributing 11 socks into 4 drawers, with 5 red socks and 6 blue socks.

Polya style.

Let's make the inventory of the four drawers. A drawer may contain 0...5 red socks and 0...6 blue socks.

d
r
a
w
e
r
(
r
,
b
# )
(
1
r

r

2

.
.
.

r

5

)
.
(
1
b

b

2

.
.
.

b

6

)

{\displaystyle drawer(r,b)=(1+r+r^{2}+...r^{5}).(1+b+b^{2}+...b^{6})}

The closet has four drawers.

c
l
o
s
e
t
(
r
,
b
# )
d
r
a
w
e
r
(
r
,
b

)

4

{\displaystyle closet(r,b)=drawer(r,b)^{4}}

we are interested in the coefficient or

r

5

.

b

6

{\displaystyle r^{5}.b^{6}}

 of the closet, which is

4704

{\displaystyle 4704}

.

[

r

5

b

6

]
c
l
o
s
e
t
(
r
,
b
# )
4704

{\displaystyle [r^{5}b^{6}]closet(r,b)=4704}