Discrete Mathematics IT223 Sem. 2, SY

Slides:



Advertisements
Similar presentations
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Advertisements

© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Sets DISCRETE STRUCTURE ABDUL BASIT TAHIR, KAMRAN ALI, FAIZAN ILLAHI, NOMAN AHMAD, ARSALAN MUBASHIR.
Discrete Mathematics CSE 2353 Fall 2007
1 Section 1.7 Set Operations. 2 Union The union of 2 sets A and B is the set containing elements found either in A, or in B, or in both The denotation.
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Chapter 2 The Basic Concepts of Set Theory
Sets 1.
CSE115/ENGR160 Discrete Mathematics 02/10/11 Ming-Hsuan Yang UC Merced 1.
Sets 1.
Theoretical Computer Science COMP 335 Fall 2004
Set Theory.
Adapted from Discrete Math
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
Intro to Discrete Structures
1.1 Sets and Logic Set – a collection of objects. Set brackets {} are used to enclose the elements of a set. Example: {1, 2, 5, 9} Elements – objects inside.
Course Outline Book: Discrete Mathematics by K. P. Bogart Topics:
Discrete Mathematics, Part II CSE 2353 Fall 2007 Margaret H. Dunham Department of Computer Science and Engineering Southern Methodist University Some slides.
Chapter 3 – Set Theory  .
Math 240: Transition to Advanced Math Deductive reasoning: logic is used to draw conclusions based on statements accepted as true. Thus conclusions are.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2011 Most slides modified from Discrete Mathematical Structures: Theory and Applications.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Chapter 7 Review Important Terms, Symbols, Concepts 7.1. Logic A proposition is a statement (not a question.
1 ENM 503 Block 1 Algebraic Systems Lesson 2 – The Algebra of Sets The Essence of Sets What are they?
Discrete Structure Sets. 2 Set Theory Set: Collection of objects (“elements”) a  A “a is an element of A” “a is a member of A” a  A “a is not an element.
DISCRETE COMPUTATIONAL STRUCTURES
CS201: Data Structures and Discrete Mathematics I
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
January 30, 2002Applied Discrete Mathematics Week 1: Logic and Sets 1 Let’s Talk About Logic Logic is a system based on propositions.Logic is a system.
CompSci 102 Discrete Math for Computer Science
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2005.
Copyright © Cengage Learning. All rights reserved.
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
ELEMENTARY SET THEORY.
Mathematical Preliminaries
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2010 Most slides modified from Discrete Mathematical Structures: Theory and Applications by D.S. Malik.
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
Chapter 2 With Question/Answer Animations. Section 2.1.
Basic Structures: Sets, Functions, Sequences, and Sums.
(CSC 102) Lecture 13 Discrete Structures. Previous Lectures Summary  Direct Proof  Indirect Proof  Proof by Contradiction  Proof by Contra positive.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
1 CS 140 Discrete Mathematics Combinatorics And Review Notes.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2011 Most slides modified from Discrete Mathematical Structures: Theory and Applications.
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Spring 2009 Most slides modified from Discrete Mathematical Structures: Theory and Applications.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
Chapter 1 Logic and proofs
DISCRETE COMPUTATIONAL STRUCTURES CSE 2353 Fall 2010 Most slides modified from Discrete Mathematical Structures: Theory and Applications by D.S. Malik.
CPCS 222 Discrete Structures I
Dr. Ameria Eldosoky Discrete mathematics
Discrete Mathematics Margaret H. Dunham
Foundations: Sets, Logic, and Algorithms
Chapter 1: Foundations: Sets, Logic, and Algorithms
CHAPTER 3 SETS, BOOLEAN ALGEBRA & LOGIC CIRCUITS
Set, Combinatorics, Probability & Number Theory
Chapter 1 Logic and Proofs Homework 2 Given the statement “A valid password is necessary for you to log on to the campus server.” Express the statement.
DISCRETE COMPUTATIONAL STRUCTURES
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
DISCRETE COMPUTATIONAL STRUCTURES
CS100: Discrete structures
Information Technology Department
CHAPTER 1: LOGICS AND PROOF
2 Chapter Numeration Systems and Sets
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Presentation transcript:

Discrete Mathematics IT223 Sem. 2, SY 2012-13 EDITHA L. HEBRON, CoE, MSIS Information Technology Program CTET, USEP Tagum-Mabini Campus Some slides taken from Margaret H. Dunham, Department of Computer Science and Engineering, Southern Methodist University; Dr. Eric Gossett, Bethel University, St. Paul, Minnesota; Discrete Mathematical Structures: Theory and Applications by D.S. Malik and M.K. Sen

IT223: Discrete mathematics This course deals with the study of DM as a branch of mathematics that deals with arrangements of distinct objects. It includes a wide variety of topics and techniques that arise in everyday life, such as how to find the best route from one city to another, and where the object-representations are arranged in a map. It is used by decision-makers in our society, from workers in government, to those in health care, transportation, and telecommunications. Its various applications help students see the relevance of mathematics in the real world.

Introduction What Is Discrete Mathematics? Examples of its applications in IT: mathematical cryptography, which is based on number theory (the study of positive integers 1,2,3,. . .)  computer security and electronic banking.  linear programming  coding theory, theory of computing,etc

The mathematics in these applications is collectively called discrete mathematics. Discrete Mathematics is a collection of mathematical topics that examine and use finite or countable elements of infinite mathematical objects. What it isn’t: continuous Discrete: consisting of distinct or unconnected elements

I. Sets: Learning Objectives Learn about sets Explore various operations on sets Become familiar with Venn diagrams In IT applications: Learn how to represent sets in computer memory Learn how to implement set operations in programs

Sets Definition: Well-defined collection of distinct objects 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

Basic Notations for Sets Use variables (any capital letter from the alphabet), ex. sets S, T, U,… Denote a set S in writing by listing all of its elements within the curly braces. S={a, b, c} is the set of whatever 3 objects are denoted by a,b,c. A={2,4,6,8} is a set of even nos. greater than 0 bt less than 10..or..even nos. from 2 to 8 Denote a set using Set builder notation:

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* : The set of all nonzero rational numbers Q+ : The set of all positive rational numbers R : The set of all real numbers R* : The set of all nonzero real numbers R+ : The set of all positive real numbers C : The set of all complex numbers C* : The set of all nonzero complex numbers

“X is a subset of Y” is written as X  Y Sets Subsets “X is a subset of Y” is written as X  Y “X is not a subset of Y” is written X Y Example:as 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

Set Equality Empty (Null) Set Sets 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

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 set with 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

If P = {red, blue, yellow}, then |P| = 3 Singleton 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 H = { 4 }, |H| = 1, H is a singleton

An arbitrarily chosen, but fixed set 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

Shaded portion represents the corresponding 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

Set Operations and Venn Diagrams Union of Sets Example: If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, then XY = {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 Example: If X = {a,b,c,d} and Y = {c,d,e,f}, then X – Y = {a,b} and Y – X = {e,f}

Complement 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} a d c f e b Set X Set U Example: If U = {a,b,c,d,e,f} and X = {c,d,e,f}, then = {a,b}

More examples of 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)}

