6.042/18.062J
Mathematics
for
Computer
Science
April
5,
2005
Srini
Devadas
and
Eric
Lehman
Problem
Set
8
Solutions
Due:
Monday,
April
11
at
9
PM
Problem
1.
An
electronic
toy
displays
a
4
×
4
grid
of
colored
squares.
At
all
times,
four
are
red,
four
are
green,
four
are
blue,
and
four
are
yellow.
For
example,
here
is
one
possible
configuration:
'
$
R
B
Y
R
Y
B
G
G
B
R
R
G
B
G
Y
Y
±²
±²
±²
±²
±²
2
3
4
5
³´
³´
³´
1
³´
³´
&
%
(a)
How
many
such
configurations
are
possible?
Solution.
This
is
equal
to
the
number
of
sequences
containing
4
R’s,
4
G’s,
4
B’s,
and
4
Y’s,
which
is:
16!
(4!)
4
(b)
Below
the
display,
there
are
five
buttons
numbered
1,
2,
3,
4,
and
5.
The
player
may
press
a
sequence
of
buttons;
however,
the
same
button
can
not
be
pressed
twice
in
a
row.
How
many
different
sequences
of
n
buttonpresses
are
possible?
Solution.
There
are
5
choices
for
the
first
button
press
and
4
for
each
subsequence
press.
Therefore,
the
number
of
different
sequences
of
n
button
presses
is
5
4
n
−
1
.
·
(c)
Each
button
press
scrambles
the
colored
squares
in
a
complicated,
but
nonran
dom
way.
Prove
that
there
exist
two
different
sequences
of
32
button
presses
that
both
produce
the
same
configuration,
if
the
puzzle
is
initially
in
the
state
shown
above.
Solution.
We
use
the
Pigeonhole
Principle.
Let
A
be
the
set
of
all
sequences
of
32
button
presses,
let
B
be
the
set
of
all
configurations,
and
let
f
:
A
B
map
each
sequence
of
button
presses
to
the
configuration
that
results.
Now:
→
>
16!
>

B

A

>
4
32

This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
� �
�
�
� �
� �
� �
�
�
�
�
�
�
2
Problem
Set
8
Thus,
by
the
Pigeonhole
Principle,
f
is
not
injective;
that
is,
there
exist
distinct
el
ements
a
1
, a
2
∈
A
such
taht
f
(
a
1
) =
f
(
a
2
)
.
In
other
words,
there
are
two
different
sequences
of
button
presses
that
produce
the
same
configuration.
Problem
2.
Suppose
you
have
five
6sided
dice,
which
are
colored
red,
blue,
green,
white,
and
black.
A
roll
is
a
sequence
specifying
a
value
for
each
die.
For
example,
one
roll
is:
(
3
,
1
,
4
,
1
,
5
����
����
����
����
����
)
red
green
blue
white
black
For
the
problems
below,
you
do
not
need
to
simpify
your
answers,
but
brieﬂy
explain
your
reasoning.
(a)
For
how
many
rolls
is
the
value
on
every
die
different?
Example:
(1
,
2
,
3
,
4
,
5)
is
a
roll
of
this
type,
but
(1
,
1
,
2
,
3
,
4)
is
not.
Solution.
The
number
of
such
rolls
is
6
5
4
3
2
·
·
·
·
(b)
For
how
many
rolls
do
two
dice
have
the
same
value
and
the
remaining
three
dice
all
have
different
values?
Example:
(6
,
1
,
6
,
2
,
3)
is
a
roll
of
this
type,
but
(1
,
1
,
2
,
2
,
3)
and
(4
,
4
,
4
,
5
,
6)
are
not.
Solution.
There
are
5
2
possible
pairs
of
rolls
that
might
have
the
same
value
and
6
possibilities
for
what
this
value
is.
There
5
4
3
possible
distinct
values
for
the
·
·
remaining
three
rolls.
So
the
number
of
rolls
of
this
type
is
5
6
5
4
3
2
·
·
·
·
(c)
For
how
many
rolls
do
two
dice
have
one
value,
two
different
dice
have
a
second
value,
and
the
remaining
die
a
third
value?
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '11
 Dr.EricLehman
 Computer Science, Recurrence relation, Fibonacci number, Finite set, Generating function

Click to edit the document details