1.15k likes | 1.71k Views
Discrete Mathematics. It is assumed that you have studied basics of mathematics before. The slides in this section are for your review. They will not all be covered in class. If you need extra help in this area, a special help session will be scheduled.
E N D
It is assumed that you have studied basics of mathematics before. • The slides in this section are for your review. They will not all be covered in class. • If you need extra help in this area, a special help session will be scheduled. • A small test based on multiple choice questions will help you to analyse yourself
Learning Objectives • Introduction • Sets • Logic & Boolean Algebra • Proof Techniques • Counting Principles • Relations and Functions • Partial Ordered Sets • Group Theory • Graphs and Trees
Introduction • What it isn’t: continuous • Discrete: consisting of distinct or unconnected elements • Countably Infinite • DefinitionDiscrete Mathematics is a collection of mathematical topics that examine and use finite or countably infinite mathematical objects.
Sets • Members or Elements: part of the collection • Roster Method: Description of a set by listing the elements, enclosed with braces • Examples: • Vowels = {a,e,i,o,u} • Primary colors = {red, blue, yellow} • Membership examples • “a belongs to the set of Vowels” is written as: a Vowels • “j does not belong to the set of Vowels: j Vowels ver model involves requests and replies.
Sets • Set-builder method • A = { x | x S, P(x) } or A = { x S | P(x) } • A is the set of all elements x of S, such that x satisfies the property P • Example: • If X = {2,4,6,8,10}, then in set-builder notation, X can be described as X = {n Z | n is even and 2 n 10}
Sets • Standard Symbols which denote sets of numbers • N : The set of all natural numbers (i.e.,all positive integers) • Z : The set of all integers • Z+ : The set of all positive integers • Z* : The set of all nonzero integers • E : The set of all even integers • Q : The set of all rational numbers • Q+ : R : The set of all real numbers
Sets • Subsets • “X is a subset of Y” is written as X Y • “X is not a subset of Y” is written as X Y • Example: • X = {a,e,i,o,u}, Y = {a, i, u} and Z={b,c,d,f,g} Y X, since every element of Y is an element of X • Y Z, since a Y, but a Z
Sets • Superset • X and Y are sets. If X Y, then “X is contained in Y” or “Y contains X” or Y is a superset of X, written Y X • Proper Subset • X and Y are sets. X is a proper subset of Y if X Y and there exists at least one element in Y that is not in X. This is written X Y. • Example: • X = {a,e,i,o,u}, Y = {a,e,i,o,u,y} • X Y , since y Y, but y X
Sets • Set Equality • X and Y are sets. They are said to be equal if every element of X is an element of Y and every element of Y is an element of X, i.e. X Y and Y X • Examples: • {1,2,3} = {2,3,1} • X = {red, blue, yellow} and Y = {c | c is a primary color} Therefore, X=Y • Empty (Null) Set • A Set is Empty (Null) if it contains no elements. • The Empty Set is written as • The Empty Set is a subset of every set
Sets • Finite and Infinite Sets • X is a set. If there exists a nonnegative integer n such that X has n elements, then X is called a finite setwith n elements. • If a set is not finite, then it is an infinite set. • Examples: • Y = {1,2,3} is a finite set • P = {red, blue, yellow} is a finite set • E , the set of all even integers, is an infinite set • , the Empty Set, is a finite set with 0 elements
Sets • Cardinality of Sets • Let S be a finite set with n distinct elements, where n ≥ 0. Then |S| = n , where the cardinality (number of elements) of S is n • Example: • If P = {red, blue, yellow}, then |P| = 3 • Singleton • A set with only one element is a singleton • Example: • H = { 4 }, |H| = 1, H is a singleton
Sets • Power Set • For any set X ,the power set of X ,written P(X),is the set of all subsets of X • Example: • If X = {red, blue, yellow}, then P(X) = { , {red}, {blue}, {yellow}, {red,blue}, {red, yellow}, {blue, yellow}, {red, blue, yellow} } • Universal Set • An arbitrarily chosen, but fixed set
Sets • Venn Diagrams • Abstract visualization of a Universal set, U as a rectangle, with all subsets of U shown as circles. • Shaded portion represents the corresponding set • Example: • In Figure 1, Set X, shaded, is a subset of the Universal set, U
Union Of Sets • Example: If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, then • XUY = {1,2,3,4,5,6,7,8,9
Intersection Of Sets • Example: If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, • then X ∩ Y = {5}
Disjoint sets • Example: If X = {1,2,3,4,} and Y = {6,7,8,9}, then X ∩ Y =
Difference of Sets • Example: If X = {a,b,c,d} and Y = {c,d,e,f}, then X – Y = {a,b} and Y – X = {e,f}
Compliment • Compliment of a Set • The complement of a set X with respect to a universal set U, denoted by , is defined to be • = {x |x U, but x X} • Example: If U = {a,b,c,d,e,f} and X = {c,d,e,f}, then ~X = {a,b}
Sets • Ordered Pair • X and Y are sets. If x X and y Y, then an ordered pair is written (x,y) • Order of elements is important. (x,y) is not necessarily equal to (y,x) • Cartesian Product • The Cartesian product of two sets X and Y ,written X × Y ,is the set • X × Y ={(x,y)|x ∈ X , y ∈ Y} • For any set X, X × = = × X • Example: • X = {a,b}, Y = {c,d} • X × Y = {(a,c), (a,d), (b,c), (b,d)} • Y × X = {(c,a), (d,a), (c,b), (d,b)}
Mathematical Logic • Definition: Methods of reasoning, provides rules and techniques to determine whether an argument is valid • Theorem: a statement that can be shown to be true (under certain conditions) • Example: If x is an even integer, then x + 1 is an odd integer • This statement is true under the condition that x is an integer is true
Mathematical Logic • A statement, or a proposition, is a declarative sentence that is either true or false, but not both • Uppercase letters denote propositions • Examples: • P: 2 is an even number (true) • Q: 7 is an even number (false) • R: A is a vowel (true) • The following are not propositions: • P: My cat is beautiful • Q: My house is big
Mathematical Logic • Negation • The negation of p, written ∼p, is the statement obtained by negating statement p • Truth values of p and ∼p are opposite • Symbol ~ is called “not” ~p is read as as “not p” • Example: • p: A is a consonant • ~p: it is the case that A is not a consonant
Mathematical Logic • Conjunction • Let p and q be statements.The conjunction of p and q, written p ^ q , is the statement formed by joining statements p and q using the word “and” • The statement p∧q is true if both p and q are true; otherwise p ^ q is false
Mathematical Logic • Disjunction • Let p and q be statements. The disjunction of p and q, written p v q , is the statement formed by joining statements p and q using the word “or” • The statement p v q is true if at least one of the statements p or q is true; otherwise p v q is false • The symbol v is read “or”
Mathematical Logic • Implication • Let p and q be statements.The statement “if p then q” is called an implication or condition. • The implication “if p then q” is written p q • p q is read: • “If p, then q” • “p is sufficient for q” • q if p • q whenever p
Mathematical Logic • Implication • Truth Table for Implication: • p is called the hypothesis, q is called the conclusion
Mathematical Logic • Implication • Let p: Today is Sunday and q: I will wash the car. The conjunction p q is the statement: • p q : If today is Sunday, then I will wash the car • The converse of this implication is written q p • If I wash the car, then today is Sunday • The inverse of this implication is ~p ~q • If today is not Sunday, then I will not wash the car • The contrapositive of this implication is ~q ~p • If I do not wash the car, then today is not Sunday
Mathematical Logic • Biimplication • Let p and q be statements. The statement “p if and only if q” is called the biimplication or biconditional of p and q • The biconditional “p if and only if q” is written p q • p q is read: • “p if and only if q” • “p is necessary and sufficient for q” • “q if and only if p” • “q when and only when p”
Mathematical Logic • Biconditional • Truth Table for the Biconditional:
Boolean Algebra • Boolean algebra provides the operations and the rules for working with the set {0, 1}. • We are going to focus on three operations: • Boolean complementation, • Boolean sum, and • Boolean product
Boolean Algebra • The complementis denoted by a bar (on the slides, we will use a minus sign). It is defined by • -0 = 1 and -1 = 0. • The Boolean sum, denoted by + or by OR, has the following values: • 1 + 1 = 1, 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0 • The Boolean product, denoted by or by AND, has the following values: • 1 1 = 1, 1 0 = 0, 0 1 = 0, 0 0 = 0
Boolean Algebra • Definition: Let B = {0, 1}. The variable x is called a Boolean variable if it assumes values only from B. • A function from Bn, the set {(x1, x2, …, xn) |xiB, 1 i n}, to B is called a Boolean function of degree n. • Boolean functions can be represented using expressions made up from the variables and Boolean operations
Boolean Algebra • The Boolean expressions in the variables x1, x2, …, xn are defined recursively as follows: • 0, 1, x1, x2, …, xn are Boolean expressions. • If E1 and E2 are Boolean expressions, then (-E1), (E1.E2), and (E1 + E2) are Boolean expressions. • Each Boolean expression represents a Boolean function. The values of this function are obtained by substituting 0 and 1 for the variables in the expression.
Boolean Functions and Expressions • For example, we can create Boolean expression in the variables x, y, and z using the “building blocks”0, 1, x, y, and z, and the construction rules: • Since x and y are Boolean expressions, so is xy. • Since z is a Boolean expression, so is (-z). • Since xy and (-z) are expressions, so is xy + (-z).
Boolean Functions and Expressions • Example: Give a Boolean expression for the Boolean function F(x, y) as defined by the following table: Possible solution: F(x, y) = (-x)y
Basic Identities of Boolean Algebra • x + 0 = x • x · 0 = 0 • x + 1 = 1 • x · 1 = 1 (5) x + x = x (6) x · x = x (7) x + x’ = x (8) x · x’ = 0 (9) x + y = y + x (10) xy = yx
Duality Duality Principle – every valid Boolean expression (equality) remains valid if the operators and identity elements are interchanged, as follows: • + . • 1 0 Example: Given the expression • a + (b.c) = (a+b).(a+c) • then its dual expression is • a . (b+c) = (a.b) + (a.c)
Standard Forms Certain types of Boolean expressions lead to gating networks which are desirable from implementation viewpoint. Two Standard Forms: Sum-of-Products and Product-of-Sums Literals: a variable on its own or in its complemented form. Examples: x, x' , y, y' Product Term: a single literal or a logical product (AND) of several literals. • Examples: x, x.y.z', A'.B, A.B, e.g'.w.v
Standard Forms Sum Term: a single literal or a logical sum (OR) of several literals. • Examples: x, x+y+z', A'+B, A+B, c+d+h'+j Sum-of-Products (SOP) Expression: a product term or a logical sum (OR) of several product terms. • Examples: x, x+y.z', x.y'+x'.y.z, A.B+A'.B', A + B'.C + A.C' + C.D Product-of-Sums (POS) Expression: a sum term or a logical product (AND) of several sum terms. • Examples: x, x.(y+z'), (x+y').(x'+y+z), (A+B).(A'+B'), (A+B+C).D'.(B'+D+E')
Proof Techniques • Learn various proof techniques • Direct • Indirect • Contradiction • Induction
Proof Techniques • Theorem • Statement that can be shown to be true (under certain conditions) • Typically Stated in one of three ways • As Facts • As Implications • As Biimplications
Proof Techniques • Direct Proof or Proof by Direct Method • Proof of those theorems that can be expressed in the form ∀x (P(x) → Q(x)), D is the domain of discourse • Select a particular, but arbitrarily chosen, member a of the domain D • Show that the statement P(a) → Q(a) is true. (Assume that P(a) is true • Show that Q(a) is true • By the rule of Choose Method (Universal Generalization), ∀x (P(x) → Q(x)) is true
Proof Techniques • Indirect Proof • The implication P → Q is equivalent to the implication ( Q → P) • Therefore, in order to show that P → Q is true, one can also show that the implication ( Q → P) is true • To show that ( Q → P) is true, assume that the negation of Q is true and prove that the negation of P is true
Proof Techniques • Proof by Contradiction • Assume that the conclusion is not true and then arrive at a contradiction • Example: Prove that there are infinitely many prime numbers • Proof: • Assume there are not infinitely many prime numbers, therefore they are listable, i.e. p1,p2,…,pn • Consider the number q = p1p2…pn+1. q is not divisible by any of the listed primes • Therefore, q is a prime. However, it was not listed. • Contradiction! Therefore, there are infinitely many primes.
Proof Techniques • Proof of Biimplications • To prove a theorem of the form ∀x (P(x) ↔ Q(x )), where D is the domain of the discourse, consider an arbitrary but fixed element a from D. For this a, prove that the biimplication P(a) ↔ Q(a) is true • The biimplication P↔ Q is equivalent to (P→ Q) ∧ (Q → P) • Prove that the implications P→ Q and Q → Pare true • Assume that Pis true and show that Q is true • Assume that Q is true and show that Pis true