introduction to discrete mathematics

59
Introduction to Discrete Mathematics Lecture 1: Sep 6 A B C a = qb+r gcd(a,b) = gcd(b,r)

Upload: tyler-hill

Post on 15-Mar-2016

121 views

Category:

Documents


7 download

DESCRIPTION

A. B. C. Introduction to Discrete Mathematics. Lecture 1: Sep 6. a = qb+r gcd(a,b) = gcd(b,r). Today’s Plan. Course Information and Arrangement Course Requirement Course Project (and Examples and Ideas) Topics and objectives of this course Introduction to logic. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction to Discrete Mathematics

Introduction to Discrete Mathematics

Lecture 1: Sep 6

A B

C

a = qb+r gcd(a,b) = gcd(b,r)

Page 2: Introduction to Discrete Mathematics

Today’s Plan

Course Information and Arrangement

Course Requirement

Course Project (and Examples and Ideas)

Topics and objectives of this course

Introduction to logic

Page 3: Introduction to Discrete Mathematics

Basic Information

Course homepage: http://www.cse.cuhk.edu.hk/~chi/csc2110/ Newsgroup: cuhk.cse.csc2110. at news.cse.cuhk.edu.hk Instructor: Lau, Lap Chi Office hour: 9:30-12:30, 2:30-5:15 (SHB 911)

Lectures: M7-8 (SC L1), W6 (SC L1) Tutors: Cheung Ho Yee (Leo)

Kwok Tsz Chiu Leung Kai Man (Hackson)

Zhang Zixi (Jesse) Tutorials: W10 (TBD) or H5 (LSB C1) or H6 (LSB C1)

Page 4: Introduction to Discrete Mathematics

Course Material

Textbook: Discrete Mathematics with Applications Author: Susanna S. Epp Publisher: Brooks/Cole

Notes: Course notes from “mathematics for computer science” http://courses.csail.mit.edu/6.042/spring07/

(available to be downloaded in the course homepage)

Page 5: Introduction to Discrete Mathematics

Extra Lectures

There are two types of extra lectures.

Revision lectures:

Cover background materialAnswer questions, explain lecturesDo exercises, help homework/exams

Advanced lectures:

Cover advanced material

Both are optional. Revision in “odd” weeks and advanced in “even” weeks.

First revision class starts this week, cover high school mathematics(e.g. power and logarithms, number sequences, mathematical induction, differentiation and integration).

in Cantonese

Page 6: Introduction to Discrete Mathematics

Time Table

M T W H F12345 Tut6 X Lec Tut7 Lec X8 Lec X9 X X10 X11

(1) Tutorials (2) Office hours (3) TA office hours (4) extra lectures

Page 7: Introduction to Discrete Mathematics

Today’s Plan

Course Information and Arrangement

Course Requirement

Course Project (and Examples and Ideas)

Topics and objectives of this course

Introduction to logic

Page 8: Introduction to Discrete Mathematics

Course Requirements

Homework, 20%

Midterm, 25%

Course project, 10%

Final Exam, 45%

Midterm: Oct 25 (Monday), in class

Page 9: Introduction to Discrete Mathematics

Course Project

4 students in a group

Pick an interesting mathematical topic,

write a report of about 10 pages.

Can use any references, but cite them.

Choose 1-3 groups to present, up to 5% (of the course) bonus

Page 10: Introduction to Discrete Mathematics

Tell an interesting story about mathematics.

Nice presentation, easy to understand.

In-depth study of a mathematical topic/method/problem

Interesting problems, elegant solutions

Applications of mathematics to computer science

Course Project

Page 11: Introduction to Discrete Mathematics

Checker

x=0

Start with any configuration with all circles on or below the x-axis.

Page 12: Introduction to Discrete Mathematics

Checker

x=0

Move: jump through your adjacent neighbour, but then your neighbour will disappear.

Page 13: Introduction to Discrete Mathematics

Checker

x=0

Move: jump through your adjacent neighbour, but then your neighbour will disappear.

Page 14: Introduction to Discrete Mathematics

Checker

x=0

Goal: Find an initial configuration with least number of circles to jump up to level k.

Page 15: Introduction to Discrete Mathematics

K=1

x=0

2 circles to reach level 1.

Page 16: Introduction to Discrete Mathematics

K=2

x=0

Page 17: Introduction to Discrete Mathematics

K=2

x=0

4 circles to reach level 2.

Now we have reduced to the k=1 configuration, but one level higher.

Page 18: Introduction to Discrete Mathematics

K=3

x=0

This is the configuration for k=2, so jump two level higher.

Page 19: Introduction to Discrete Mathematics

K=3

x=0

8 circles to reach level 3.

Page 20: Introduction to Discrete Mathematics

K=4

x=0

Page 21: Introduction to Discrete Mathematics

K=4

x=0

Page 22: Introduction to Discrete Mathematics

K=4

x=0

Page 23: Introduction to Discrete Mathematics

K=4

x=0

Page 24: Introduction to Discrete Mathematics

K=4

x=0

