Discrete Mathematics - Answers To The Test

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Discrete mathematics – Answers to the test

Duration: 60 minutes
Lecture notes and calculators are allowed. Mobile phones are strictly prohibited.

Exercise 1 (1 pt)
Let N be the total number of letters in your fullname. If it is less than 10,
increase it by 10. What is the final value of N ?
This final value of N will be used in the rest of the exercises.

Exercise 2 (3 pts)
A test consists of N multiple choice questions. Each question has four answer
choices, of which only one is correct. A student has not studied for the test, so
he decided to choose the answers completely at random (that is to say, every
choice has an equal chance of 25% to be chosen).

1. What was the probability that he got all the correct answers?
Ans: (1/4)N .
2. What was the probability that he got exactly five correct answers?
Ans: N5 (1/4)5 (3/4)N −5 .


3. What was the probability that he got at least five correct answers?
Ans: 1 − p, where p is the probability to get at most 4 correct answers:
4  
X N
p= (1/4)i (3/4)N −i
i=0
i

Exercise 3 (5 pts) 1. How many ways are there to arrange N identical copies
of a textbook into three different shelves?
(Hint: Find the number of non-negative integer solutions to an equation.)
Ans: The number of integer solutions  to x1 + x2 + x3 = N such that
x1 ≥ 0, x2 ≥ 0, x3 ≥ 0, which is N2+2 = (N + 2)(N + 1)/2.
2. How many ways are there to arrange N identical copies of a textbook into
three different shelves so that each shelf has at least two copies?
Ans: The number of integer solutions to x1 + x2 + x3 = N such that
x1 ≥ 2, x2 ≥ 2, x3 ≥ 2, which is the number of integer solutions to y1 +
y2 + y3 = N − 6 such that y1 ≥ 0, y2 ≥ 0, y3 ≥ 0, and is (N − 4)(N − 5)/2.
3. How many ways are there to arrange N identical copies of a textbook into
three different shelves so that each shelf has at most ten copies?
Ans: The answer to questions 1 - the number of integer solutions to
x1 + x2 + x3 = N such that x1 ≥ 11 or x2 ≥ 11 or x3 ≥ 11 and is
(N + 2)(N + 1)/2 − 3(N − 9)(N − 10)/2 if N ≥ 11 and (N + 2)(N + 1)/2
if N = 10.
Exercise 4 (1 pt)
Let un be the number of bit strings of length n that contain 01. Find a recur-
rence relation for the sequence (un ).
Ans: Let s be such a string of length n ≥ 2. There are two cases:
1. s = 1s0 where s0 is a string of length n − 1 containing 01. There are un−1
strings in this case.
2. s = 0 . . . 01s0 where the first 1 occurs at position ≥ 2 and s0 is an
Pn k n−k
arbitrary bit string of length n − k. There are k=2 2 strings in this
case.
Pn
Hence un = un−1 + k=2 2n−k = un−1 +2n−1 −1 (n ≥ 2). The initial conditions
are u0 = 0, u1 = 0.

You might also like