0% found this document useful (0 votes)
24 views

Functions Countable Uncountable 2024

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

Functions Countable Uncountable 2024

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

Functions

No x has more than one y assigned

• Functions can be represented graphically in


several ways:
f A B
y
f •
a b
• x

A
Graph Plot
Like Venn diagrams
Functions
• A function f from set A to set B is a rule of correspondence
that assigns to each element x in the set A exactly one
element y in the set B.
• The relation can be written {(1,6), (2,2), (3,4), (4,8), (5,10)}
domain = {1,2,3,4,5} range = {2,4,6,8,10}
1
2
2
4
3
6
4 8
5 10
Functions

1 2 1 2
2 4 2 4
3 3 6
6
4 8
4 8 10
5
10
5
The relation {(2,4), (2,8)}is not
a function.
The relation {(1,6), (2,6), (3,6), (4,6),
(5,6)}is a function.
Functions
1. A={1,2,3,4} and B={a,b,c,d}and
f= {(1,a), (2,a), (3,d), (4,c)}

Since each set f(n) is a single value, f is a


Function.

2. A={1,2,3} and B={x,y,z}and let


f= {(1,x), (1,y), (2,z), (3,y)}

Since f(1) ={x, y} f is not a Function.


f1= {(1,x), (2,y), (3,z)} f1 is a Function
Functions
• R(a) = { b | aRb } is the image of a under R.
If f(a) = b, we say that b is the image of a
and a is the pre-image of b.
• Let A & B be nonempty sets.
• A function f : A → B is a relation from A to B such
that:
∀a ∈ A, ∃ b ∈B, a f b, denoted f(a) = b
Every element of A has 1 image. (Every where Defined Function)
• [ f(x) = y ∧ f(x) = z ] ⇒ y = z.
Every element of A has at most 1 image. (Function)
Domain
Let f : A → B. We say that f:A→B maps A to B.
• The domain of f is A.
• The co-domain of f is B.
• The range of f is { b | ∃ a ∈ A, f(a) = b }.
The range of f:A→B is the set of all images of
elements of A.
• Example: f : N → N, f(x) = 2x.
• The co-domain of f is N.
• The range of f is the even natural numbers.
Range vs. Codomain - Example
• Suppose that: “f is a function mapping
students in this class to the set of grades
{A,B,C,D,E}.”
• At this point, you know f’s codomain is:
{A,B,C,D,E unknown
__________,
} and its range is ________.
!
• Suppose the grades turn out all As and Bs.
• Then the range of f is _________,
{A,B} but its
still
codomain is __________________.
{A,B,C,D,E}!
Images
• When f(a) = b, b is said to be the image of a
under f (just as for general relations).
• f- -1(b) = { a | f(a) = b } is the set of
preimages of b: the set of elements in A that
map to b.
• For f : N → N, f(x) = 2x, what is f- -1(3) ?
Functions: Sum, Product
Let f1 and f2 be functions from A to R.
Then the sum and the product of f1 and f2 are also
functions from A to R defined by:
(f1 + f2)(x) = f1(x) + f2(x)
(f1f2)(x) = f1(x) f2(x)

Example:
•f1(x) = 3x, f2(x) = x + 5
•(f1 + f2)(x) = f1(x) + f2(x) = 3x + x + 5 = 4x + 5
•(f1f2)(x) = f1(x) f2(x) = 3x (x + 5) = 3x2 + 15x
Visualizing Functions
• Visualize functions via the vertical line test.
• A relation that violates rule 1: every element
has an image
• A relation that violates rule 2: every
element’s image is unique.
• A graph that is discontinuous.
• A graph where the co-domain ≠ the range.
Surjective (Onto) functions
A function f:A→B is called onto, or surjective, if and only if
for every element b∈B there is an element a∈A with f(a) = b.
In other words, f is onto if and only if its range is its entire
codomain.
• Let f: X →Y be a function.
• f is surjective (onto) when the f’s range = f’s co-
domain:
∀y ∈Y, ∃x ∈X, f(x) = y.
Surjective (onto) functions ...
Examples:
• f: ℵ → ℵ, f(n) = 2n is not surjective.
• f: ℜ → ℜ, f(n) = 2n is surjective.
• f: ℜ → ℜ, f(x) = x2 is not surjective.
• f: Z → Z, f(x) = x - 21 is surjective.
• f: Z → {0,1,2,3}, f(x) = x mod 4 is surjective.
• f: ℜ+ → ℜ+ , f(x) = x2 is surjective.
On_To Function Example
Injective Functions
f is one-to-one(Injective) if and only if it does not map two
distinct elements of A onto the same element of B.
• Function f is injective when
x ≠ y ⇒ f(x) ≠ f(y).
• Examples:
• f: Z → Z, f(x) = x2 (injective?)
• f: Z → Z, f(x) = 2x (injective?)
• f: Z → {0,1,2,3}, f(x) = x mod 4 (injective?)
One-to-one(Injective) functions are fundamental tool in
cryptography.
One_To_One Function Example
One_To_One Function Example
Functions: Strictly Increasing
A function f:A→B with A,B ⊆ R is called strictly
increasing,
if ∀x, y ∈A (x < y → f(x) < f(y) ),
and strictly decreasing,
if ∀x, y ∈A (x < y → f(x) > f(y) ).

