The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2015
COMP 2711 Discrete Mathematical Tools for CS
Fall 2015 Written Assignment # 4
Distributed: October 8, 2015 Due: October 15, 2015
Solutions
Your solutions should contain (i) your name, (ii) your student ID #, (ii) your
email address, (iv) your lecture sect
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2013
Problem Set 3: Discrete Probability
COMP 2711, Spring 2014
Due: 2/4/2014, Wednesday, in class
Please read the Problem Sets webpage carefully for instructions on proper submission of your
work as well as proper academic conduct.
1. Twelve people are random
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2014
COMP 2711 Discrete Mathematical Tools for CS
Written Assignment # 4
Distributed: 8 October 2014 Due: 14 October 2014
At the top of your solution, please write your (i) name, (ii) student ID #,
(iii) email address and (iv) tutorial section.
Some Notes:
Pl
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L06: Conditional Probability and
Independence
Conditional probability
Motivating examples
Definition
Independence
Definition
Property
Examples
Independent trials processes
Page 1
Example: Roll Two Dice
Event F and Change of
Sample Spaces
The thre
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
Page 1
L05: Probability of Unions of Events
Objective:
The inclusionexclusion principle for probability
Reading
Textbook 292300
Outline
The inclusionexclusion principle
An example
Proof of the principle
Page 3
Recall:
Page 5
Example: Roll Two Di
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
Part II: Probability
L04: Introduction to Probability
L05: Inclusion & Exclusion principles
L06: Conditional Probability & Independence
L07: Random Variables & Expectation
L08: Independence & Variance of random
variables
Reading: Chapter 5 of textbook
L04
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L14: Inference
Objectives
Study logical structure of proofs
A proof is a sequence of logic inference steps
12 Inference rules
Different types of proofs
Direct Proofs
Indirect Proofs
Contrapositive Proof
Proof by contradiction
Induction proof (L15)
Readi
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L03: Binomial Coefficients
Objectives:
Properties of binomial coefficients
Related issues: the Binomial Theorem and labeling
Reading
Textbook, pp. 5260
Page 1
Outline
Basic properties
Pascals triangle
The Binomial theorem
Labeling and Trinomial coef
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L02: More Counting
Use of Sum/Product Principle
Counting lists and functions
The Bijection Principle
Functions concepts: Injection, surjection, and
bijection
The Bijection Principle
# Increasing triples = # 3elements subsets
Counting permutations
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
Part I of Course
Part I: Counting
L01: Basic Counting
L02: More Counting
L03: Binomial Coefficients
Page 1
L01: Basic Counting
Objectives
Counting: What and Why?
Two basic principles of counting
Reading
Textbook, pp. 3138
Page 2
Outline
Introdu
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2015
Midterm Exam
COMP 2711, Spring 2015
1. [10 points]
Let p q and r denote the two given propositions which are both true.
(a) This conditional statement is q p which is the converse of p q. Its truth value
cannot be deduced from that of p q.
(b) Let s denot
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L07: Random Variables and Expectation
Random Variables
The concept
Bernoulli/Binomial random variables
Expectation of Random Variables
The concept
Properties
Expectation of indicator RVs
Expected #trials until first success
Reading
Textbook: 322336
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L08: Independence and Variance
of Random Variables
Independence of RVs
Distribution Functions of RVs
Independence between RVs
Expectation of product of independent RVs
Variance of RV
Definition and Examples
Additivity
Standard deviation
Central l
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L14: Rules of Inference
& Basic Proof Technique
Objectives
Rules of Inference
Rules of Inference for Propositional Logic
Rules of Inference for Predicate Logic
Basic Proof Technique
Some Terminology
Direct Proof
Proof by Contraposition
Proof by Contr
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
Outline
Predicates
Quantifiers
Quantifiers with Restricted Domains
Logical Equivalences involving Quantifiers
More Examples
Nested Quantifiers
Nested Quantifiers
Example
Assume that the domain for the variables x and y
consists of all real numbers.
The s
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L11: The RSA Algorithm
Objectives:
Present the RSA Cryptosystem
Prove its correctness
Discuss related issues
Reading
Textbook, pp. 123143
Page 1
The RSA Algorithm
Exponentiation mod n
The RSA Cryptosystem
Correctness
Fermats Little Theorem
Dec
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
Page 1
Part IV: Logic
L12, L13
Start with some atomic statements
Make compound statements using logic connectives
and quantifiers
Determine truth/falsehood of compound statements
Determine if two compound statements are
equivalent
L14
Given a colle
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
L10: Inverses and GCDs
Objectives:
When does
have an inverse?
How to compute the multiplicative inverse?
Need: Greatest common dividers (GCDs)
Results will be used in L11 RSA algorithm
Reading
Textbook, pp. 105120
Page 1
Inverses and GCDs
Greates
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2014
Part III of Course
Part III: Cryptography
L09: Intro to Crypto and Modulus
L10: Inverses and GCDs
L11: The RSA crypto algorithm
Page 1
Page 2
Part III of Course
Objective:
Application of Number Theory in computer security.
Number theory has a long hist
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2015
Logic Examples I
Problem 1. Is the following reasoning for nding the solutions of the equation
x correct?
(1) 2x2 1 = x: Given
2x2 1 =
(2) 2x2 1 = x2 : Square both sides
(3) X 2 = 1
(4) So, x = 1 or x = 1.
Problem 2.
a spy.
A, B, C are three persons, one
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2015
Page 1
L09: Probability of Unions of Events
Objective:
The inclusionexclusion principle for probability
Reading
Stein et al. 292300
Outline
The inclusionexclusion principle
An example
Proof of the principle
Page 3
Recall:
Page 5
Example: Roll Tw
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2014
Problem 2: Use induction to prove that
n(n + 1)(n + 2)
1 2 + 2 3 + + n(n + 1) =
3
for all integers n 1.
Problem 2: Use induction to prove that
n(n + 1)(n + 2)
1 2 + 2 3 + + n(n + 1) =
3
for all integers n 1.
Solution: Denote the statement to proven by p(n
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2014
Problem 1: Use contradiction to prove that
n(n + 1)(n + 2)
1 2 + 2 3 + + n(n + 1) =
3
for all integers n 1.
Problem 1: Use contradiction to prove that
n(n + 1)(n + 2)
1 2 + 2 3 + + n(n + 1) =
3
for all integers n 1.
Solution: Start by denoting the problem
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2014
Problem 5
Suppose that boys and girls are equally likely to be born.
(a) In a family consisting of a mother, father, and two children
of dierent ages, what is the probability that the family has
two girls, given that one of the children is a girl?
(b) Wha
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2014
The Tennis Club Problem
A tennis club has 2n members.
We want to pair up the members (by twos) to play
singles matches.
21
The Tennis Club Problem
A tennis club has 2n members.
We want to pair up the members (by twos) to play
singles matches.
(a) In how
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Fall 2014
Problem 3 Throwing Balls into boxes
When we say throw m balls into n boxes we mean that each
of the nm possible outcomes is uniformly likely.
(a) Throw 6 balls into 5 boxes.
What is the probability that every box contains at least one ball?
Problem 3 Thro
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2013
Supplementary Exercises on Logic and Proof
Note: These exercises are meant to help you revise the material that you have
learnt in class when preparing for the exam. Please note that when solutions
are given below for the problems, they are at most sketch
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2013
Supplementary Exercises on Counting
Note: These exercises are meant to help you revise the material that you have
learnt in class when preparing for the exam. Please note that when solutions
are given below for the problems, they are at most sketch soluti
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2013
COMP 2711(L1) Quiz 3 Pool Questions and Answers
(2016
Student
ID:Fall Semester)
Quiz Date: 3 Oct, 2016 (Mon) OR
7 Oct, 2016 (Fri)
Problem 6:
1: [14
[2015
Midterm
Exam Paper (Probelm 6)]
Problem
pts](Fall)
(Counting
Lists)
In a computer system, a password
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2013
COMP 2711(L1) Quiz 7 Pool Questions and Answers (2016 Fall Semester)
Quiz Date: 7 Nov, 2016 (Mon) OR
11 Nov, 2016 (Fri)
Problem 1: [This problem is a wellknown problem called the coupon collectors
problem in the topic of probability.]
There are n dierent
The Hong Kong University of Science and Technology
Discrete Mathematical Tools for Computer Science
COMP 2711

Spring 2013
COMP 2711(L1) Quiz 6 Pool Questions and Answers (2016 Fall Semester)
Quiz Date: 31 Oct, 2016 (Mon) OR
Student ID:
4 Nov, 2016 (Fri)
[2015
Problem 1: [10
pts](Fall) Final Exam Paper (Problem 1)]
Consider rolling two fair dice and let D1 and D2 be the resul