Now we have reduced to the k=3 configuration, but one level higher

20 circles (not 16) to reach level 4!

Page 25: Introduction to Discrete Mathematics

K=5?

a. 39 or below

b. 40-50 circles

c. 51-70 circles

d. 71- 100 circles

e. 101 – 1000 circles

f. 1001 or above

It turns out that it is impossible to move to level 5,and there is a very interesting mathematical proof of it.

Page 26: Introduction to Discrete Mathematics

Example 1

How to play Rubik Cube?

Google: Rubik cube in 20 moves!

http://www.cse.cuhk.edu.hk/~chi/csc2110-2008/notes/Rubik-Cube.pptPrevious project develops an original method to solve Rubik Cube:

Page 27: Introduction to Discrete Mathematics

Example 2

The mathematics of paper folding

http://erikdemaine.org/foldcut/

http://www.ushistory.org/betsy/flagstar.html

Page 28: Introduction to Discrete Mathematics

Project Ideas

Deadline: November 17.

http://www.cse.cuhk.edu.hk/~chi/csc2110/project.html

Topics: number theory, graph theory, game theory, etc.Methods: probabilistic, algebraic, recursion, induction, etc.Problems: logic paradoxes, magic tricks, paper folding, etc.Applications: cryptography, coding theory, algorithm design, etc.References: “mathematical gems”, wikipedia, popular books, etc.

Page 29: Introduction to Discrete Mathematics

Today’s Plan

Course Information and Arrangement

Course Requirement

Course Project (and Examples and Ideas)

Topics and objectives of this course

Introduction to logic

Page 30: Introduction to Discrete Mathematics

Why Mathematics?

Understand the design of efficient computer systems.

• How did Google manage to build a fast search engine?

• What is the foundation of internet security?

algorithms, data structures, database,parallel computing, distributed systems,cryptography, computer networks…

Logic, number theory, counting, graph theory…

Page 31: Introduction to Discrete Mathematics

Topic 1: Logic and Proofs

Logic: propositional logic, first order logic

Proof: induction, contradiction

How do computers (and humans) think?

Artificial intelligence, database, circuit, algorithms

Page 32: Introduction to Discrete Mathematics

Topic 2: Number Theory

• (Extended) Euclidean algorithm and prime numbers• Modular arithmetic, Chinese remainder theorem• Check digit scheme, cryptography

Cryptography, coding theory, data structures

Page 33: Introduction to Discrete Mathematics

Topic 3: Counting

• Sets and Functions• Combinations, Permutations, Binomial theorem• Counting by mapping, pigeonhole principle• Recursions

Probability, algorithms, data structures

A B

C

Page 34: Introduction to Discrete Mathematics

Topic 3: Counting

How many steps are needed to sort n numbers?

Algorithm 1 (Bubble Sort): Every iteration moves the i-th smallest number to the i-th position

Algorithm 2 (Merge Sort):

Which algorithm runs faster?

Page 35: Introduction to Discrete Mathematics

Topic 4: Graph Theory

• Graphs, Relations• Degree sequence, Eulerian graphs, isomorphism• Trees• Matching• Coloring

Computer networks, circuit design, data structures

Page 36: Introduction to Discrete Mathematics

Topic 4: Graph Theory

How to color a map?

How to send data efficiently?

How to schedule exams?

Page 37: Introduction to Discrete Mathematics

Objectives of This Course

CSC 2100, ERG 2040, CSC 3130, CSC 3160

•To learn basic mathematical concepts, e.g. sets, functions, graphs•To be familiar with formal mathematical reasoning, e.g. logic, proofs•To improve problem solving skills•To see the connections between discrete mathematics and computer science

Practice, Practice and Practice.

Page 38: Introduction to Discrete Mathematics

Today’s Plan

Course Information and Arrangement

Course Requirement

Course Project (and Examples and Ideas)

Topics and objectives of this course

Introduction to logic Motivations Basic Definitions Logic formula

Page 39: Introduction to Discrete Mathematics

2 2 2a b c

Familiar?Obvious?

cb

a

Pythagorean theorem

Page 40: Introduction to Discrete Mathematics

cb

a

(i) a cc square, and then(ii) an aa & a bb square

Good Proof

b-a

We will show that these five pieces can be rearranged into:

b-a

And then we can conclude that

Page 41: Introduction to Discrete Mathematics

c

cc

a b

c

b-a

Good Proof

The five pieces can be rearranged into:

(i) a cc square

Page 42: Introduction to Discrete Mathematics

cb

a b-a

b-a

Good Proof

How to rearrange them into an axa square and a bxb square?

Page 43: Introduction to Discrete Mathematics

ba

a ab-a

74 proofs in http://www.cut-the-knot.org/pythagoras/index.shtml

b

Good Proof

b

Page 44: Introduction to Discrete Mathematics

Bad ProofA similar rearrangement technique shows that 65=64…

What’s wrong with the proof?

Page 45: Introduction to Discrete Mathematics

Mathematical Proof

To prove mathematical theorems, we need a more rigorous system.