Computer Representation of Sets A Set may be stored in a computer in an array as an unordered list Problem: Difficult to perform operations on the set. Linked List Solution: use Bit Strings (Bit Map) A Bit String is a sequence of 0s and 1s Length of a Bit String is the number of digits in the string Elements appear in order in the bit string A 0 indicates an element is absent, a 1 indicates that the element is present A set may be implemented as a file

Computer Implementation of Set Operations Bit Map File Operations Intersection Union Element of Difference Complement Power Set

The number of Subsets: The empty set has only one subset (namely, itself). A set with a single element, say {a}, has two subsets: the set {a} itself and the empty set ∅. A set with two elements, say {a, b} has four subsets: ∅,{a},{b} and {a, b} the subsets of a set {a, b, c} with 3 elements: ∅,{a},{b},{c},{a, b},{b, c},{a, c},{a, b, c} We can make a little table from these data: Looking at these values, we observe that the number of subsets is a power of 2: if the set has n elements, the result is 2n Number of elements 1 2 3 Number of subsets 4 8

Theorem 2.1 A set with n elements has 2n subsets. Proving by illustration (follow the steps): Select a subset called S. 2. Start from the circle on the top (called a node) 3. Put the question “is a an element of S?” inside the node. 4. Make two arrows going out of the node, labeled with the two possible answers to this question (Yes and No). 5. Make a decision and follow the appropriate arrow (also called an edge) to the node at the other end.

6. Put the next question “is a2 an element of S?” to the newly created node. 7. Follow the arrow corresponding to your answer to the next node, which contains the third (and in this case last) question. 8. Answer the last question “is a3 an element of S?” to determine the subset.

This picture is called a tree. Note: the number of nodes doubles from level to level as we go down, the last level contains 23 = 8 nodes (and if we had an n-element set, it would contain 2n nodes) This picture is called a tree.

{∅},{a},{ab}, {abc}, {ac}, {b}, {bc}, {c}. 6. In making the list of subsets, start with ∅ (null set or empty set), then list all subsets with 1 elements, then list all subsets with 2 elements, etc. 7. For the subsets of {a, b, c}, we get the list {∅},{a},{ab}, {abc}, {ac}, {b}, {bc}, {c}. 8. Use another way of denoting subset, the “bit map” where logic binary digits (bits for short), the 0 and 1, are used 9. Encode subset {a,c} as 101 because a is in the subset, b is not, and c is in it. (continue encoding the other subsets using 3-string of bits 0 and 1)

other words, representations in base 2) 0 = 02 1 = 12 2 = 102 3 = 112 Review: the binary representation of integers (in other words, representations in base 2) 0 = 02 1 = 12 2 = 102 3 = 112 4 = 1002 5 = 1012 6 = 1102 7 = 1112 8 = 10002 9 = 10012 10 = 10102 Note: write subscript of 2 to indicate binary number system

