COMP2121 / CSIS1118
Foundations of Computer Science / Discrete Mathematics
Tutorial 3
Date: Nov. 06, 2014 (Thu.)
1. How many permutations of the 26 letters of the English alphabet do not contain
any of the strings oil, bird or lemon?
Let A be any permutat

THE UNIVERSITY OF HONG KONG
DEPARTMENT OF COMPUTER SCIENCE
COMP2121/CSIS1118
Foundations of Computer Science/Discrete Mathematics
QUIZ 1
Date: September 29, 2014
Time: 1 hour and 45 minutes
Q1. [15%] Determine whether the following argument is valid or no

COMP2121 / CSIS1118
Foundations of Computer Science / Discrete Mathematics
Tutorial 4
Date: Nov. 20, 2014 (Thu.)
1. Suppose we know that 4% of the patients tested in a clinic are infected with avian
inuenza. Furthermore, suppose that when a blood test for

THE UNIVERSITY OF HONG KONG
DEPARTMENT OF COMPUTER SCIENCE
COMP2121 / CSIS1118
Foundations of Computer Science/Discrete Mathematics
Assignment 1
Due Date : September 27, 2013
Question 1 [10 pt] (refer to P.13, Q.8)
Let p, q, and r be the propositions
p :

COMP2121/CSIS1118
Discrete Mathematics
Combinations
Francis Chin
October 21, 2013
([O3], Chapter 6 except 6.2)
1
Counting Review
Rule of Sum
Rule of Product
Given a set S of n distinct objects.
A permutation is an ordered arrangement of these objects.

COMP2121/CSIS1118
Discrete Mathematics
Graphs
Revision
Francis Chin
Dec 2, 2013
1
Logical Equivalence
Show that p(qr) and (pq)(pr) are
logically equivalent.
using truth table
using logical equivalences
p(qr) p(qr)
(pq)(pr)
(pq)(pr)
(pq)(pr)
(pq)(pr)

COMP2121/CSIS1118
Discrete Mathematics
Hamiltonian Graphs
Graphs
Francis Chin
November 21, 2013
[O1, O2] Chapter 10.5
1
Euler and Hamiltonian Circuit/Path
An Euler circuit (or cycle) is a simple circuit
containing every edge in the graph.
A connected grap

COMP2121/CSIS1118
Discrete Mathematics
Inclusion and Exclusion
Pigeon-Hole Principle
Prof. Francis Chin
October 28, 2013
([O3], Chapter 6.2, 8.5, 8.6)
1
Security Problem Locks and Keys
Design a safe with locks and keys system that can only be
opened by an

COMP2121/CSIS1118
Discrete Mathematics
Counting
Francis Chin
([O3]; Chapter 6)
October 10, 2013
1
Counting
Counting is for finding the number of possible arrangements
or configurations of a certain pattern.
Examples:
Assume the length of a password is bet

COMP2121/CSIS1118
Discrete Mathematics
Methods of Proof
Professor Francis Chin
Sept 16, 2013
([O1,O2]; Chapters 1.6, 1.8, 1.9, 5.1, 5.2)
1
Logical Inference
Example: If Peter did it, he will be nervous when he is questioned.
Peter was very nervous when he

COMP2121/CSIS1118
Discrete Mathematics
Probability
Professor Francis Chin
October 31, 2013
([O1, O3]) Text book - Chapter 7
1
1.
2.
MC then opens one
of the other two
doors which does
not have the car
behind
3.
An expensive
sport car is hiding
behind one

COMP2121/CSIS1118
Discrete Mathematics
Graphs
Revision
Francis Chin
Nov 14, 2013
1
Equivalence relation
Let a, b be any two integers.
(a, b) R if and only if a-b is a multiple of 3.
(a) Show that R is an equivalence relation.
(b) Find all the equivalence

COMP2121/CSIS1118
Discrete Mathematics
Graphs
Francis Chin
November 7, 2013
([O1, O2]; Chapter 10)
1
What is a Graph?
A simple graph G = (V, E) consists of
V, the set of vertices (nodes, points), and
E, the set of edges (lines)
Undirected graphs are gra

COMP2121/CSIS1118
Discrete Mathematics
Propositional Logic
Professor Francis Chin
Sept 9, 2013
([O1, O2]; chapters 1.1, 1.2, 1.3)
1
Propositional Satisfiability (Ch1.3, p28)
A proposition is a statement that can either be true (T) or
false (F), but a comp

COMP2121/CSIS1118
Discrete Mathematics
Conditional Probability
Bayes Theorem
Professor Francis Chin
November 4, 2013
([O1, O3]) Text book - Chapter 7
1
Probability
Sample space (S) a set of possible outcomes;
Event (E) a subset of sample space;
If all out

