0% found this document useful (0 votes)
58 views27 pages

Introduction To Sets and Functions

This document provides an introduction to sets and functions in discrete mathematics. It defines basic set concepts such as elements, subsets, unions, intersections, and cardinality. It also defines functions, including one-to-one, onto, and bijective functions. Finally, it discusses inverse functions and function composition. The overall purpose is to introduce foundational concepts about sets and functions that are important for discrete mathematics.

Uploaded by

Kaushil Kundalia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views27 pages

Introduction To Sets and Functions

This document provides an introduction to sets and functions in discrete mathematics. It defines basic set concepts such as elements, subsets, unions, intersections, and cardinality. It also defines functions, including one-to-one, onto, and bijective functions. Finally, it discusses inverse functions and function composition. The overall purpose is to introduce foundational concepts about sets and functions that are important for discrete mathematics.

Uploaded by

Kaushil Kundalia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 27

Introduction to Sets and Functions

Srikrishnan Divakaran
School of Engineering and Applied Sciences, Ahmedabad University
Lecture Set 3
Contents

1. Basic Definitions

2. Set Operations

3. Functions
Basic Set Definitions
A set is an unordered collection of objects. The objects in a set are
called the elements or members of the set. A set is said to contain
its elements.

Well Known sets: o the set of all real numbers,


o the set of all complex numbers,
o the set of all integers,
o the set of all positive integers
o empty set, , the set with no elements.

Other examples:

The set of all polynomials with degree at most three: {1, x, x2, x3, 2x+3x2,…}.

The set of all n-bit strings: {000…0, 000…1, …, 111…1}


Basic Set Definitions
o Two sets are equal if and only if they have the same elements.
That is if A and B are sets then A and B are equal if and only If

x( x  A  x  B )

o The set A is said to be a subset of B if and only if every element


of A is also an element of B. We use the notation A  B to
indicate that A is a subset of B.

x ( x  A  x  B )
Basic Set Definitions
o The size or cardinality of a set S, denoted by |S|, is defined as
the number of elements contained in S.

o A set is said to be infinite if it is not finite.

o Given a set S, the power set of S is the set of all subsets of the
set S. The power set of S is denoted by P(S).

P({a,b}) = {, {a}, {b}, {a,b}}

P({a,b,c}) = {, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c}}

P({a,b,c,d}) = {, {a}, {b}, {c}, {d},


{a,b}, {a,c}, {b,c}, {a,d}, {b,d}, {c,d},
{a,b,c}, {a,b,d}, {a,c,d}, {b,c,d}, {a,b,c,d}}
How do you show that if A has n elements, then P(A) has 2n elements?
Basic Set Definitions
o The ordered n-tuple (a1, a2, …, an) is the ordered collection that
has a1 as its first element, a2 as its second element, …, and an as
its nth element.

o Given two sets A and B, the Cartesian product A x B is the


set of all ordered pairs (a,b), where a is in A and b is in B.

Example: Let A be the set of letters, i.e. {a,b,c,…,x,y,z}


AxA is just the set of strings with two letters.
Set Union

Let A and B be sets. The union of the sets A and B, denoted by A U B , is the set
That contains those elements that are either in A or B, or in both.

A  B  {x | ( x  A)  ( x  B)}
Set Intersection

Let A and B be sets. The intersection of the sets A and B, denoted by A ∩ B , is the
set That contains those elements that are present in both A and B.

A  B  {x | ( x  A)  ( x  B)}

Two sets are called dis-joint if their intersection is the empty set.

A
A
Set Difference Operation
Let A and B be sets. The difference of A and B, denoted by A-B, is the set containing
Those elements that are in A but not in B. The difference of A and B is also called
The complement of B with respect to A.

A  B  {x | ( x  A)  ( x  B)}

Let U be the universal set. The complement of set A, denoted by A , is the


complement of A with respect to U.

That is, A = U – A.
Set Identities (1)

