23
Discrete Discrete Structures Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Embed Size (px)

Citation preview

Page 1: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Discrete Discrete StructuresStructures

By: Tony ThiBy: Tony Thi

Aaron MoralesAaron Morales

CS 490CS 490

Page 2: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

SETS:

-Sets are a collection of object

NOTATIONS: belongs to/element of a set

does not belong to/ is not an element of a set

empty set

U universal set

subset

Page 3: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Definitions:

A.) Equality of Sets: Two sets are equal if and only if they have the same elements.

A = B if and only if x [x A x B].

Ex: A = { 2, 4, 6 } B = { 2, 4, 6 }

B.) Subsets: For any sets A and B, A is a subset of B if and only if x [ x A x B ].

AB

Ex: A = { 1, 3} B = {1, 2, 3, 4, 5, 6}

C.) Proper Subset: AB . A is a subset of B, but A B

Page 4: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

D.) Cardinality: If a set S has n, distinct elements for some natural number n, n is the cardinality (size) of S and S is a finite set. The cardinality of a set is denoted by |S|.

Ex: S = { 1, 3, 5, 7, 9}

|S| = 5

E.) Power Set: the set of all subsets of a set S is called the power set of S

and is denoted by 2|S| of (S).

Ex: S = { 1, 5 }, P(S) = { {}, {1}, {5}, {1,5} }

Page 5: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

F.) Empty Set: A set which has no elements is called an

empty set.

Ex: S = { }

G.) Universal Set: a set which has all the elements in the universe of

discourse.

Page 6: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

SET OPERATIONS:

A.) Union of Sets:

Def. The union of sets A and B,

denoted by A B, is the set defined as

A B = { x | x A x B }

Ex: If A = { 1, 2, 3 } and B = { 3, 4, 5}, then

A B = { 1, 2, 3, 4, 5 }

Page 7: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

B.) Intersection of Sets:

Def. The intersection of sets A and B,

denoted by A B, is the set defined as

A B = { x | x A x B }

Ex: If A = { 1, 2, 3 } and B = { 3, 4, 5}, then

A B = {3}

Page 8: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

C.) Difference: the difference of sets A & B,

denoted by A – B is the set defined as

A – B = { x | x A x B }

Ex: A = { 1, 2, 3, 4, 5 }

B = { 3, 5, 7}

A – B = { 1, 2, 4 }

NOTE: Generally, A – B B – A

Page 9: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

D.) Complement: Given a universal set U and a subset X of U, the

set U – X is called the

complement of X.

Ex. U ={ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }

X = { 1, 2, 3, 4, 5 }

Complement of X = {6, 7, 8, 9 ,10}

Page 10: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

II.) Discrete Probability

An experiment is an process that yields and outcome.

An event is an outcome or combination of outcomes from and experiment.

The sample space is the event consisting of all possible outcomes.

Page 11: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

The probability P(E) of an event E from the finite sample space S is

P(E) = |E| / |S|

Ex: Two fair dice are rolled. What is the

probability that the sum of the

numbers on the dice is 10?

Page 12: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Ans:

The 1st die can be any one of the 6 numbers.

The 2nd die can also be one of the 6 numbers.

6 x 6 = 36 possible combinations

S ={(1,1), (1,2), (1,3), (1,4), (1,5), (1,6),

(2,1), (2,2), (2,3), (2,4), (2,5), (2,6),

(3,1), (3,2), (3,3), (3,4), (3,5), (3,6),

(4,1), (4,2), (4,3), (4,4), (4,5), (4,6),

(5,1), (5,2), (5,3), (5,4), (5,5), (5,6),

(6,1), (6,2), (6,3), (6,4), (6,5), (6,6) }

Page 13: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

E = { (4,6), (5,5), (6,4) }

So,

P(E) = |E| / |S|

= 3 / 36

= 1/ 12

Page 14: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Let E1 E2 be events, then

P(E1 E2 ) = P(E1) + P(E2) - P(E1 E2 )

Ex: Two fair dice are rolled, what is the

probability of getting doubles ( 2

dice showing the same number ) or a

sum of 6?

Page 15: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Let E1 = event of getting “doubles”

Let E2 = event of a sum of 6.

P(E1) = 6/36

= 1/ 6

There are 5 ways to get a sum of 6:

[(1,5), (2,4), (3,3), (4,2), (5,1)]

P(E2) = 5/36

Page 16: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

The event E1 E2 is “getting doubles AND getting a sum of 6.

P(E1 E2 ) = 1/ 36

Hence,

P(E1 E2 ) = P(E1) + P(E2) - P(E1 E2 )

= 6/36 + 5/36 – 1/36

= 10/36

= 5/18

Page 17: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Events E1 and E2 are mutually exclusive

E1 E2 =

P(E1 E2 ) = P(E1) + P(E2)

Conditional Probability: A probability given that some event has occurred.

Def: Let E and F be events and P(F) > 0.

The conditional probability of E given F is P( E | F ) = P(EF) / P(F)

Page 18: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Ex: Suppose that among all of the freshmen of an engineering college took calculus and discrete math last semester. 70% of the students passed calculus, 55% passed discrete math, and 45% passed both. If a randomly selected freshmen is found to have passed calculus last semester, what is the probability that he or she also passed discrete math last semester?

Page 19: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

P( E | F ) = P(EF) / P(F)

Let E = event that the student passed discrete math

Let F = event that the student passed calculus

P(E) = 0.55

P(EF) = 0.45

P(F) = 0.70

P( E | F ) = 0.45 /0.70

Page 20: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Recurrence Relation: a recurrence relation for

a sequence

a0, a1, . . . is an equation that relates an to certain of its predecessors a0, a1, . . ., an-1

Page 21: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Ex. Consider the following instructions for generating a sequence:

1. Start with 5

2. Given any term, add 3 to get the next

term,

If we list the terms of the sequence, we obtain

5, 8, 11, 14, 17, . . .

Page 22: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

The Fibonacci sequence is defined by the recurrence relation

fn = fn-1 + fn-2 , n 3

and the initial conditions

f1 = 1

f2 = 2

1, 2, 3, 5, 8, 13, . . .

Page 23: Discrete Structures By: Tony Thi By: Tony Thi Aaron Morales Aaron Morales CS 490 CS 490

Source:

Johnsonbaugh, R. (2001). Discrete Mathematics (5th ed.). Prentice-Hall , Inc.