MATH/CSCI 2112 Assignment 1 Solution
26 Jan 2015
(1) (a) Given the implication p q, show that its converse and inverse are logically equivalent.
ANSWER:
Converse: q p
Inverse: p q
Recall that p q is equivalent to the boolean expression p q, so q p is equi
MATH/CSCI 2112 DISCRETE MATHEMATICS I
ASSIGNMENT 2 SOLUTION JAN 31 2015
(1) Let G represents the set of all T.V. game shows. Let P be the set of people in your neighbourhood. Let C(p, g) be the predicate that the person p appeared on game show g and D(p)
DISCRETE MATHEMATICS I
MATH/CSCI 2112 ASSIGNMENT 6 SOLUTIONS
DUE 23 MAR 2015
(1) Prove by induction on n > n0 that n3 < 3n . What is the value n0 ?
ANSWER:
n
0
1
2
3
4
5
n3
0
1
8
27
64
125
3n
1
3
9
27
81
241
Claim: n3 < 3n for n 4
Base Case: As shown in t
Discrete Mathematics I MATH/CSCI 2112 Winter 2015
Bonus Assignment 7 Solution Due Fri 10 April 2015
(1) (a) Write an (ecient) recursive algorithm Pow (a,n) than computes
an , a R, n Z+ cfw_0. Prove your algorithm correct.
ANSWER:
Pow (a, n)
if n = 0
retur
1
1
1
1
1
1
1
1
7
2
3
4
5
6
1
3
6
10
15
21
1
4
10
20
35
1
1
5
15
35
1
6
21
1
7
1
Pascals formula
For all integers k, n, 0 < k < n,
n
k
=
n 1
k1
+
n 1
k
.
n
This, and the fact that n = n
0 = 1, allows us to construct
Pascals triangle.
Pascals formula
F
Permutations
An inversion in a permutation of [n] is a pair i, j, 1 i < j n, where j occurs
before i in the permutation.
A permutation is odd if it has an odd number of inversions, and even otherwise.
1234
1243
1324
1342
1423
1432
2134
2143
2314
2341
2413
Class notes, Jan 410.
Read more: Chapter on counting in Book of Proof. Chapter 1 in Principles and
Techniques in Combinatorics.
Counting techniques
Addition and Multiplication Principle
1. A doughnut shop has five types of doughnuts, four types of muffins
First success
Suppose you repeat an experiment until the first time it succeeds, and the
chance of success is p. What is the expected number of trials you perform?
Assume that outcomes of the trials are independent.
Random variable: let X be the number of
Probability and tree diagrams
Two hockey teams, A and B, play a best 2 out of 3 series (thus, the player
that first wins two games wins the series.) Suppose team A is stronger, and
wins a game with probability 53 , independent of what happened in previous
Grid paths
Consider grid paths from (0, 0) to (6, 6). The main diagonal is the diagonal
from (0, 0) to (6, 6).
What is the expected number of times that such a grid path meets the main
diagonal? (The beginning and end point do not count)?
What is the expe
Generating functions to derive direct formula
a0 = 0, a1 = 6, an = 3an1 + 10an2 + 3 2n , for all n 2.
Multiply recurrence by xn , and sum over all valid values of n:
X
an xn = 3
n=2
Let a(x) =
P
n
n=1 an x .
X
n=2
an1 xn + 10
X
an2 xn + 3
n=2
X
2n xn .
n=
Warmup
Combinations, Permutations, WallsBalls, Count the opposite, Multinomial
(MISSISSIPPI), Inclusion/exclusion.
1. Four dice are tossed at the same time. How many different outcomes are
there?
A: 1296
B: 360
C: 126
D: 15
2. How many grid paths are ther
Permutations
How many permutations of all letters of the alphabet contain the word CAT?
How many contain the word CAT or the word BAG? How many contain the
word DOG and the word CAT?
1
Principle of inclusion/exclusion
1. How many permutations of all lette
Class notes, Jan 11+13. Chapter 4 in Principles and Techniques in Combinatorics.
Inclusion/exclusion
Warm-up problems.
1. How many permutations of all letters of the alphabet contain the word CAT?
How many contain the word CAT or the word DOG? How many co
Generating Functions
If you take f (x) = 1/(1 x x2 ) and expand it as a power series by long division, say,
then you get f (x) = 1/(1 x x2 ) = 1 + x + 2x2 + 3x3 + 5x4 + 8x5 + 13x6 + . It certainly
seems as though the coecient of xn in the power series is
Class notes, Jan 1823.
Section 1.6 in Principles and Techniques in Combinatorics, Wiki page on
Pr
ufer sequences, Wiki page on Tree traversals.
Bijective proofs
Relations and functions
The Carthesian product of sets A and B is the set
A B = cfw_(a, b) : a
Class notes, January 25 and 27
Wiki page on Cantors diagonal argument
Cardinality of infinite sets
Countably infinite sets
An infinite set A is called countable if there exists a bijection from the set
of natural numbers N to A. For example, let E be the
Class notes, Feb 29
Chapter 6 of Principles and Techniques in Combinatorics , Wiki page on
Catalan numbers. Web page on Josephus problem (see links on OWL)
Recurrence relations modelling
Fibonacci numbers
Consider the following counting questions:
1. How
Review from last class
(List) Ordered
(Set) Unordered
Repetition
Multiplication Pr.
Walls and Balls
No repetition
Permutation
Combination
1
Recognizing the problem
A judge at a flower show knows nothing about orchids. If he picks randomly, and there are
Addition and Multiplication Principle
A doughnut shop has five types of doughnuts, four types of
muffins. You receive a coupon which gives you a free doughnut or muffin. How many possibilities? What if the coupon gives
you a free doughnut and a muffin. Ho
Counting Unlabelled, Rooted, Ordered Trees
An Unlabelled, Rooted, Ordered Tree on n vertices (nodes) can be represented
by a binary word of length 2(n1) on the alphabet of open and closed brackets.
Bracket Representation
Traverse the tree in pre-order. No
Functions, formally.
Carthesian product.
A B = cfw_(a, b) : a A, b B.
A relation from A to B is a subset of A B.
A function is a relation R so that for every a A, there is exactly one b B
so that (a, b) R.
Function notation: f : A B. Instead of (a, b) we
Probability Space
A probability space consists of three parts:
Example: Throwing a fair die.
Sample Space. This is the set of all possible outcomes. Here we assume this
set to be finite.
The sample space is the set of all outcomes: cfw_1, 2, 3, 4, 5, 6
Ev
Recursive Definition of Bracket Notation
Let T be a rooted, unlabelled, ordered tree with n nodes.
If n = 1, so T consists only of the root, then bracket notation bn(T ) is the
empty string.
If n > 1, then let T1 , . . . , T` be the subtrees of T .
Then
b
Polynomials
1. What is the coefficient of x2 in the polynomial (x + 1)5 ?
2. What is the coefficient of x4 in the polynomial (x + 2)6 ?
3. What is the coefficient of x5 in the polynomial (x + x2 + x3 + x4 )2 ? What
counting problem does this solve?
4. Wha
MATH 2113 - Assignment 3
Due: Jan 28
6.6.4 - Using the denition, we nd that
n!
3!(n 3)!
n(n 1)(n 2)(n 3)!
=
3!(n 3)!
3
n 3n2 + 2n
=
6
n
3
=
6.6.13 - Using the denition we can calculate
n
r+1
n!
(r + 1)!(n r 1)!
nr
1
= n!
(r + 1)r!
(n r)(n r 1)!
nr
n!
=
r
MATH 2113 - Assignment 2 Solutions
Due: Jan 21
6.2.27 - Since we want to write n = pk2 pk2 pkm as a product of two positive
2 2
m
numbers without a common factor it must be of the form n = a b where
a contains some subset of the primes which divide n and
MATH 2113 - Assignment 5 Solutions
Due: Feb 16
6.2.20 - a) Using theorem 6.1.1, the number of elements in a list from n to
m is m n + 1. Therefore, from 1000 to 9999 there are 9999-1000+1 = 9000
elements.
b) Since even and odd numbers alternate, half of o
MATH 2113 - Assignment 6
Due: Mar 4
1. Let S be the set of states for a nite automaton and let
be the
set of characters that it acts upon. We dene the next state function
N :S
S.
a) Under what conditions is N onto?
N will be onto, if in the transition di
MKTG 3376 (Consumer Behavior)
Review Questions for the Final Exam
(Chapters 7-10 & Data Analysis)
Chapter 7: Attitudes (Skip the section Using Attitudes to Predict Behavior, pp. 199-204.)
1) Julia's favorite magazines are Vogue and Harper's Bazaar; she lo