Obviously, a function that is either strictly increasing or


strictly decreasing is one-to-one.
Bijective Functions
• A function is bijective when it is surjective and injective.
• A bijective function also is known as a 1-to-1
correspondence.
• Examples:
• f: Z → Z, f(x) = x + 3 (bijective?)
• f: ℜ → ℜ , f(x) = 2x (bijective?)
Invertible Functions
• Let f: X → Y be a function.
• Let f-1: Y → X be the inverse relation:
f-1 = {(y,x) | f(x) = y}.
Prove that function f(x) = 3x - 5 is bijective
from R to R.
Solution:
function f is bijective if
1.f is surjective: show that in the range for any point 'a'
there exists a point 'b' in subdomain 's'. That means f(b) =
a.
2.f is injective: prove that f(a) = c and f(b) = c then a = b.
Surjective: Injective:
Let a = 3x – 5 Let f(a) = c and f(b) = c
Therefore, x = (a + 5)/3 Therefore, c = 3a -5 and c =
Since, the above number is a 3b -5
real number, and it is also Thus, 3a - 5 = 3b – 5 Thus
shown in the domain. a=b
So the function is surjective. So the function is injective.
Bijective functions
1. Let A=B=Z and let f:A→B be defined by
f(a)= a+1, for a ∈A . Then is it a Function?
If yes is it onto/one to one?
Here, Dom(f) =Z=A so f is everywhere defined function.
Suppose that f(a) =f(a') for a and a' in A then
a+1=a'+1 So, a=a'.
Hence it is one to one.
Let b be ∈ B. Can we find that an element a ∈A such that
f(a)=b?
Here f(a)= a+1
We need an element a in A such that a+1=b.
Then a= b-1 (Since b-1 is in A).
Hence Ran(f)=B, Hence f is onto.
FUNCTION:
a. One- b. Not c. One- d. Neither e. Not a
to-one One-to- to-one & One-to- Function
not Onto one but Onto one nor
Onto Onto
Theorem: f- -1 is a function if and only if f is a
bijection.
Proof (⇐ ): If f is bijective then f- -1 is a function.
f is bijective:
• f is surjective: ∀y ∈Y, ∃ x ∈X, f (x) = y.
Equivalently, ∀y ∈Y, ∃ x ∈X, f-1 (y) = x. (Illustrate)
That is, every y has an image in X under f-1.
• f is injective: x1 ≠ x2 ⇒ f(x1) ≠ f(x2).
Equivalently, f (x1) = f (x2) ⇒ x1 = x2.
Equivalently, (f-1 (y) = x1 ∧ f-1 (y) = x2) ⇒ x1 = x2.
That is, f-1 (y) is unique. (Illustrate)
Therefore, f-1 is a function.
Bijection Example
• Let f: ℜ → ℜ, f(x) = x2
• f-1 = {(y, x ) | x2 = y}
∀ ∀ x, both x & -x when squared produce x2.
• Illustrate.
• Transpose the vertical test to see if f-1 is a function.
• When f is bijective,
• f-1 ( f(x) ) = f-1 (y) = x
• f ( f-1(y)) = f(x) = y
Composition of Functions
g:A→B and f:B→C, denoted by f °g,
(f °g)(a) = f(g(a))
That is, function g is applied to element a ∈ A, mapping it
onto an element of B,
then, function f is applied to this element of B, mapping it
onto an element of C.
Therefore, the composite function maps from A to C.
In general, functions do not commutative: Example:
• r(x) = x + 1
• s(y) = y2 Then,
• s(r(x)) = (x + 1)2
2
Composition of Functions
Example:
Let f(x) = 2 x +3; g(x) = 3 x + 2;
(f o g) (x) = f(3x + 2) = 2 (3 x + 2 ) + 3 = 6 x + 7.
(g o f ) (x) = g (2 x + 3) = 3 (2 x + 3) + 2 = 6 x + 11.
Here, (f o g) and (g o f) are not necessarily equal – i.e,
the composition of functions is not commutative.
Example:
f(x) = 7x – 4, g(x) = 3x,
f:R→R, g:R→R

(f°g)(5) = f(g(5)) = f(15) = 105 – 4 = 101

(f°g)(x) = f(g(x)) = f(3x) = 21x - 4


Composition of a function and its inverse:

(f-1°f)(x) = f-1(f(x)) = x

The composition of a function and its inverse is the identity


function i(x) = x.
(f -1 o f) (a) = f -1(f(a)) = f -1(b) = a.
(f o f -1) (b) = f (f -1(b)) = f-(a) = b.
Therefore (f-1o f ) = IA and (f o f-1) = IB
where IA and IB are the identity function on the sets A and B.
(f -1) -1= f
f := {(0, 0), (1, 1), (2, 4), (3, 2), (4, 2), (5, 4), (6, 1)}

g: = {(0, 0), (1, 4), (2, 7), (3, 10), (4, 13), (5, 16), (6, 19)}

then the composition function g ◦ f maps 2 to 13


since f (2) = 4 and g(4) = 13.
g ◦ f = {(0, 0), (1, 4), (2, 13), (3, 7), (4, 7), (5, 13), (6, 4)}

g◦f=
Functions for Computer Science
1. Characteristic Function of A
2. Congruent Function (on to but not one to one)
3. Factorial Function
4. Base 2 Exponential Function
5. Logarithmic Function
6. Floor and Ceiling Functions
Floor and Ceiling Functions
The floor and ceiling functions map the real numbers onto the integers
(R→Z).

The floor function assigns to r∈R the largest z∈Z with z ≤ r,


denoted by ⎣r⎦.

Examples: ⎣2.3⎦ = 2, ⎣2⎦ = 2, ⎣0.5⎦ = 0, ⎣-3.5⎦ = -4

The ceiling function assigns to r∈R the smallest z∈Z with z ≥ r,


denoted by ⎡r⎤.

Examples: ⎡2.3⎤ = 3, ⎡2⎤ = 2, ⎡0.5⎤ = 1, ⎡-3.5⎤ = -3


≤ +


≤ +
+

+
+
Some important functions:
Logarithm Function
Logarithm base a:
Domain = R+ x R = {(a,x)| a ∈ R+, a>1, x ∈ R }
Co-domain / Range = R
y = log a (x) ⇔ ay = x

Ex: log 2 (8) =3; log 2 (16) =3; 3 < log 2 (15) <4.

Key properties of the log function (they follow from those for exponential):
1. log a (1) = 0 (because a0 =1)
2. log a (a) = 1 (because a1 =a)
3. log a (xy) = log a (x) + log a (y) (similar arguments)
4. log a (xr) = r log a (x)
5. log a (1/x) = - log a (x) (note 1/x = x-1)
6. log b (x) = log a (x) / log a (b)
Some important functions: Polynomials
Polynomial function:
Domain = usually R
Co-domain Range = usually R
Pn(x) = anxn + an-1xn-1 + … + a1x1 + a0

n, a nonnegative integer is the degree of the polynomial;


an ≠0 (so that the term an xn actually appears)

(an, an-1, …, a1, a0) are the coefficients of the polynomial.

Ex:
y = P1(x) = a1x1 + a0 linear function
y = P2(x) = a2x2 + a1x1 + a0 quadratic polynomial or function
Exponentials grow MUCH faster than polynomials:
Countable_Uncountable_sets

A few known examples of a A few known examples of an


countable set? uncountable set?
Examples of countable set Examples of uncountable set
include: include:
1.Natural Numbers 1.Irrational Numbers
2.Even Numbers 2.Real Numbers
3.Odd Numbers 3.Complex Numbers
4.Whole Numbers 4.Imaginary Numbers, etc
5.Integers
6.Positive Integers
7.Negative Integers, etc.

1.Rational Numbers ?
Cardinality
Def.: The cardinality of a set is the number of
elements in the set.
Def.: Let A and B be two sets.
A and B have the same cardinality iff there is a
one-to-one correspondence (bijection)
between A and B
Countable Sets and Uncountable Sets
Def.: Set A is countable if it is finite or if it has
the same cardinality as the set of positive
integers. Otherwise it is uncountable.

(aleph) denotes the cardinality of infinite


countable sets
Examples:

⬥ Infinite Countable Sets: N, Z+, Z-, Z


⬥ Infinite Uncountable Sets: R, R+, R-
Countable Sets and Uncountable Sets
How do you demonstrate that a set is countable ?
Suppose A is a set. If there is a one-to-one and
onto function f : Z+ to A, then A is countable.

one-to-one , ∀x∀y (f(x) = f(y) → x = y)


onto, ∀y∃x( f(x) = y)
Countable Sets and Uncountable Sets
Theorem:
The set {x | x is an odd positive integer} is countable.
Proof: We need a one-to-one correspondence between Z+
and this set
a1, a2, a3, a4, a5 …corresponds to 1, 3, 5, 7, 9, …
We could also consider f(n) = 2n -1 from Z+ to the set of
odd positive integers.
• Then show that f is one-to-one and show that it is onto.
• From above, the sequence an = 2n -1 where n = 1, 2, 3,
….
Countable Sets and Uncountable Sets
Theorem: The set Z is countable.
Proof: List them like this: 0, 1, -1, 2, -2, 3, -3, 4, -4 …
Which corresponds to a1, a2, a3, a4, a5, a6 …
What we’ve actually done is given the one-to-one
correspondence between all integers and the positive
integers, i.e., the mapping from Z to Z+
Then,

f(n) = n/2 when n is even


f(n) = -(n-1)/2 when n is odd
Infinite Cardinality: Rational Numbers
• The set of positive rational numbers is a countable set
• Key aspect to list the rational numbers as a sequence – every
positive number is the quotient p/q of two positive integers.
• Visualization of the proof. 2 =3
q= q p+q=4 p+q=5 p+q=6
p+ p+

Since all positive


rational numbers are
listed once, the set of
positive rational
numbers is countable. Reference: https://www.youtube.com/watch?v=MBSSfJ3hrpo
Countability Example
Theorem: The set P of all ordered pairs of positive
integers (n, m) is countable.
Proof: Can we find a one-to-one and onto function
from P to Z+?
Uncountable sets
Theorem: The set of real numbers is uncountable.
If a subset of a set is uncountable, then the set is
uncountable.
The cardinality of a subset is at least as large as the
cardinality of the entire set.
It is enough to prove that there is a subset of R that is
uncountable
Theorem: The open interval of real numbers
[0,1) = {r ∈ R | 0 ≤ r < 1} is uncountable.
Proof by contradiction using the Cantor diagonalization
argument (Cantor, 1879) (Cantor's diagonal argument)
Real Numbers
• Example:
• The set of real numbers is an uncountable set.
• Let’s assume that the set of real numbers is
countable.
• Therefore any subset of it is also countable, in
particular the interval [0,1].
• How many real numbers are in interval [0, 1]?
Real Numbers Diagonalization
• No matter what kind of list you create, there
will always be a number that is not in the
list.
• This is found by using Cantor's diagonal
argument, where you create a new number
by taking the diagonal components of the list
and adding 1 to each.
• So, you take the first place after the decimal in the first
number and add one to it. You get 1+1=2.
• Then you take the second place after the decimal in the
second number and add 1 to it (4+1=5). And so on to get
your new number:
0.25840...
(When your number is a 9,9, you get 0 when adding a 1)
Real Numbers Diagonalization
• Example:
• 0.4111111
• 0.412345
• 0.345677
• 0.544444
• New No: 4545…..
Now let r = 0.d1d2d3d4… where di = 4 if dii ≠ 4
di = 5 if dii = 4
But r is not equal to any of the items in the list so it’s missing from
the list so we can’t list them after all.

r differs from ri in the ith position, for all i. So, our assumption that
we could list them all is incorrect.
Uncountable Sets: R
Proof (BWOC) using diagonalization: Suppose R is countable
(then any subset say [0,1) is also countable). So, we can list them:
r1, r2, r3, … where
r1 = 0.d11d12d13d14… the dij are digits 0-9
r2 = 0.d21d22d23d24…
r3 = 0.d31d32d33d34…
r4 = 0.d41d42d43d44… etc.
Now let r = 0.d1d2d3d4…
where di = 4 if dii ≠ 4
di = 5 if dii = 4
But r is not equal to any of the items in the list so it’s missing from
the list so we can’t list them after all.
r differs from ri in the ith position, for all i. So, our assumption that
we could list them all is incorrect.
Uncountable Sets: Cantor's diagonal argument
•The set of all infinite sequences of zeros and ones is
uncountable.
•Consider a sequence, {010101010101...., 10100100100...., etc}

For example:

So in general we have:

i.e., sn,m is the mth element of the nth sequence on the list.
Uncountable Sets: Cantor's diagonal argument

Note: the diagonal elements are


highlighted,
showing why this is called the
diagonal argument

• The sequence s0 is distinct from all the sequences in the list. Why?
• Let’s say that s0 is identical to the 100th sequence, therefore,
s0,100=s100,100.
• In general, if it appeared as the nth sequence on the list, we would
have s0,n = sn,n,
• which, due to the construction of s , is impossible.
The Power Set Theorem
• Cantor's theorem, in set theory, the theorem states
that the cardinality (numerical size) of a set is strictly
less than the cardinality of its power set, or collection of
subsets.
• In symbols, a finite set S with n elements contains
2n subsets, so that the cardinality of the set S is n and
its power set P(S) is 2n.
Schroeder-Bernstein theorem
• The Schröder–Bernstein theorem states that, if there exist
injective functions f : A → B and g : B → A between the
sets A and B,
• then there exists a bijective function h : A → B

• In terms of the cardinality of the two sets, this classically implies


that if |A| ≤ |B| and |B| ≤ |A|, then |A| = |B|; that
is, A and B are equipotent.
• This is a useful feature in the ordering of cardinal numbers.
• The theorem is named after Felix Bernstein and Ernst Schröder.
• It is also known as Cantor–Bernstein theorem, or Cantor–
Schröder–Bernstein, after Georg Cantor who first published it
without proof.
TUTORIAL
• Give a formula for a function from the set of integers to the set of
positive integers:
a) one-to-one, but not onto. b) onto, but not one-to-one.
c) one-to-one and onto. d) neither one-to-one nor onto.
• Consider these functions from the set of students in a DM class.
Under what conditions is the function one-to-one if it assigns to a
student to a) mobile phone number. b) student identification
number. c) final grade in the class. d) home town.
• Determine whether the functions is a bijection from R to R.
a) f (x) = 2x + 1 b) f (x) = x2 + 1
c) f (x) = x3 d) f (x) = (x2 + 1)/(x2 + 2)
• Find f ◦ g and g ◦ f , where f (x) = x2 + 1 and g(x) = x + 2
• Notes: Examples taken in class is also part of tutorial
Let A be a set, and let B be a proper subset of A (so that B is not equal to A). Is it
possible for B to have the same cardinality as A? Ans: Yes, but only when A is
infinite. Justify.
Referances:
• https://en.wikipedia.org/wiki/Cantor%27s_theorem
• https://www.whitman.edu/mathematics/higher_math_online/secti
on04.07.html
• https://en.wikipedia.org/wiki/Schr%C3%B6der
%E2%80%93Bernstein_theorem#:~:text=In%20set%20theory
%2C%20the%20Schr%C3%B6der,function%20h%20%3A%20A
%20%E2%86%92%20B.
• https://youtu.be/sT9hAmaot8U //Youtube
• https://youtu.be/qGYDQWm49wU //Youtube
• https://www.youtube.com/watch?v=CvalbBGhmW4
• https://www.javatpoint.com/bijective-function-
in-discrete-mathematics

You might also like