You are on page 1of 38

Unit 1 – Basic Discrete Structures

Sets
 A set in discrete structure is an unordered collection of distinct objects
 The objects in a set are called its elements
 Sets are often denoted by capital letters, such as A, B, and C
 The elements of a set can be anything, including numbers, letters, symbols, or even other
sets
 There are many different types of sets, but some of the most common include:
 Finite sets: Sets with a finite number of elements. For example, the set of all even
numbers between 1 and 10 is a finite set
 Infinite sets: Sets with an infinite number of elements. For example, the set of all
natural numbers is an infinite set
 Power sets: The set of all subsets of a given set. For example, the power set of the set
{1, 2, 3} is the set of all sets that can be formed by choosing zero or more elements
from {1, 2, 3}
 Empty set: The set that contains no elements. The empty set is often denoted by the
symbol {}
Sets (contd)
 Sets can be manipulated using a variety of operations, such as union, intersection,
difference, and complement
 These operations are used to combine sets, compare sets, and find the difference between
sets
 Sets are a fundamental concept in discrete mathematics, and they are used in many
different areas of mathematics, including computer science, logic, and probability
 Here are some examples of sets in discrete structure:
 The set of all even numbers between 1 and 10: {2, 4, 6, 8, 10}
 The set of all natural numbers: {0, 1, 2, 3, ...}
 The power set of the set {1, 2, 3}: {{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}
 The empty set: {}
Set Identities
Name Identity
Identity Law A∪∅=A A∩U=A
Domination Law A∪U=U A∩ ∅=∅
Idempotent Law A∪A=A A∩A=A
Complementation Law A’’ = A
Commutative Law A∪B=B∪A A∩B=B∩A
A ∪ (B ∪ C) = (A ∪ B) ∪ C
Associative Law
A ∩ (B ∩ C) = (A ∩ B) ∩ C
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Distributive Law
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
De Morgan’s law (A ∩ B)’ = A’ ∪ B’ (A ∪ B)’ = A’ ∩ B’
Absorption Law A ∪ (A ∩ B) = A A ∩ (A ∪ B) = A
Complement Law A ∩ A’ = ∅ A ∪ A’ = U
Inclusion-Exclusion Principle
Computer representation of sets
Functions
 A function in discrete mathematics is a rule that assigns each element of a set, called the
domain, to exactly one element of a second set, called the co-domain
 The function is often denoted by f: X → Y, where X is the domain, Y is the co-domain, and
f is the name of the function
 For example, the function f(x) = x^2 assigns each real number x to its square
 The domain of this function is the set of all real numbers, and the co-domain is the set of
all real numbers
 Functions are an important part of discrete mathematics, and they are used in many
different areas, including computer science, algorithms, and combinatorics.
Functions (contd.)

Student = {Ram, Shyam, Hari, Sita, Gita}


GPA = {A+, A, B, A, B+}

F(Ram) = A+
Injective Function

 A function f is called one-to-one, or an injection, if f(x) ≠ f(y) whenever x ≠ y


 No two elements in x should map with single element of y. So, |x| <= |y|
 Write down all the functions from the two-element set {1, 2} to the two element set {a, b}
 To describe a function fi from {1, 2} to {a, b}, we have to specify fi(1) and fi(2). We can write
f1(1) = a f1(2) = b
f2(1) = b f2(2) = a
f3(1) = a f3(2) = a
f4(1) = b f4(2) = b
Surjective Function

 A function f is called onto, or a surjection, if every element y in the range is f(x) for some x
in the domain
 Each element of y is mapped with at least one element of x. So, |x| >= |y|

 If one-to-one then onto? NO


 If onto then one-to-one? NO
Bijective Functions

 A function f is bijection, if a function is both one-to-one and onto

 |x| = |y|
Injections
Definition: A function f is said to be one-to-one , or
injective, if and only if f(a) = f(b) implies that a = b for
all a and b in the domain of f. A function is said to be
an injection if it is one-to-one.

Surjections
Definition: A function f from A to B is called onto or
surjective, if and only if for every element there is an
element with. A function f is called a surjection if it is
onto.

Bijections
Definition: A function f is a one-to-one correspondence, or
a bijection, if it is both one-to-one and onto (surjective and
injective).
Inverse Function
Composite Function
The Graphs of Functions

We can associate a set of pairs in A × B to each function from A to B. This set of pairs is called
the graph of the function and is often displayed pictorially to aid in understanding the behavior
of the function.

Let f be a function from the set A to the set B. The graph of the function f is the set of
ordered pairs {(a, b) | a ∈ A and f (a) = b}.
Check weather surjective or not?
a/2
The Graphs of Functions

Smallest

Highest
Boolean Function
Exponential Function
Types of Relation

 Empty Relation: A relation R on a set A is called Empty if the set A is empty set.
 Full Relation: A binary relation R on a set A and B is called full if AXB.
 Reflexive Relation: A relation R on a set A is called reflexive if (a,a) € R holds for every
element a € A .i.e. if set A = {a,b} then R = {(a,a), (b,b)} is reflexive relation.
 Irreflexive relation : A relation R on a set A is called reflexive if no (a,a) € R holds for
every element a € A.i.e. if set A = {a,b} then R = {(a,b), (b,a)} is irreflexive relation.
 Symmetric Relation: A relation R on a set A is called symmetric if (b,a) € R holds when
(a,b) € R.i.e. The relation R={(4,5),(5,4),(6,5),(5,6)} on set A={4,5,6} is symmetric.
Types of Relations (contd.)

 AntiSymmetric Relation: A relation R on a set A is called antisymmetric if (a,b)€ R and


(b,a) € R then a = b is called antisymmetric.i.e. The relation R = {(a,b)→ R|a ≤ b} is anti-
symmetric since a ≤ b and b ≤ a implies a = b.
 Transitive Relation: A relation R on a set A is called transitive if (a,b) € R and (b,c) € R
then (a,c) € R for all a,b,c € A.i.e. Relation R={(1,2),(2,3),(1,3)} on set A={1,2,3} is
transitive.
 Equivalence Relation: A relation is an Equivalence Relation if it is reflexive, symmetric,
and transitive. i.e. relation R={(1,1),(2,2),(3,3),(1,2),(2,1),(2,3),(3,2),(1,3),(3,1)} on set
A={1,2,3} is equivalence relation as it is reflexive, symmetric, and transitive. Number of
equivalence relation in a set containing n elements is given by Bell number.
 Asymmetric relation: Asymmetric relation is opposite of symmetric relation. A relation R
on a set A is called asymmetric if no (b,a) € R when (a,b) € R.
Fuzzy Sets
Sequences and Summations

 Sequences are ordered lists of elements.


 1, 2, 3, 5, 8
 1, 3, 9, 27, 81, …….

 Definition: A sequence is a function from a subset of the integers (usually


either the set {0, 1, 2, 3, 4, …..} or {1, 2, 3, 4, ….} ) to a set S.
 The notation an is used to denote the image of the integer n. We can think
of an as the equivalent of f(n) where f is a function from {0,1,2,…..} to S.
We call an a term of the sequence.
Sequences (contd.)
Geometric Progression

 Definition: A geometric progression is a sequence of the form:


where the initial term a and the common ratio r are real numbers.
 Examples:

 Let a = 1 and r = −1. Then:

 Let a = 2 and r = 5. Then:

 Let a = 6 and r = 1/3. Then:


Arithmetic Progression
 Definition: A arithmetic progression is a sequence of the form:
where the initial term a and the common difference d are real numbers.
 Examples:
 Let a = −1 and d = 4:

 Let a = 7 and d = −3:

 Let a = 1 and d = 2:
String

 Definition: A string is a finite sequence of characters from a finite set (an alphabet).
 Sequences of characters or bits are important in computer science.
 The empty string is represented by λ.
 The string abcde has length 5.
Recurrence Relations
 A recurrence relation for the sequence {an} is an equation that expresses an in terms of one
or more of the previous terms of the sequence, namely, a0, a1, …, an-1, for all integers n
with n ≥ n0, where n0 is a nonnegative integer.
 A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence
relation.
 The initial conditions for a sequence specify the terms that precede the first term where the
recurrence relation takes effect.
Recurrence Relations (contd.)

 Let {an} be a sequence that satisfies the recurrence relation an = an-1 + 3 for n = 1,2,3,4,….
and suppose that a0 = 2. What are a1 , a2 and a3?
[Here a0 = 2 is the initial condition.]

 Solution: We see from the recurrence relation that


 a1 = a0 + 3 = 2 + 3 = 5
 a2 = 5 + 3 = 8
 a3 = 8 + 3 = 11
Recurrence Relations (contd.)

 Let {an} be a sequence that satisfies the recurrence relation an = an-1 – an-2 for n = 2,3,4,….
and suppose that a0 = 3 and a1 = 5. What are a2 and a3?
[Here the initial conditions are a0 = 3 and a1 = 5. ]

 Solution: We see from the recurrence relation that


 a2 = a1 - a0 = 5 – 3 = 2
 a3 = a2 – a1 = 2 – 5 = –3
Fibonacci Sequence

Definition: Define the Fibonacci sequence, f0 ,f1 ,f2,…, by:


⚫ Initial Conditions: f0 = 0, f1 = 1
⚫ Recurrence Relation: fn = fn-1 + fn-2

Example: Find f2 ,f3 ,f4 , f5 and f6 .

Answer:
f2 = f1 + f0 = 1 + 0 = 1,
f3 = f2 + f1 = 1 + 1 = 2,
f4 = f3 + f2 = 2 + 1 = 3,
f5 = f4 + f3 = 3 + 2 = 5,
f6 = f5 + f4 = 5 + 3 = 8.
Useful Sequences
Summations
 Sum of the terms from the sequence

 The notation:

represents

 The variable j is called the index of summation. It runs through all the
integers starting with its lower limit m and ending with its upper limit n.
Summations (contd.)

 Example:
Product Notation

 Product of the terms


from the sequences {an}

represents
Geometric Series
Sums of terms of geometric progressions

Proof: Let To compute Sn , first multiply both sides of the


equality by r and then manipulate the resulting
sum as follows:
Geometric Series

Shifting the index of summation with k = j + 1.

Removing k = n + 1 term and


adding k = 0 term.

Substituting S for summation formula


if r ≠1

if r = 1
Useful Sequences

You might also like