COMP2121/CSIS1118
Discrete Mathematics
Hamiltonian Graphs
Graphs
Francis Chin
Nov 25, 2013
[O1, O2] Chapter 10.5
1
Euler and Hamiltonian Circuit/Path
An Euler circuit (or cycle) is a simple circuit
containing every edge in the graph.
A connected graph has

COMP2121/CSIS1118
Discrete Mathematics
Euler Path/Circuit
Prof. Francis Chin
November 11, 2013
([O1, O2] Chapter 10.4, 10.5)
1
Revision
Graph G(V, E)
Directed and undirected graph
Model of application
Complete graph, cycle, mesh, torus, hypercube
Number o

THE UNIVERSITY OF HONG KONG
DEPARTMENT OF COMPUTER SCIENCE
COMP2121 / CSIS1118
Foundations of Computer Science/Discrete Mathematics
Prof. Francis Chin
QUIZ
November 18, 2013 (Mon)
Question 1
Let a, b be any two integers.
(a, b) R if and only if 3a + b is

COMP2121 Discrete Mathematics
Prof. Francis Chin
QUIZ
October 7, 2013 (Mon)
Question 1 [10 pt]
Show that p (q r) and q (p r) are logically equivalent by means of
a. truth table;
b. by applying the logical known equivalences.
Ans:
a.
p
q
r
p
qr
p (q r)
pr

COMP2121/CSIS1118
Discrete Mathematics
Sets
Francis Chin
Sept 30, 2013
([O1]; Chapter 2.1, 2.2, 9)
1
Sets Definition & Notation
A set is a collection of objects.
Example:
A = cfw_apple, orange, mango, pear
B = cfw_policeman, fireman, manager, doctor, lawy

COMP2121/CSIS1118
Discrete Mathematics
Recursion
R
i
Professor Francis Chin and Dr SM Yiu
,
(6th edition: chapters 4.3, 7.1; 7th edition: chapters 5.3, 8.1)
1
Recurrence and recursive function
A function is recursive if it is defined in terms of itself.

THE UNIVERSITY OF HONG KONG
DEPARTMENT OF COMPUTER SCIENCE
COMP2121/CSIS1118
Foundations of Computer Science/Discrete Mathematics
QUIZ 2 SAMPLE SOLUTION
Q1.
(a) Take A = cfw_1, B = cfw_2, then P(A) = cfw_ , 1, P(B) = cfw_ , 2
P(A B) = cfw_ , 1, 2, cfw_1,

Sample solutions to Quiz 1 of COMP2121/CSIS1118
Foundations of Computer Science/Discrete Mathematics
Q1 (a)
p(x): a student x likes logic.
q(x): a student x studies for discrete mathematics quiz.
r(x): a student x fails the quiz.
If a student likes logic,

THE UNIVERSITY OF HONG KONG
DEPARTMENT OF COMPUTER SCIENCE
COMP2121/CSIS1118
Foundations of Computer Science/Discrete Mathematics
QUIZ 2
Date: November 03, 2014
Time: 1 hour and 45 minutes
Q1. [10%] Prove or disprove each of the following for finite sets

Department of Computer Science
Second Term Timetable 2014-2015
Updated on Aug 05, 2014 (subject to change)
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
08:30AM - 09:20AM
09:30AM - 10:20AM
COMP2123B (LE2) Chui C K
COMP3271 (CBC) Wang Jack
CSIS1123B (L

Department of Computer Science
First Term Timetable 2014-2015
Updated on Jul 17, 2014 (subject to change)
Monday
Tuesday
Wednesday
Thursday
Friday
08:30AM - 09:20AM
09:30AM - 10:20AM
COMP2121B (CBA) Chin Francis,
COMP3297 (CBC) Mitcheson
Yiu S M
George
CS

ENGG1007
Foundations of Computer Science
Tutorial 1
Li Ning & Xiaowei Wu
Sep 20, 2012
1
Basic Concepts
Proposition: is a statement that is either true (T) or
false (F), but not both.
A proposition (compound proposition) can be formed
by combining severa

COMP2121/CSIS1118
Discrete Mathematics
Planar Graphs
and Graph Coloring
Francis Chin
November 28, 2013
([O1,O2]) Chapter 10.7, 10.8
1
Motivation: Planar
Layouts
Puzzle:
Three houses have to connect
to three utilities: Electricity,
Water and Gas. For safet

COMP2121/CSIS1118
Discrete Mathematics
Relations and Functions
Francis Chin
([O1]; Chapters 2.3, 9)
October 3, 2013
1
Properties of Relations
Relation is a set of ordered pairs.
A relation R on a set A is called
reflexive : (a,a) R for all a A. i.e., a A