Functions Countable Uncountable 2024
Functions Countable Uncountable 2024
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)}
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) ).
(f-1°f)(x) = f-1(f(x)) = x
g: = {(0, 0), (1, 4), (2, 7), (3, 10), (4, 13), (5, 16), (6, 19)}
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).
+
+
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
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
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.
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
• 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