Download as PPTX, PDF, TXT or read online from Scribd
Download as pptx, pdf, or txt
You are on page 1of 28
Discrete Mathematics
Lecture Slide-3 Sets
Dr. Saeed Mahmud Ullah
Professor, EEE, DU Adjunct Faculty, ECE, EWU Text Book • Discrete Mathematics – Gary Chartrand and Ping Zhang – 2011 • Discrete Mathematics and its Applications – Kenneth H. Rosen – 7th Edition Sets • A set is a collection of objects. • The objects of a set are called the elements of the set. • For example, {x, y, z} is a set consisting of the three elements x, y and z. • We denote the set above by S = {x, y, z} • If a is an element of a set A, then we write a ∈ A. • If b is not an element of A, we write b ∈ A. Therefore, for the set S = {x, y, z}, x ∈ S but wꞠS. • A set need not contain any elements. The set containing no elements is called the empty set/ null set/ void set. The empty set is denoted by ∅. Thus ∅ = { }. • For a finite set A (a set with a finite number of elements), we write | A| to denote the number of elements in A. This is called the cardinality of A. • Therefore, the set S = {x, y, z} that we encountered earlier has cardinality 3 and so |S| = 3. Well-Known Sets of Numbers • The set {. . ., −2, −1, 0, 1, 2, . . .} of integers is often denoted by Z. • The set of positive integers or natural numbers is denoted by N. Thus N = {1, 2, 3, . . .}. • The set of real numbers is denoted by R • A rational number is the ratio a/b of two integers a and b, where b≠0. The set of rational numbers is denoted by Q Subsets Venn Diagrams • It is occasionally convenient to draw a diagram in the plane, called a Venn diagram, to pictorially represent a set or sets under consideration. • A rectangle is often drawn to represent the universal set. Set Operations and Their Properties
• Intersections and Unions
Difference and Symmetric Difference Complement of a Set De Morgan’s Laws Membership Table • Set identities can also be proved using membership tables. • A membership table for a set is similar to a truth table in logic, but it lists elements and indicates whether each element is a member of a given set. • To indicate that an element is in a set, a 1 is used; to indicate that an element is not in a set, a 0 is used. • Here's how a membership table might look for a set A containing some integers. • Let's say: A={1,3,5} Computer Representation of Sets
• In computer science, sets are represented in various ways to enable
efficient storage and operations. • The computer representation of a set depends on the data structure chosen, which varies based on the types of operations (like union, intersection, and membership checking) needed. • We will present a method for storing elements using an arbitrary ordering of the elements of the universal set. This method of representing sets makes computing combinations of sets easy. • Assume that the universal set U is finite (and of reasonable size so that the number of elements of U is not larger than the memory size of the computer being used). First, specify an arbitrary ordering of the elements of U, for instance a1, a2, . . . , an. Represent a subset A of U with the bit string of length n, where the ith bit in this string is 1 if ai belongs to A and is 0 if ai does not belong to A Example 18 Example 19 Example 20