Introduction to set theory and to methodology and philosophy of
mathematics and computer programming
Injective and surjective functions
An overview
by Jan Plaza
c 2017 Jan Plaza
Use under the Creative Commons Attribution 4.0 International License
Version of November 8, 2017
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ?
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why?
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Consider the following functions on R.
1. Is f(x) = x3 1-1 ?
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Consider the following functions on R.
1. Is f(x) = x3 1-1 ? Yes.
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Consider the following functions on R.
1. Is f(x) = x3 1-1 ? Yes.
2. Is f(x) = ex 1-1 ?
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Consider the following functions on R.
1. Is f(x) = x3 1-1 ? Yes.
2. Is f(x) = ex 1-1 ? Yes.
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Consider the following functions on R.
1. Is f(x) = x3 1-1 ? Yes.
2. Is f(x) = ex 1-1 ? Yes.
3. Is f(x) = x sin x 1-1 ?
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Consider the following functions on R.
1. Is f(x) = x3 1-1 ? Yes.
2. Is f(x) = ex 1-1 ? Yes.
3. Is f(x) = x sin x 1-1 ? No.
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Consider the following functions on R.
1. Is f(x) = x3 1-1 ? Yes.
2. Is f(x) = ex 1-1 ? Yes.
3. Is f(x) = x sin x 1-1 ? No.
4. Is f(x) = x2 1-1 ?
Injections
Definition
1. Let f be a function. f is an injection or f is injective or f is 1-1 or
f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f).
2. One writes f : X
1-1
−→ Y if f : X −→ Y and f is 1-1.
Exercise
Is the function motherOf 1-1 ? No.
Why? Two different persons may have the same mother.
Consider the following functions on R.
1. Is f(x) = x3 1-1 ? Yes.
2. Is f(x) = ex 1-1 ? Yes.
3. Is f(x) = x sin x 1-1 ? No.
4. Is f(x) = x2 1-1 ? No.
Surjections
Definition
1. Let f be a function and let Y be a set.
f is (a surjection) onto Y if range(f)=Y .
2. Let f be a function and let X, Y be sets.
f is (a surjection) from X onto Y , denoted f : X
onto
−→ Y ,
if f : X −→ Y and f is onto Y .
The words in parentheses can be omitted.
Exercise Consider the following functions on R.
1. Is f(x) = x3 onto R ?
Surjections
Definition
1. Let f be a function and let Y be a set.
f is (a surjection) onto Y if range(f)=Y .
2. Let f be a function and let X, Y be sets.
f is (a surjection) from X onto Y , denoted f : X
onto
−→ Y ,
if f : X −→ Y and f is onto Y .
The words in parentheses can be omitted.
Exercise Consider the following functions on R.
1. Is f(x) = x3 onto R ? Yes.
Surjections
Definition
1. Let f be a function and let Y be a set.
f is (a surjection) onto Y if range(f)=Y .
2. Let f be a function and let X, Y be sets.
f is (a surjection) from X onto Y , denoted f : X
onto
−→ Y ,
if f : X −→ Y and f is onto Y .
The words in parentheses can be omitted.
Exercise Consider the following functions on R.
1. Is f(x) = x3 onto R ? Yes.
2. Is f(x) = ex onto R ?
Surjections
Definition
1. Let f be a function and let Y be a set.
f is (a surjection) onto Y if range(f)=Y .
2. Let f be a function and let X, Y be sets.
f is (a surjection) from X onto Y , denoted f : X
onto
−→ Y ,
if f : X −→ Y and f is onto Y .
The words in parentheses can be omitted.
Exercise Consider the following functions on R.
1. Is f(x) = x3 onto R ? Yes.
2. Is f(x) = ex onto R ? No.
Surjections
Definition
1. Let f be a function and let Y be a set.
f is (a surjection) onto Y if range(f)=Y .
2. Let f be a function and let X, Y be sets.
f is (a surjection) from X onto Y , denoted f : X
onto
−→ Y ,
if f : X −→ Y and f is onto Y .
The words in parentheses can be omitted.
Exercise Consider the following functions on R.
1. Is f(x) = x3 onto R ? Yes.
2. Is f(x) = ex onto R ? No.
3. Is f(x) = x sin x onto R ?
Surjections
Definition
1. Let f be a function and let Y be a set.
f is (a surjection) onto Y if range(f)=Y .
2. Let f be a function and let X, Y be sets.
f is (a surjection) from X onto Y , denoted f : X
onto
−→ Y ,
if f : X −→ Y and f is onto Y .
The words in parentheses can be omitted.
Exercise Consider the following functions on R.
1. Is f(x) = x3 onto R ? Yes.
2. Is f(x) = ex onto R ? No.
3. Is f(x) = x sin x onto R ? Yes.
Surjections
Definition
1. Let f be a function and let Y be a set.
f is (a surjection) onto Y if range(f)=Y .
2. Let f be a function and let X, Y be sets.
f is (a surjection) from X onto Y , denoted f : X
onto
−→ Y ,
if f : X −→ Y and f is onto Y .
The words in parentheses can be omitted.
Exercise Consider the following functions on R.
1. Is f(x) = x3 onto R ? Yes.
2. Is f(x) = ex onto R ? No.
3. Is f(x) = x sin x onto R ? Yes.
4. Is f(x) = x2 onto R ?
Surjections
Definition
1. Let f be a function and let Y be a set.
f is (a surjection) onto Y if range(f)=Y .
2. Let f be a function and let X, Y be sets.
f is (a surjection) from X onto Y , denoted f : X
onto
−→ Y ,
if f : X −→ Y and f is onto Y .
The words in parentheses can be omitted.
Exercise Consider the following functions on R.
1. Is f(x) = x3 onto R ? Yes.
2. Is f(x) = ex onto R ? No.
3. Is f(x) = x sin x onto R ? Yes.
4. Is f(x) = x2 onto R ? No.
Combining results of previous exercises, we have the following functions from R to R.
1. f(x) = x3 is 1-1 and onto R.
2. f(x) = ex is 1-1 but not onto R.
Combining results of previous exercises, we have the following functions from R to R.
1. f(x) = x3 is 1-1 and onto R.
2. f(x) = ex is 1-1 but not onto R.
3. f(x) = x sin x is not 1-1 but is onto R.
Combining results of previous exercises, we have the following functions from R to R.
1. f(x) = x3 is 1-1 and onto R.
2. f(x) = ex is 1-1 but not onto R.
3. f(x) = x sin x is not 1-1 but is onto R.
4. f(x) = x2 is neither 1-1 nor onto R.
Exercise
Construct examples of functions from N to N which are:
1. 1-1 and onto N.
2. 1-1 but not onto N.
3. Not 1-1 but onto N.
4. Neither 1-1 nor onto N.
Bijections
Definition
1. Let f : X −→ Y . f is a bijection between X and Y or
f is a 1-1 correspondence between X and Y or
f is a one-to-one correspondence between X and Y , denoted
f : X
1-1, onto
−→ Y , if f is both one-to-one and onto Y .
In the three phrases above we can replace “between X and Y ” by
“from X to Y ” or “from X onto Y ”.
Can you give an example of a function that is a bijection from R to R?
Can you give an example of a function that is not a bijection from R to R?
Summary of definitions
Let f : X −→ Y .
1. f is an injection iff ∀x1,x2∈X (f(x1) = f(x2) → x1 = x2).
2. f is a surjection onto Y iff ∀y∈Y ∃x f(x) = y
3. f is a bijection between X and Y iff f is 1-1 and onto Y .
Notes
f : X −→ Y
domain(f) = X
range(f) ⊆ Y
f : X
onto
−→ Y
domain(f) = X
range(f) = Y
Horizontal line tests
Let f : R −→ R. Then,
1. f is 1-1 iff every horizontal line intersects the graph of f in at most one point.
2. f is onto R iff every horizontal line intersects the graph of f in at least one point.
3. f is a bijection between R and R iff every horizontal line intersects the graph of f
in exactly one point.
Exercise
1. Formulate vertical and horizontal line tests for functions f : X −→ Y where
X, Y ⊆ R.
2. Formulate vertical and horizontal line tests for functions visulized in discrete
Cartesian diagrams.
Exercise
True or false?
1. ∅ : ∅
1-1
−→ X ?
Exercise
True or false?
1. ∅ : ∅
1-1
−→ X ? True
Exercise
True or false?
1. ∅ : ∅
1-1
−→ X ? True
2. ∅ : ∅
1-1, onto
−→ ∅.
Exercise
True or false?
1. ∅ : ∅
1-1
−→ X ? True
2. ∅ : ∅
1-1, onto
−→ ∅. True
Fact
Every function f is onto range(f).
Exercise
Complete: If f : X
1-1
−→ Y then f is a bijection between X and ...
Character codes
1. ASCII code is a bijection between the set of ASCII characters and the integers in
the range 0 .. 27−1, i.e 0..127. (ASCII characters include
a-z,A-Z,0-9, some punctuation marks and symbols, as well as some special
characters which do not have graphic representation but which can typed on a
computer keyboard.)
2. Extended ASCII code ISO Latin-1 is a bijection between the set of a set of
Latin-based characters of most European languages and the integers in the range
0 .. 28−1, i.e 0 .. 255. It is an extension of the ASCII code.
3. Unicode is an injection from the set of all historic and contemporary characters
and symbols known used by humanity into the set of integers in the range
0 .. 17 · 216, i.e. 0 .. 1,114,111. It is an extension of ISO Latin-1. Every next
version of Unicode covers more characters/symbols/glyphs but it is not a goal to
make any future version a bijection onto the range above.
Encryption and decryption fucntions
1. Such functions come in pairs.
An encryption function is any e : Strings
1-1
−→ Strings.
d : Strings −→ Strings is a decryption function corresponding to e
iff for every string (message) s, d(e(s)) = s.
2. Encryption e is required to be an injection,
otherwise there could be two different messages s, s encrypted into the same
string, e(s) = e(s ), and there would be no chance to uniquely decrypt that string.
3. The conditions in item 1 imply that
decryption d must be a surjection onto Strings,
otherwise there would be a string s encrypted into e(s),
which cannot be decrypted:
if s ∈ range(d) then d(e(s)=s.
Cryptographic hash functions
Password verification can be done using an encryption-like function that does not have
a corresponding decryption function. Such a function is usually not an injection and is
designed so that:
For any string a, it is computationally easy to compute e(a);
For any string b it is computationally infeasible to find an a s.t. e(a) = b;
It is computationally infeasible to find a, a s.t a=a and e(a) = e(a ).
A function with these properties, is called a cryptographic hash function .
Identity verification and digital signatures
Password verification can be done as follows. The computer stores a cryptographic
hash function e (which may be known to hackers). Alice chooses a string a for a
password; the computer uses e to transform a into a string e(a) and stores only e(a)
(but not a) in association with the username “Alice”. When a user tries to log in as
“Alice” with a password a , the system allows it iff e(a ) is equal to the stored string
e(a). Notice that e(a) does not need to be decrypted in this protocol.
As the function e has properties specified above, a hacker who does not know Alice’s
password a, most likely specifies another password a , and it is most likely to result in a
value e(a )=e(a), preventing the log-in. Although an a , s.t. e(a )=e(a), may exist, it
is hard to find it, even if the hacker gained knowledge of the stored value e(a). Also
notice, that if Alice forgets her password, the computer (or system administrator)
cannot tell Alice what it was.
The same idea is used to verify authencity of messages or files via “digital signatures”.

5.5 Injective and surjective functions. Dynamic slides.

  • 1.
    Introduction to settheory and to methodology and philosophy of mathematics and computer programming Injective and surjective functions An overview by Jan Plaza c 2017 Jan Plaza Use under the Creative Commons Attribution 4.0 International License Version of November 8, 2017
  • 2.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ?
  • 3.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No.
  • 4.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why?
  • 5.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother.
  • 6.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother. Consider the following functions on R. 1. Is f(x) = x3 1-1 ?
  • 7.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother. Consider the following functions on R. 1. Is f(x) = x3 1-1 ? Yes.
  • 8.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother. Consider the following functions on R. 1. Is f(x) = x3 1-1 ? Yes. 2. Is f(x) = ex 1-1 ?
  • 9.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother. Consider the following functions on R. 1. Is f(x) = x3 1-1 ? Yes. 2. Is f(x) = ex 1-1 ? Yes.
  • 10.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother. Consider the following functions on R. 1. Is f(x) = x3 1-1 ? Yes. 2. Is f(x) = ex 1-1 ? Yes. 3. Is f(x) = x sin x 1-1 ?
  • 11.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother. Consider the following functions on R. 1. Is f(x) = x3 1-1 ? Yes. 2. Is f(x) = ex 1-1 ? Yes. 3. Is f(x) = x sin x 1-1 ? No.
  • 12.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother. Consider the following functions on R. 1. Is f(x) = x3 1-1 ? Yes. 2. Is f(x) = ex 1-1 ? Yes. 3. Is f(x) = x sin x 1-1 ? No. 4. Is f(x) = x2 1-1 ?
  • 13.
    Injections Definition 1. Let fbe a function. f is an injection or f is injective or f is 1-1 or f is one-to-one if f(a)=f(b) implies a=b, for any a, b ∈ domain(f). 2. One writes f : X 1-1 −→ Y if f : X −→ Y and f is 1-1. Exercise Is the function motherOf 1-1 ? No. Why? Two different persons may have the same mother. Consider the following functions on R. 1. Is f(x) = x3 1-1 ? Yes. 2. Is f(x) = ex 1-1 ? Yes. 3. Is f(x) = x sin x 1-1 ? No. 4. Is f(x) = x2 1-1 ? No.
  • 14.
    Surjections Definition 1. Let fbe a function and let Y be a set. f is (a surjection) onto Y if range(f)=Y . 2. Let f be a function and let X, Y be sets. f is (a surjection) from X onto Y , denoted f : X onto −→ Y , if f : X −→ Y and f is onto Y . The words in parentheses can be omitted. Exercise Consider the following functions on R. 1. Is f(x) = x3 onto R ?
  • 15.
    Surjections Definition 1. Let fbe a function and let Y be a set. f is (a surjection) onto Y if range(f)=Y . 2. Let f be a function and let X, Y be sets. f is (a surjection) from X onto Y , denoted f : X onto −→ Y , if f : X −→ Y and f is onto Y . The words in parentheses can be omitted. Exercise Consider the following functions on R. 1. Is f(x) = x3 onto R ? Yes.
  • 16.
    Surjections Definition 1. Let fbe a function and let Y be a set. f is (a surjection) onto Y if range(f)=Y . 2. Let f be a function and let X, Y be sets. f is (a surjection) from X onto Y , denoted f : X onto −→ Y , if f : X −→ Y and f is onto Y . The words in parentheses can be omitted. Exercise Consider the following functions on R. 1. Is f(x) = x3 onto R ? Yes. 2. Is f(x) = ex onto R ?
  • 17.
    Surjections Definition 1. Let fbe a function and let Y be a set. f is (a surjection) onto Y if range(f)=Y . 2. Let f be a function and let X, Y be sets. f is (a surjection) from X onto Y , denoted f : X onto −→ Y , if f : X −→ Y and f is onto Y . The words in parentheses can be omitted. Exercise Consider the following functions on R. 1. Is f(x) = x3 onto R ? Yes. 2. Is f(x) = ex onto R ? No.
  • 18.
    Surjections Definition 1. Let fbe a function and let Y be a set. f is (a surjection) onto Y if range(f)=Y . 2. Let f be a function and let X, Y be sets. f is (a surjection) from X onto Y , denoted f : X onto −→ Y , if f : X −→ Y and f is onto Y . The words in parentheses can be omitted. Exercise Consider the following functions on R. 1. Is f(x) = x3 onto R ? Yes. 2. Is f(x) = ex onto R ? No. 3. Is f(x) = x sin x onto R ?
  • 19.
    Surjections Definition 1. Let fbe a function and let Y be a set. f is (a surjection) onto Y if range(f)=Y . 2. Let f be a function and let X, Y be sets. f is (a surjection) from X onto Y , denoted f : X onto −→ Y , if f : X −→ Y and f is onto Y . The words in parentheses can be omitted. Exercise Consider the following functions on R. 1. Is f(x) = x3 onto R ? Yes. 2. Is f(x) = ex onto R ? No. 3. Is f(x) = x sin x onto R ? Yes.
  • 20.
    Surjections Definition 1. Let fbe a function and let Y be a set. f is (a surjection) onto Y if range(f)=Y . 2. Let f be a function and let X, Y be sets. f is (a surjection) from X onto Y , denoted f : X onto −→ Y , if f : X −→ Y and f is onto Y . The words in parentheses can be omitted. Exercise Consider the following functions on R. 1. Is f(x) = x3 onto R ? Yes. 2. Is f(x) = ex onto R ? No. 3. Is f(x) = x sin x onto R ? Yes. 4. Is f(x) = x2 onto R ?
  • 21.
    Surjections Definition 1. Let fbe a function and let Y be a set. f is (a surjection) onto Y if range(f)=Y . 2. Let f be a function and let X, Y be sets. f is (a surjection) from X onto Y , denoted f : X onto −→ Y , if f : X −→ Y and f is onto Y . The words in parentheses can be omitted. Exercise Consider the following functions on R. 1. Is f(x) = x3 onto R ? Yes. 2. Is f(x) = ex onto R ? No. 3. Is f(x) = x sin x onto R ? Yes. 4. Is f(x) = x2 onto R ? No.
  • 22.
    Combining results ofprevious exercises, we have the following functions from R to R. 1. f(x) = x3 is 1-1 and onto R. 2. f(x) = ex is 1-1 but not onto R.
  • 23.
    Combining results ofprevious exercises, we have the following functions from R to R. 1. f(x) = x3 is 1-1 and onto R. 2. f(x) = ex is 1-1 but not onto R. 3. f(x) = x sin x is not 1-1 but is onto R.
  • 24.
    Combining results ofprevious exercises, we have the following functions from R to R. 1. f(x) = x3 is 1-1 and onto R. 2. f(x) = ex is 1-1 but not onto R. 3. f(x) = x sin x is not 1-1 but is onto R. 4. f(x) = x2 is neither 1-1 nor onto R. Exercise Construct examples of functions from N to N which are: 1. 1-1 and onto N. 2. 1-1 but not onto N. 3. Not 1-1 but onto N. 4. Neither 1-1 nor onto N.
  • 25.
    Bijections Definition 1. Let f: X −→ Y . f is a bijection between X and Y or f is a 1-1 correspondence between X and Y or f is a one-to-one correspondence between X and Y , denoted f : X 1-1, onto −→ Y , if f is both one-to-one and onto Y . In the three phrases above we can replace “between X and Y ” by “from X to Y ” or “from X onto Y ”. Can you give an example of a function that is a bijection from R to R? Can you give an example of a function that is not a bijection from R to R?
  • 26.
    Summary of definitions Letf : X −→ Y . 1. f is an injection iff ∀x1,x2∈X (f(x1) = f(x2) → x1 = x2). 2. f is a surjection onto Y iff ∀y∈Y ∃x f(x) = y 3. f is a bijection between X and Y iff f is 1-1 and onto Y . Notes f : X −→ Y domain(f) = X range(f) ⊆ Y f : X onto −→ Y domain(f) = X range(f) = Y
  • 27.
    Horizontal line tests Letf : R −→ R. Then, 1. f is 1-1 iff every horizontal line intersects the graph of f in at most one point. 2. f is onto R iff every horizontal line intersects the graph of f in at least one point. 3. f is a bijection between R and R iff every horizontal line intersects the graph of f in exactly one point. Exercise 1. Formulate vertical and horizontal line tests for functions f : X −→ Y where X, Y ⊆ R. 2. Formulate vertical and horizontal line tests for functions visulized in discrete Cartesian diagrams.
  • 28.
    Exercise True or false? 1.∅ : ∅ 1-1 −→ X ?
  • 29.
    Exercise True or false? 1.∅ : ∅ 1-1 −→ X ? True
  • 30.
    Exercise True or false? 1.∅ : ∅ 1-1 −→ X ? True 2. ∅ : ∅ 1-1, onto −→ ∅.
  • 31.
    Exercise True or false? 1.∅ : ∅ 1-1 −→ X ? True 2. ∅ : ∅ 1-1, onto −→ ∅. True Fact Every function f is onto range(f). Exercise Complete: If f : X 1-1 −→ Y then f is a bijection between X and ...
  • 32.
    Character codes 1. ASCIIcode is a bijection between the set of ASCII characters and the integers in the range 0 .. 27−1, i.e 0..127. (ASCII characters include a-z,A-Z,0-9, some punctuation marks and symbols, as well as some special characters which do not have graphic representation but which can typed on a computer keyboard.) 2. Extended ASCII code ISO Latin-1 is a bijection between the set of a set of Latin-based characters of most European languages and the integers in the range 0 .. 28−1, i.e 0 .. 255. It is an extension of the ASCII code. 3. Unicode is an injection from the set of all historic and contemporary characters and symbols known used by humanity into the set of integers in the range 0 .. 17 · 216, i.e. 0 .. 1,114,111. It is an extension of ISO Latin-1. Every next version of Unicode covers more characters/symbols/glyphs but it is not a goal to make any future version a bijection onto the range above.
  • 33.
    Encryption and decryptionfucntions 1. Such functions come in pairs. An encryption function is any e : Strings 1-1 −→ Strings. d : Strings −→ Strings is a decryption function corresponding to e iff for every string (message) s, d(e(s)) = s. 2. Encryption e is required to be an injection, otherwise there could be two different messages s, s encrypted into the same string, e(s) = e(s ), and there would be no chance to uniquely decrypt that string. 3. The conditions in item 1 imply that decryption d must be a surjection onto Strings, otherwise there would be a string s encrypted into e(s), which cannot be decrypted: if s ∈ range(d) then d(e(s)=s.
  • 34.
    Cryptographic hash functions Passwordverification can be done using an encryption-like function that does not have a corresponding decryption function. Such a function is usually not an injection and is designed so that: For any string a, it is computationally easy to compute e(a); For any string b it is computationally infeasible to find an a s.t. e(a) = b; It is computationally infeasible to find a, a s.t a=a and e(a) = e(a ). A function with these properties, is called a cryptographic hash function .
  • 35.
    Identity verification anddigital signatures Password verification can be done as follows. The computer stores a cryptographic hash function e (which may be known to hackers). Alice chooses a string a for a password; the computer uses e to transform a into a string e(a) and stores only e(a) (but not a) in association with the username “Alice”. When a user tries to log in as “Alice” with a password a , the system allows it iff e(a ) is equal to the stored string e(a). Notice that e(a) does not need to be decrypted in this protocol. As the function e has properties specified above, a hacker who does not know Alice’s password a, most likely specifies another password a , and it is most likely to result in a value e(a )=e(a), preventing the log-in. Although an a , s.t. e(a )=e(a), may exist, it is hard to find it, even if the hacker gained knowledge of the stored value e(a). Also notice, that if Alice forgets her password, the computer (or system administrator) cannot tell Alice what it was. The same idea is used to verify authencity of messages or files via “digital signatures”.