Midterm 2
November 10, 2008
PROBLEM ONE
1. Consider 7 consecutive coin ips. We represent the outcome of each ip
as H (heads) or T (tails). For example, a possible sequence of coin ips is
THHTHTT.
(a) How many sequences are there in total?
(b) How many seq
Final Exam Solutions
1. Consider the set X = cfw_1, 2, 3.
(a) List all invertible functions from X to X.
Solution: I will list their ordered pairs:
cfw_(1, 1), (2, 2)(3, 3), cfw_(1, 2), (2, 3), (3, 1), cfw_(1, 3), (2, 1), (3, 2),
cfw_(1, 1), (2, 3), (3, 2
MATH-UA.120.A
Short Answers
(4 points each) Place your final answer to each question in the box at the bottom. Some partial credit may
be awarded, but only an accurate answer will receive full credit.
1 Let a be a positive integer. Consider the set
S = x
Homework 7: due Wednesday, 15 October, 2008
PROBLEM ONE
1. Let Sn = cfw_1, 2, 3, ., n. We saw in class that the number of invertible
functions from the set Sn to itself (permutations of n elements) is n!. A
special case of this is S3 . The number of inver
Homework 7 Solutions
PROBLEM ONE
1. Let Sn = cfw_1, 2, 3, ., n. We saw in class that the number of invertible functions from the set Sn to itself (permutations of n
elements) is n!. A special case of this is S3 . The number of invertible functions from S3
Homework 8: due Monday, 20 October, 2008
PROBLEM ONE (Exercises from the book, 7th edition.)
1. Section 6.2 33-37: These exercises refer to a club consisting of six distinct
men and seven distinct women.
(a) In how many ways can we select a committee of v
Homework 8 Solutions
PROBLEM ONE (Exercises from the book, 7th edition.)
1. Section 6.2 33-37: These exercises refer to a club consisting of
six distinct men and seven distinct women.
(a) In how many ways can we select a committee of ve persons?
Solution:
Homework 9: due Monday, 27 October, 2008
PROBLEM ONE
1. (Exercises from the book, 6th edition, 6.6, 1-3.) Determine the number of
distinct orderings of the letters given:
(a) GUIDE
(b) SCHOOL
(c) SALESPERSONS
2. (Exercises from the book, 6th edition, 6.6,
Homework 9 Solutions
PROBLEM ONE
1. (Exercises from the book, 6th edition, 6.6, 1-3.) Determine the
number of distinct orderings of the letters given:
(a) GUIDE
Solution: 5!
(b) SCHOOL
Solution: 6!
2
(c) SALESPERSONS
12!
Solution: 4!2!
2. (Exercises from
Homework 5: due Mon, 29 Sep, 8:55 AM
PROBLEM ONE (Exercises from the text (7th edition).)
In class, we dened the terms reexive, transitive, and symmetric in reference
to relations. We make one more denition: a relation R on a set X is said to
be antisymme
Homework 15: due Thursday, Dec. 11, by 5 PM
PROBLEM ONE (Trees)
1. Recall the denition of a tree: a tree is a connected, undirected graph
which has no cycles. Which of the following denitions are equivalent to
this denition of a tree? For each, if it is n
Homework 3: due Mon, 22 Sep, 8:55 AM
PROBLEM ONE (Exercises from the text: all pages and sections are from
the seventh edition. If you have the sixth edition, you can consult its section on
sets. I do not know if these problems are in the sixth edition, s
Homework 2 Solutions
PROBLEM ONE
1. Trace through this algorithm with the initial data x = 3, y = 4, z =
0.
Solution:
i
?
?
1
1
2
2
3
3
4
4
x
3
3
3
3
3
3
3
3
3
3
y
4
4
4
4
4
4
4
4
4
4
z
0
1
1
3
3
9
9
27
27
81
RETURN 81
2. Draw a owchart for this algorithm
Homework 1: due Mon, 8 Sep, 8:55 AM
PROBLEM ONE
Remember our setup from class. I am a robot standing in front of many
boxes, lined up to my left and to my right. I also have a huge stack of pennies
and each box starts with some number of pennies in it (th
Homework 4 Solutions
PROBLEM ONE
Prove that for all sets A, B we have
A B (A B)
Solution: To show that the set on the left is a subset of the one on the right,
we must show that for every x A B, we also have x (A B). To this end,
let x A B. By denition, t
Homework 10: due Wednesday, 29 Oct.
Find the number of lines executed in the following algorithms when
(a) n = 3 and (b) n is arbitrary.
Line
1
2
3
4
1.
Code
x=1
for(i = 1 to n) cfw_
for(j = i to n) cfw_
x=x+1
(a) When n = 3, 20 lines are executed.
(b)
Homework 11 Solutions
PROBLEM ONE (Counting)
1. (a) In how many ways can we choose 3 distinct numbers from
the set
cfw_1, 2, 3, ., 10
so that no two numbers are adjacent? Here our choices are
unordered.
Solution: Let us place 10 blanks and choose 3 of the
Homework 14: due Thursday, Dec. 4
PROBLEM ONE
1. Solve the traveling salesman problem for the following graphs.
(a)
(b)
2. Trace through Dijkstras algorithm for the graph in exercise 1(a) with
starting vertex A and ending vertex D. Next, trace through wit
Practice Final
1. Consider the following algorithm. Assume that n 1.
line
1
2
3
4
5
6
7
code
alg(n) cfw_
j=0
if (n = 0) cfw_
return j
else cfw_
j = 2n+ alg(n 1)
return j
Set up a recurrence relation (with initial conditions) whose solution gives
L(n),
Practice Final Solutions
1. Consider the following algorithm. Assume that n 1.
line
1
2
3
4
5
6
7
code
alg(n) cfw_
j=0
if (n = 0) cfw_
return j
else cfw_
j = 2n+ alg(n 1)
return j
Set up a recurrence relation (with initial conditions) whose solution gi
Midterm 2 Review Solutions
PROBLEM ONE (Counting)
1. In how many ways can I place 50 identical balls into 9 bins?
What if I insist that each bin must contain at least a number of
balls equal to its bin number? (For instance, the rst bin must
contain at le
Practice Midterm 1 Solutions
PROBLEM ONE (Functions)
1. Draw the arrow diagrams for all functions f : X Y where
(a) X = cfw_1, 2 and Y = cfw_1, 2, 3
Solution: Instead of drawing the arrows, I will just list the function
in terms of pairs (like a relation)
Practice Midterm 1
PROBLEM ONE (Functions)
1. Draw the arrow diagrams for all functions f : X Y where
(a) X = cfw_1, 2 and Y = cfw_1, 2, 3
(b) X = cfw_1, 2, 3 and Y = cfw_1, 2
(c) X = cfw_1, 2 and Y = cfw_1, 2
2. In each part (a), (b), and (c) above, how
Midterm 2 Review Exercises
PROBLEM ONE (Counting)
1. In how many ways can I place 50 identical balls into 9 bins? What if I
insist that each bin must contain at least a number of balls equal to its
bin number? (For instance, the rst bin must contain at le
Homework 12 Solutions
Consider the following algorithm.
line
1
2
3
4
5
6
7
8
9
code
alg(n) cfw_
k=1
j=1
if (n = 1) cfw_
return j + k
else if (n > 1) cfw_
k = 1+alg(n 1)
j = 2(1+alg(n 1)
return j + k
1. Trace the algorithm (as we did in class) for n = 3
Homework 11: due Tuesday, Nov. 5
PROBLEM ONE (Counting)
1. (a) Read the handout on the salespersons problem and summarize the
technique used (no more than 1 paragraph).
(b) In how many ways can we choose 3 distinct numbers from the set
cfw_1, 2, 3, ., 10
Homework 13: due Tuesday, Nov. 25
PROBLEM ONE
1. Solve the recurrence relation
X(n) = 3X(n 1) + 5X(n 2) : n 2
X(0) = 1
X(1) = 2
2. Solve the recurrence relation
X(n) = 4X(n 1) 4X(n 2) : n 2
X(0) = 0
X(1) = 1
3. Let N (n) be the number of length n strings
Homework 15 Solutions
PROBLEM ONE (Trees)
1. Recall the denition of a tree: a tree is a connected, undirected
graph which has no cycles. Which of the following denitions
are equivalent to this denition of a tree? For each, if it is not
equivalent, give a
Homework 14 Solutions
PROBLEM ONE
1. Solve the traveling salesman problem for the following graphs.
(a)
Solution: We rst look to nd edges which must be present in any
Hamiltonian cycle. I suggest that you circle them or shade them
as I list them. Since ve
HW #3 Solutions
10
12.
Let x C. Then x 12 so there is an integer n such that x n = 12. Then x n3 = 36, and since n3 is an
integer, x 36. Therefore, x D.
13.
Claim. C D if and only if c d.
Proof. Suppose c d. Then there exists an integer m such that c m =
7, 10, 12, 13, 16, 19, 20
27.3 Any n-cycle in Sn can be represented using a list starting with 1. Each ordering of the remaining
n - 1 numbers represents a different cycle. Thus there are (n - 1) ! such permutations.
27.4 This is an innocuous-seeming pro
1. Offer another proof for Theorem 1 using sets of lists instead of sets of subsets.
n-1
2j = 2n - 1.
j=0
Proof. Let B = cfw_0, 1n - cfw_0n , i.e., the set of lists of length n whose entries are only 0 or 1, but not all 0s.
Then B = 2n - 1 by Theorem 8.6
Name: _ NetID:_
Discrete Mathematics
Youngren
Quiz 5
This quiz is scheduled for 15 minutes. No outside notes or calculators are permitted. Show all work to
receive full credit. The total score is 10 points.
1. (6 points)
Find a closed form for the polynom
HW #11 Solutions
1. Identify the group of symmetries of a regular (equal sides and angles)
pentagon (with vertices marked 1, 2, , 5) with a subgroup of S5.
Start with rotation by 72. As a permutation, this is
= (1, 2, 3, 4, 5) = (1, 5)(1, 4)(1, 3)(1, 2),