[PDF] [PDF] DISCRETE MATHEMATICS FOR COMPUTER SCIENCE

Discrete Mathematics for Computer Science Key College Publishing, Emeryville , Cali- fornia, 2006 Examinations There will be a final exam (covering the



Previous PDF Next PDF





[PDF] Mathematics for Computer Science

Department of Electrical Engineering and Computer Science and the Computer Science The standard procedure for establishing truth in mathematics was invented by Eu http://oldwww acm org/pubs/membernet/stories/floyd pdf written by 



[PDF] Mathematics for Computer Science - courses - MIT

genuine understanding Proofs also play a growing role in computer science; they A mathematical proof of a proposition is a chain of logical deductions leading to the http://oldwww acm org/pubs/membernet/stories/floyd pdf written by his 



[PDF] Mathematics for Computer Science Eric Lehman and Tom Leighton

Graphs are the most useful mathematical objects in computer science The probability density function ( pdf ) for a random variable R with codomain V is a



[PDF] Mathematics for Computer Scientists - UK FTVS

Mathematics for Computer Scientists 4 Contents Contents Introduction 5 1 Numbers 6 2 The statement calculus and logic 20 3 Mathematical Induction 35



[PDF] Discrete Mathematics For Computer Science - Skyline University

Chapters 1 and 8 of Mathematics for Computer Science by E Lehman, F T Leighton, Web link: math stanford edu/∼lekheng/flt/kleiner pdf Further reading : 



[PDF] Discrete Mathematics For Computer Science

6 mar 2014 · Chapters 1 and 8 of Mathematics for Computer Science by E Lehman, F T Leighton, Web link: math stanford edu/∼lekheng/flt/kleiner pdf



[PDF] Mathematics for Computer Science Facts & Formulae - Mathcentre

Mathematics for Computer Science Facts Formulae mathcentre is a project offering students and staff free resources to support the transition from



[PDF] Discrete Mathematics For Computer Scientists cepuneporg

Rather than enjoying a good PDF subsequent to a mug of coffee in the afternoon, on the other hand they juggled bearing in mind some harmful virus inside their 



[PDF] Discrete Mathematics For Computer Science wwwcepuneporg

Fundamentals of Discrete Math for Computer Science-Tom Jenkyns 2012-10-16 the mathematical foundation of computer science Discrete mathematics is the basis of much of Read Online Discrete Mathematics For Computer Science pdf



[PDF] DISCRETE MATHEMATICS FOR COMPUTER SCIENCE

Discrete Mathematics for Computer Science Key College Publishing, Emeryville , Cali- fornia, 2006 Examinations There will be a final exam (covering the

[PDF] mathematics journals

[PDF] mathématiques appliquées à l'économie pdf

[PDF] mathématiques appliquées a l'informatique

[PDF] mathématiques appliquées à la gestion

[PDF] mathématiques appliquées a la gestion pdf

[PDF] mathématiques appliquées à la gestion pdf gratuit

[PDF] mathématiques appliquées à la médecine

[PDF] maths 9th ncert solutions chapter 9

[PDF] maths class 9 herons formula extra questions

[PDF] maths elevations

[PDF] maths libres fractions décimales

[PDF] maths libres les fractions

[PDF] maths quiz questions with answers for class 7 pdf

[PDF] maths syllabus in uae

[PDF] matlab 2 dimensional fourier transform

CPS 102

DISCRETE MATHEMATICS

FOR COMPUTER SCIENCE

Spring 2009

Co-instructors:Herbert EdelsbrunnerandBrittany Fasy

CPS 102Spring Semester of 2009

Table of Contents

Introduction 3

I COUNTING4

1 Sets and Lists 5

2 Binomial Coefficients 8

3 Equivalence Relations 10

Homework Assignments 12

II NUMBERTHEORY13

4 Modular Arithmetic 14

5 Inverses 16

6 Euclid's Algorithm 18

7 RSA Cryptosystem 20

Homework Assignments 22

III LOGIC23

8 Boolean Algebra 24

9 Quantifiers 27

10 Inference 29

Homework Assignments 31IV INDUCTION32

11 Mathematical Induction 33

12 Recursion 35

13 Growth Rates 37

14 Solving Recurrence Relations 39

Homework Assignments 41

V PROBABILITY42

15 Inclusion-Exclusion 43

16 Conditional Probability 45

17 Random Variables 47

18 Probability in Hashing 49

19 Probability Distributions 51

Homework Assignments 53

VI GRAPHS54

20 Trees 55

21 Tours 58

22 Matching 60

23 Planar Graphs 63

Homework Assignments 66

2 IntroductionMeetings.We meet twice a week for lectures, on Mon- day and on Wednesday, from 2:50 to 4:05pm, in room D243 LSRC. We also have a recitation each week on Fri- day, same time and room as the lectures. Communication.The course material will be delivered in the two weekly lectures. A written record of the lec- tures will be available on the web, usually a day after the lecture. The web also contains other information, such as homework assignments, solutions, useful links, etc. The main supporting text is

BOGART, STEIN, DRYSDALE.Discrete Mathematics for

Computer Science.Key College Publishing, Emeryville, Cali- fornia, 2006. Examinations.There will be a final exam (covering the material of the entire semester) and two midterm. The weighting of participation, exams, and homework used to determine your grades is class participation 10%, homework 30%, midterms 30%, final 30%.

Homework.We have six homeworks scheduled

throughout this semester, one per main topic covered in the course. The solutions to each homework are due one and a half weeks after the assignment. More precisely, they are due at the beginning of the third lecture after the assignment. The sixth homework may help you prepare for the final exam and solutions will not be collected.

RULE1. The solution to any one homework question

must fit on a single page (together with the statement of the problem).

RULE2. Thediscussionofquestionsandsolutionsbefore

the due date is not discouraged, but you must formu- late your own solution. RULE3. The deadline for turning in solutions is 10 min-

utes afterthe beginningof the lecture onthe due date.Overview.Discrete mathematics provides concepts that

are fundamental to computer science but also other dis- ciplines. This course emphasizes the computer science connectionthrough the selection and motivation of topics, which are grouped in six major themes:

I Counting;

II Number Theory;

III Logic;

IV Induction;

V Probability;

VI Graphs.

3

I COUNTING

Counting things is a central problem in Discrete Mathematics. Once we can count, we can determine the likelihood of a

particular even and we can estimate how long a computer algorithm takes to complete a task.

1 Sets and Lists

2 Binomial Coefficients

3 Equivalence Relations

Homework Assignments

4

1 Sets and ListsSets and lists are fundamental concepts that arise in var-ious contexts, including computer algorithms. We studybasic counting problems in terms of these concepts.Sorting.A common computational task is to rearrange

elements in order. Given a linear arrayA[1..n]of integers, fori= 1ton-1do forj=i+ 1downto2do ifA[j]> A[j-1]then aux=A[j];A[j] =A[j-1];A[j] =aux endif endfor endfor. We wish to count the number of comparisons made in this algorithm. For example, sorting an array of five elements uses15comparisons. In general, we make1 + 2 +···+ (n-1) =?n-1 i=1icomparisons. Sums.We now derive a closed form for the above sum by adding it to itself. Arranging the second sum in reverse order and adding the terms in pairs, we get [1 + (n-1)] +...+ [(n-1) + 1] =n(n-1). Since each number of the original sum is added twice, we divide by two to obtain n-1? i=1i=n(n-1) 2. As with many mathematical proofs, this is not the only way to derive this sum. We can think of the sum as two setsofstairsthatstacktogether,asinFigure1. Atthebase, we haven-1gray blocks and one white block. At each level, one more block changes from gray to white, until we have one gray block andn-1white blocks. Together, the stairs form a rectangle dividedinton-1bynsquares, with exactlyhalf the squares grayand the otherhalf white.

Thus,?ni=1i=n(n-1)

2, same as before. Notice that this

sum can appear in other forms, for example, n-1? i=1i= 1 + 2 +...+ (n-1) = (n-1) + (n-2) +...+ 1 n-1? i=1(n-i). Figure 1: The number of squares in the grid is twice the sum from1to8. Sets.Asetis an unordered collection of distinct ele- ments. Theunionof two sets is the set of elements that are in one set or the other, that is,A?B={x|x? Aorx?B}. Theintersectionof the same two sets is the set of elements that are in both, that is,A∩B={x| x?Aandx?B}. We say thatAandBare disjoint if A∩B=∅. Thedifferenceis the set of elements that be- long to the first but not to the second set, that is,A-B= {x|x?Aandx??B}. Thesymmetric differenceis the set of elements that belong to exactly one of the two sets, that is,A?B= (A-B)?(B-A) = (A?B)-(A∩B). Look at Figure 2 for a visual description of the sets that Figure 2: From left to right: the union, the intersection, the dif- ference, and the symmetric difference of two sets represented as disks in the plane. result from the four types of operations. The number of elements in a setAis denoted as|A|. It is referred to as thesizeor thecardinalityofA. The number of elements in the union of two sets cannot be larger than the sum of the two sizes. ifAandBare disjoint. To generalize this observation to more than two sets, we call the setsS1,S2,...,SmacoveringofS=S1?S2? ...?Sm. IfSi∩Sj=∅for alli?=j, then the covering 5 is called apartition. To simplify the notation, we write?mi=1Si=S1?S2? ··· ?Sm.

SUMPRINCIPLE2. LetS1,S2,...,Smbe a covering

ering is a partition.

Matrix multiplication.Another common computa-

tional task is the multiplication of two matrices. As- suming the first matrix is stored in a two-dimensional arrayA[1..p,1..q]and the second matrix is stored in B[1..q,1..r], we match up rows ofAwith the columns ofBand form the sum of products of corresponding ele- ments. For example, multiplying

A=?1 3 20 2 4?

with B=?? 0 2 3 1 2 5

4 0 1??

results in

C=?11 8 2018 4 14?

The algorithm we use to getCfromAandBis described

in the following pseudo-code. fori= 1topdo forj= 1tordo

C[i,j] = 0;

fork= 1toqdo

C[i,j] =C[i,j] +A[i,k]·B[k,j]

endfor endfor endfor. We are interested in counting how many multiplications the algorithm takes. In the example, each entry of the re- sult uses three multiplications. Since there are six entries inC, there are a total of6·3 = 18multiplications. In general, there areqmultiplications for each ofprentries of the result. Thus, there arepqrmultiplications in total.

We state this observation in terms of sets.

PRODUCTPRINCIPLE1. LetS=?mi=1Si. If the sets

S

1,S2,...,Smform a partition and|Si|=nfor each

is also the row numberinB, and the column numberinB. There areppossibilities for the first number,qfor the sec- ond,andrforthethirdnumber. We generalizethismethod as follows.

PRODUCTPRINCIPLE2. IfSis a set of lists of length

|S|=i1·i2·...·im=?mj=1ij. We can use this rule to count the number of cartoon char- acters that can be created from a book giving choices for head, body, and feet. If there arepchoices for the head,q choices for the body, andrchoices for the legs, then there arepqrdifferent cartoon characters we can create.

Number of passwords.We apply these principles to

count the passwords that satisfy some conditions. Sup- pose a valid password consists of eight characters, each a digit or a letter, and there must be at least two digits. To countthe numberof valid passwords, we first count the straint:(26+10)8= 368. Now,we subtractthenumberof passwords that fail to meet the digit constraint, namely the passwords with one or no digit. There are268passwords without any digits. To count the passwords with exactly one digit, we note that there are267ways to choose an ordered set of7letters,10ways to choose one digit, and8 places to put the digit in the list of letters. Therefore,there are267·10·8passwords with only one digit. Thus, there are368-268-267·10·8valid passwords. Lists.Alistis an ordered collection of elements which are not necessarily different from each other. We note two differences between lists and sets: (1) a list is ordered, but a set is not; (2) a list can have repeated elements, but a set can not. Lists can be expressed in terms of another mathematical concept in which we map elements of one set to elements of another set. Afunctionffrom adomainDto arange R, denoted asf:D→R, associates exactly one element inRto each elementx?D. A list ofkelements is a function{1,2,...,k} →R. For example, the function in Figure 3 corresponds to the lista,b,c,b,z,1,3,3. We can use the Product Principle 2 to count the number of differ- ent functions from a finite domain,D, to a finite range,R. 6

87654321a

b c d 1 2 3 z f D R

Figure 3: A function representing a list.

Specifically, we have a list of length|D|with|R|possi- bilities for each position. Hence, the number of different functions fromDtoRis|R||D|. Bijections.The functionf:D→Risinjectiveorone- to-oneiff(x)?=f(y)for allx?=y. It issurjectiveor ontoif for everyr?R, there exists somex?Dwith f(x) =r. The function isbijectiveor aone-to-one corre- spondenceif it is both injective and surjective.

BIJECTIONPRINCIPLE. Two setsDandRhave the

samesize ifandonlyif thereexists abijectionf:D→R. Thus, asking how many bijections there are fromDtoR only makes sense if they have the same size. Suppose this size is finite, that is,|D|=|R|=n. Then being injective is the same as being bijective. To count the number of bijections, we assign elements ofRto elements ofD, in sequence. We havenchoices for the first element in the domain,n-1choices for the second,n-2for the third, and so on. Hence the number of different bijections from

DtoRisn·(n-1)·...·1 =n!.

Summary.Today, we began with the building blocks of counting: sets and lists. We went through some examples using the sum and product principles: counting the num- ber of times a loop is executed, the number of possible passwords, and the number of combinations. Finally, we talked about functions and bijections. 7

2 Binomial CoefficientsIn this section, we focus on counting the number of wayssets and lists can be chosen from a given set.Permutations.Apermutationis a bijectionfroma finite

setDto itself,f:D→D. Forexample,thepermutations of{1,2,3}are:123,132,213,231,312, and321. Here we list the permutations in lexicographic order, same as they would appear in a dictionary. Assuming|D|=k, there arek!permutations or, equivalently,orderings of the set. To see this, we note that there arekchoices for the first element,k-1choices for the second,k-2for the third, and so on. The total number of choices is therefore k(k-1)·...·1, which is the definition ofk!. mutationis an injection{1,2,...,k} →N. In other words, ak-element permutation is a list ofkdistinct el- ements fromN. For example, the3-element permutationsquotesdbs_dbs17.pdfusesText_23