Identity: A=A AU=A

Domination: AU=U A=

Idempotent: AA = A = AA

Double complement: ( A)  A
Commutative: AB=BA AB=BA

Associative: A(BC)=(AB)C

A(BC)=(AB)C
Set Identities (2)

Demorgan’s Law:

A B  A  B
A B  A  B
Generalized Union and Intersection

Generalized Union: n-ary union:


n
AA2…An : ((…((A1 A2) …) An) : A i
i 1

Generalized Intersection: n-ary intersection:


n

AA2…An((…((A1A2)…)An) : 
i 1
Ai
Russell’s Paradox

W is the set that contains all the sets that don’t contain themselves.

If W is in W, then W contains itself. But W contains only those sets that don’t
contain themselves. So W is not in W.

If W is not in W, then W does not contain itself. But W contains those sets that
don’t contain themselves. So W is in W.
Functions

Definition: Let A and B be non-empty sets. A function f from A to B is an assignment


of exactly one element of B to each element of A. We write f(a) = b if b is the
unique
element of B assigned by f to a. We say that b is the image of a and a is the
pre-image of b.

The domain (input) of f is A.

The codomain (output) of f is B.

A B
Some Function Terminology

• If f:AB, and f(a)=b, where aA and bB, then:


– A is the domain of f.
– B is the codomain of f.
– b is the image of a under f.
– a is a pre-image of b under f.
• In general, b may have more than one pre-image.
– The range RB of f is {b | a f(a)=b }.

15
Examples of Functions

domain = R
Co-domain = R>0

domain = R>C
codomain = R

domain = R
codomain = [-1,1]

domain = R>=0
codomain = R>=0
Examples of Functions

f(S) = |S| domain = the set of all finite sets


codomain = non-negative integers

domain = the set of all finite strings


f(string) = length(string)
codomain = non-negative integers

not a function,
f(student-name) = student-ID since one input could have
more than one output

f(x) = is-prime(x) domain = positive integers


codomain = {T,F}
Function Addition/Multiplication

• We can add and multiply functions

Let f,g: RR be two functions then


• (f  g): RR, where (f  g)(x) = f(x)  g(x)
• (f × g): RR, where (f × g)(x) = f(x) × g(x)
• Examples:
• Let f(x) = x2 and g(x) = 2x then
• (f+g)(x) = x2 + 2x
• (f × g)(x) = x2 × 2x = 2x3

18
One-to-One (injective) Functions
f : A  B is an one-to-one function if and only if f(a) = f(b) implies that a =
b for all a and b in the domain of f.
≤ 1 arrow in
f( ) =
A B

|A| ≤ |B|
Onto (Surjective) functions
f : A  B is an onto function if and only if for every element
b B there
is an element a  A with f(a) = b.

f( ) = 1 arrow in

A B

|A| ≥ |B|
One-to-One correspondence (Bijection)
f : A  B is a one-to-one correspondence if it is one-to-one and onto.

exactly one arrow in

f( ) =
A B

|A| = |B|
Inverse Functions

Let f be a one-to-one correspondence from the set A to the set B. The inverse
function of f is the function that assigns to an element b in B the unique element a
in A such that f(a) = b. The inverse of function f is denoted by f-1.

B
A
Inverse of a function

23
Function Composition

24
Inverse of a function (cont’d)

25
A Couple of Key Functions

• In discrete math, we frequently use the following functions over real


numbers:
 x (“floor of x”) is the largest integer  x.
 x (“ceiling of x”) is the smallest integer  x.

26
Acknowledgements
1. Introduction to Discrete Mathematics, Lectures of Prof. Lap Chi Lau,
Chinese University of Honk Kong.
2. Mathematics for Computer Science, Lectures of Prof. Tom Leighton,
MIT open courseware.
3. Discrete Mathematics and its Applications, Kenneth Rosen, 6th
edition, McGraw Hill Publishing.

You might also like