Other topics in Sets: Sequences Theorem 2.2: The number of strings of length n composed of k given elements is kn Theorem 2.3 Suppose that we want to form strings of length n so that we can use any of a given set of k1 symbols as the first element of the string, any of a given set of k2 symbols as the second element of the string, etc., any of a given set of kn symbols as the last element of the string. Then the total number of strings we can form is k1k2  . . .  kn.

2.26 Draw a tree illustrating the way we counted the number of strings of length 2 formed from the characters a, b and c, and explain how it gives the answer. Do thesame for the more general problem when n = 3, k1 = 2, k2 = 3, k3 = 2. 2.27 In a sport shop, there are T-shirts of 5 different colors, shorts of 4 different colors,and socks of 3 different colors. How many different uniforms can you compose fromthese items? 2.28 On a ticket for a succer sweepstake, you have to guess 1, 2, or X for each of 13games. How many different ways can you fill out the ticket? 2.29 We roll a dice twice; how many different outcomes can we have (a 1 followed bya 4 is different from a 4 followed by a 1)? 2.30 We have 20 different presents that we want to distribute to 12 children. It isnot required that every child gets something; it could even happen that we give all thepresents to the same child. In how many ways can we distribute the presents? 2.31 We have 20 kinds of presents; this time, we have a large supply from each. Wewant to give presents to 12 children. Again, it is not required that every child getssomething; but no child can get two copies of the same present. In how many ways canwe give presents?

Permutations Theorem 2.4: The number of permutations of n objects in n!.

Outline Introduction Sets Logic & Boolean Algebra Proof Techniques Counting Principles Combinatorics Relations,Functions Graphs/Trees Boolean Functions, Circuits

Logic: Learning Objectives Learn about statements (propositions) Learn how to use logical connectives to combine statements Explore how to draw conclusions using various argument forms Become familiar with quantifiers and predicates Applications in IT: Boolean data type If statement Impact of negations Implementation of quantifiers

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 Truth value One of the values “truth” (T) or “falsity” (F) assigned to a statement Negation The negation of P, written P , is the statement obtained by negating statement P Example: P: A is a consonant P : it is the case that A is not a consonant Truth Table P P T F F T

Conjunction Mathematical Logic 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 Truth Table for Conjunction: P Q P ^ Q F T

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 and Q is true; otherwise P v Q is false The symbol v is read “or” Truth Table for Disjunction: P Q P ^ Q F T

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 is called the hypothesis, Q is called the conclusion Truth Table for Implication: P Q P ^ Q F T

Mathematical Logic Implication Let P: Today is Sunday and Q: I will wash the car. 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 If today is not Sunday, then I will not wash the car The contrapositive of this implication is 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 if and only if Q” Truth Table for the Biconditional:

Mathematical Logic Precedence of logical connectives is: highest ^ second highest v third highest → fourth highest ↔ fifth highest

Mathematical Logic Tautology Contradiction A statement formula A is said to be a tautology if the truth value of A is T for any assignment of the truth values T and F to the statement variables occurring in A Contradiction A statement formula A is said to be a contradiction if the truth value of A is F for any assignment of the truth values T and F to the statement variables occurring in A

Mathematical Logic Logically Implies A statement formula A is said to logically imply a statement formula B if the statement formula A → B is a tautology. If A logically implies B, then symbolically we write A → B Logically Equivalent A statement formula A is said to be logically equivalent to a statement formula B if the statement formula A ↔ B is a tautology. If A is logically equivalent to B , then symbolically we write A B

Inference and Substitution

Quantifiers and First Order Logic Predicate or Propositional Function Let x be a variable and D be a set; P(x) is a sentence Then P(x) is called a predicate or propositional function with respect to the set D if for each value of x in D, P(x) is a statement; i.e., P(x) is true or false Moreover, D is called the domain (universe) of discourse and x is called the free variable

Quantifiers and First Order Logic Universal Quantifier Let P(x) be a predicate and let D be the domain of the discourse. The universal quantification of P(x) is the statement: For all x, P(x) or For every x, P(x) The symbol is read as “for all and every” or Two-place predicate:

Quantifiers and First Order Logic Existential Quantifier Let P(x) be a predicate and let D be the universe of discourse. The existential quantification of P(x) is the statement: There exists x, P(x) The symbol is read as “there exists” or Bound Variable The variable appearing in: or

Quantifiers and First Order Logic Negation of Predicates (DeMorgan’s Laws) Example: If P(x) is the statement “x has won a race” where the domain of discourse is all runners, then the universal quantification of P(x) is , i.e., every runner has won a race. The negation of this statement is “it is not the case that every runner has won a race. Therefore there exists at least one runner who has not won a race. Therefore:

Two-Element Boolean Algebra The Boolean Algebra on B= {0, 1} is defined as follows: + 0 1 · 0 1 ¯ 0 0 1 0 0 0 0 1 1 1 1 1 0 1 1 0

Duality and the Fundamental Boolean Algebra Properties The dual of any Boolean theorem is also a theorem. Parentheses must be used to preserve operator precedence.

Logic and CS Logic is basis of ALU (Boolean Algebra) Logic is crucial to IF statements AND OR NOT Implementation of quantifiers Looping Database Query Languages Relational Algebra Relational Calculus SQL