Discrete mathematics Lecture 1 Intro to Discrete mathematics Proposition “ Respect all in your class Marks Distribution Marks Final Term 50% Quizes 10% Assignments 20% Assignments Mid term 20% 3 Quizes Mid term Final Term Contact me lailanadeem.bukc@bahria.edu.pk 4 Timeline 5 18th September, 23 20th November, 23 Start of semester Course after mid 13th November, 23 15th January, 23 Midterm Final Term Course Outline of discrete mathematics ( discrete structures) 01. Mathematical reasoning 02. Basic Structures propositional and predicate logic, rules of inference, proof by induction, proof by contraposition, proof by contradiction, proof by implication, Sets, Functions, Relation, Sequences, Sums 03. Induction and Recursion 04. Counting 05. Graphs and Trees Mathematical Induction, Recursive Algorithms The Basics of Counting, The Pigeonhole Principle, Permutations and Combinations Graphs and Graph Models, Graph Terminology and Special Types of Graphs, Representing Graphs and Graph Isomorphism, Connectivity, Euler and Hamilton Paths, Shortest-Path Problems, Introduction to Trees, Applications of Trees, Tree Traversal, Spanning Tree 6 Book Lets start the content Introduction Discrete mathematics is the part of mathematics devoted to the study of discrete objects 9 Discrete Structures/Mathematics Discrete mathematics deals with objects that come in discrete bundles,e.g.,1 or 2 b o o k s Continuous mathematics deals with objects that vary continuously, e.g., 3.42 inches from a wall. 10 Why Discrete Mathematics? • The basis of all of digital information processing is: Discrete manipulations of discrete structures represented in memory. • 11 It’s the basic language and conceptual foundation for all of computer science. Logic and Proofs Logic is study of reasoning e.g A>B>C So we can say that A>C 12 Proposition 13 Examples 14 Examples 15 Test • 2+ 2 = 4 • X + y =4 • Are you hungry? Proposition No No • I am Happy Proposition • It is raining today. proposition 16 Propositional logic The area of logic that deals with the proposition is called propositional logic 17 compound propositions Many mathematical statements are constructed by combining one or more propositions, called compound propositions, formed from existing propositions using logical operators. 18 example Simple propositions p: “A student who has taken calculus can take this class” q: “A student who has taken introductory computer science can take this class. Compound Proposition “Students who have taken calculus or introductory computer science can take this class” 19 Boolean operators 20 negation “Michael’s PC runs Linux” “Vandana’s “It is not the case that Michael’s PC runs Linux.” This negation can be more simply expressed as “Michael’s PC does not run Linux.” ???? 21 memory” smartphone has at least 32 GB of Truth table for negation 22 conjunction Let p and q be propositions. The conjunction of p and q, denoted by p ∧ q, is the proposition “p and q.” The conjunction p ∧ q is true when both p and q are true and is false otherwise. 23 • p: necessary to pass discrete mathematics • q: necessary to pass English • p ∧ q: • Truth table disjunction Let p and q be propositions. The disjunction of p and q, denoted by p ∨ q, is the proposition “p or q.” The disjunction p ∨ q is false when both p and q are false and is true otherwise. It is “inclusive or” means true when both true 24 • p: necessary to pass discrete mathematics • q: necessary to pass English • p ∨ q: • Truth table Natural language is ambiguous • p: Leena is a singer • q: Leena is a writer • p or q: Note that English “or” can be ambiguous regarding the “both” case Need context to disambiguate the meaning 25 • p: Leena is a man • q: Leena is a woman • p or q: Exclusive or operator 26 example • p: “A student can have a salad with dinner” • q: “A student can have soup with dinner,” •pVq •p⊕q 27 The implication operator • p: I am elected • q: I will lower taxes The conditional statement p → q is the proposition • If I am elected, then I will lower taxes “if p, then q.” The conditional statement p → q is false when p is true and q is false, and true otherwise. p is called the hypothesis (premise) q is called the conclusion (or consequence) 28 p q P -> q example “If it is sunny, then we will go to the beach” 29 “If Maria learns discrete mathematics, then she will find a good job.” There are many other ways to express this conditional statement in English. Among the most natural of these are • “Maria will find a good job when she learns discrete mathematics.” • “For Maria to get a good job, it is sufficient for her to learn discrete mathematics.” and • “Maria will find a good job unless she does not learn discrete mathematics.” CONVERSE, CONTRAPOSITIVE, AND INVERSE If it is raining, then the home team wins If p then q…….. p q Converse If q then p The proposition q → p is called the converse of p → q. The contrapositive of p → q is the proposition ¬q → ¬p. Contrapositive -q -p The proposition ¬p → ¬q is called the inverse of p → q Inverse -p -q 30 • “You can take the flight if and only if you buy a ticket.” BICONDITIONALS Let p and q be propositions. The biconditional statement p ↔ q is the proposition “p if and only if q.” The biconditional statement p ↔ q is true when p and q have the same truth values, and is false otherwise. Biconditional statements are also called bi-implications 31 Truth Tables of Compound Propositions • (p ∨ ¬q) → (p ∧ q). p Construct the truth table of the compound proposition (p ∨ ¬q) → (p ∧ q). 32 q -q p ∨ ¬q p∧ q (p ∨ ¬q) → (p ∧ q). Precedence of Logical Operators Negation 33 Conjunction Disjunction Implication Biconditional Logic and Bit Operations Computers represent information using bits. A bit is a symbol with two possible values, namely, 0 (zero) and 1 (one). This meaning of the word bit comes from binary digit, because zeros and ones are the digits used in binary representations of numbers. 34 • Table for bit operator Truth value bits T F 1 0 x y 1 1 1 0 0 1 0 0 x∨y x∧y X⊕y example Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings 01 1011 0110 and 11 0001 1101. 35 Exercise 1.1 Q.1 to 40 36 37