http://en.wikipedia.org/wiki/Pythagorean_theoremEuclid’s proof of Pythagorean’s theorem

The standard procedure for proving mathematical theorems is invented by Euclid in 300BC. First he started with five axioms (the truth of thesestatements are taken for granted). Then he uses logic to deduce the truthof other statements.

1.It is possible to draw a straight line from any point to any other point. 2.It is possible to produce a finite straight line continuously in a straight line. 3.It is possible to describe a circle with any center and any radius. 4.It is true that all right angles are equal to one another. 5.("Parallel postulate") It is true that, if a straight line falling on two straight lines make the interior angles on the same side less than two right angles, the two straight lines, if produced indefinitely, intersect on that side on which are the angles less than the two right angles.

See page 18 of the notes for the ZFC axioms that we now use.

Page 46: Introduction to Discrete Mathematics

Statement (Proposition)

A Statement is a sentence that is either True or False

Examples:

Non-examples:

x+y>0

x2+y2=z2

TrueFalse

2 + 2 = 43 x 3 = 8

787009911 is a prime

They are true for some values of x and y but are false for some other values of x and y.

Page 47: Introduction to Discrete Mathematics

Logic Operators

FFFT

P Q

FFTFFTTTQP

AND::

FTTT

P Q

FFTFFTTTQP

OR::

NOT:: ~p is true if p is false

Page 48: Introduction to Discrete Mathematics

Compound Statement

p = “it is hot” q = “it is sunny”

It is hot and sunny

It is not hot but sunny

It is neither hot nor sunny

Page 49: Introduction to Discrete Mathematics

Exclusive-Or

coffee “or” tea exclusive-or

How to construct a compound statement for exclusive-or?

p q p qT T FT F TF T TF F F

Idea 1: Look at the true rowsIdea 1: Look at the true rowsIdea 1: Look at the true rows

Want the formula to be trueexactly when the input belongsto a “true” row.

The input is the second row exactly if this sub-formula is satisfied

And the formula is true exactly when the input is the second row or the third row.

Page 50: Introduction to Discrete Mathematics

Exclusive-Or

coffee “or” tea exclusive-or

How to construct a compound statement for exclusive-or?

p q p qT T FT F TF T TF F F

Idea 2: Look at the false rows

Want the formula to be trueexactly when the input doesnot belong to a “false” row.

The input is the first row exactly if this sub-formula is satisfied

And the formula is true exactly when the input is not in the 1st row and the 4th row.

Page 51: Introduction to Discrete Mathematics

Logical Equivalence

p q

T T F T F F

T F T T T T

F T T T T T

F F F F T F

Logical equivalence: Two statements have the same truth table

Idea 3: Guess and check

As you see, there are many different ways to write the same logical formula.One can always use a truth table to check whether two statements are equivalent.

Page 52: Introduction to Discrete Mathematics

Writing Logical Formula for a Truth Table

Digital logic:

Given a digital circuit, we can construct the truth table.

Now, suppose we are given only the truth table (i.e. the specification),how can we construct a circuit (i.e. formula) that has the same function?

Page 53: Introduction to Discrete Mathematics

Writing Logical Formula for a Truth Table

p q r output

T T T F

T T F T

T F T T

T F F F

F T T T

F T F T

F F T T

F F F F

Use idea 1 or idea 2. Idea 1: Look at the true rows and take the “or”.

The formula is true exactly when the input is one of the true rows.

Page 54: Introduction to Discrete Mathematics

Writing Logical Formula for a Truth Table

Idea 2: Look at the false rows, negate and take the “and”.

The formula is true exactly when the input is not one of the false row.

p q r output

T T T F

T T F T

T F T T

T F F F

F T T T

F T F T

F F T T

F F F F

Page 55: Introduction to Discrete Mathematics

DeMorgan’s LawsLogical equivalence: Two statements have the same truth table

Statement: Tom is in the football team and the basketball team.

Negation: Tom is not in the football team or not in the basketball team.

Statement: The number 783477841 is divisible by 7 or 11.Negation: The number 783477841 is not divisible by 7 and not divisible by 11.

De Morgan’s Law

De Morgan’s Law

Page 56: Introduction to Discrete Mathematics

DeMorgan’s LawsLogical equivalence: Two statements have the same truth table

T T F FT F T TF T T TF F T T

De Morgan’s Law

De Morgan’s Law

Page 57: Introduction to Discrete Mathematics

Simplifying Statement

See textbook for more identities.

DeMorgan

Distributive law

Page 58: Introduction to Discrete Mathematics

Tautology, ContradictionA tautology is a statement that is always true.

A contradiction is a statement that is always false.(negation of a tautology)

In general it is “difficult” to tell whether a statement is a contradiction.It is one of the most important problems in CS – the satisfiability problem.

Page 59: Introduction to Discrete Mathematics

Quick Summary

Key points to know.

1. Write a logical formula from a truth table.2. Check logical equivalence of two logical formulas.3. DeMorgan’s rule and other simple logical rules (e.g. distributive).4. Use simple logical rules to simplify a logical formula.