Chapter 7 Functions - PowerPoint PPT Presentation

1 / 59
About This Presentation
Title:

Chapter 7 Functions

Description:

1. If 14 cards are randomly chosen a standard deck. prove that two of ... i.e. card(A) = card(B) if and only if there is a bijection between them. Definition ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 60
Provided by: oliv50
Category:

less

Transcript and Presenter's Notes

Title: Chapter 7 Functions


1
Chapter 7 Functions
2
Non-precise definition A function f from a set
X to another set Y is a rule that assigns exactly
one element (in Y) to each element x in X.
Function defined by arrow diagrams
f
X
Y
1
a
2
b
3
c
4
Note this works only for finite sets.
3
Arrow diagram of a function with animation.
2
3
a
5
b
8
c
13
d
19
e
26
4
The following diagram does not represent a
function, do you know why?
2
3
a
5
b
8
c
13
d
19
e
26
5
Functions defined by formulas
Example f (x) 3x2 5 for every x in
?. g(x) exsinx for every x in ?.
These functions can also be (partially)
represented by graphs instead of arrow diagrams.
6
7.1 Functions Defined on General Sets
Definition Given any two sets X and Y, a
function f from X to Y is subset of the
Cartesian product X Y such that
(a) for every a ? X, there is one y ? Y
such that (a, y) ? f (b) if
(a, y) ? f and (a, z) ? f , then y z (in
other words, there is one and only one output for
each input) The set X is called the domain of f
, and range of f b ? Y
b f (a) for some a ? X Given any b ? Y,
inverse image of b f -1(b)
a ? X f (a) b and this set can be empty.
7
7.1 Functions Defined on General Sets
Equality of functions Suppose that both f and
g are functions from X to Y, then we say that f
is equal to g, written f g if and only if
for every a ?
X, f (a) g(a)
8
Examples
In mathematical analysis, many functions are
defined by descriptions rather than by formulas.
All examples below are functions from ? to ?.
9
Examples
In mathematical analysis, many functions are
defined by descriptions rather than by formulas.
All examples below are functions from ? to ?.
2. This function is continuous only at 0.
10
3. This function is differentiable at 0 but is
discontinuous elsewhere.
11
3. This function is differentiable at 0 but is
discontinuous elsewhere.
4. This function is continuous only at the
irrationals.
Remark There is no function which is continuous
only at the rationals.
12
Exercise Let f be a function from ? to ? such
that
whenever x ? 1. Find the value of
13
  • Functions defined on the set of bit strings
  • Let S 0, 1 and S be the set of all strings
    over S.
  • Define g S ? S by
  • g(s) the reverse of s from right to
    left.
  • eg. g(10111) 11101
  • (2) Define f S S ? S by
  • f(s, t) the concatenation of s
    followed by t.
  • eg. f (000, 1101) 0001101

14
Check digit functions
The last digit of each UPC or ISBN is always
created to catch errors. In other words, there is
a formula to compute the last digit using all but
the last digit as input. If this last digit does
not match the formula, we know that the number
must be wrong.
  • Example
  • In the UPC 0-53600-10054-0, the last digit 0 is
    chosen such that 03 51 33 61 03
    01 13 01 03 51 43 01is
    divisible by 10.

In dot product notation, this can be written as
(0,5,3,6,0,0,1,0,0,5,4,0) ? (3,1,3,1,3,1,3,1,3,1,
3,1) MOD 10 0
15
2. Each ISBN is a 10 digit number such as
0-88385-720-0. The last digit a10 is chosen
such that (0,8,8,3,8,5,7,2,0,a10) ?
(10,9,8,7,6,5,4,3,2,1)MOD 11 0 In this case,
a10 0 will work. And if a10 10, we use the
letter X instead.
In both examples, we see that there is always at
most one output from each input, these procedures
of generating check digits are functions even
though they cannot be easily described by
formulas.
16
Coding functions
  • A typical coding function usually assigns a
    unique numeric code (often a binary code) to each
    input.
  • The three common reasons for assigning codes are
  • secrecy (or privacy),
  • data compression,
  • error correction.

17
Examples of Error correcting Codes.
Hamming 7,4,3 binary linear code. (1950) This
is the 1st error detecting code (cannot correct
error yet). Each input is a binary sting of
length 4, and the function will add 3 check
digits at the end and make the output a string of
length 7.
input output 0000 ? 0000000 0001
? 0001011 0010 ? 00101110100 ?
01001011000 ? 1000110
input output 1100 ? 1100011 1010
? 1010001 . etc.
It can detect 1 error out of the 7 bits, but
cannot correct it.
18
Reed-Solomon Codes(1960)
  • The commercially used version for CDs, DVDs,
  • cellphones etc. is the 255,223,33-code, in
    which
  • Every codeword is a 255-byte string, hence 2040
    bits.
  • In each codeword, 223 bytes are from the original
    message (others are check digits)
  • It can correct up to 16 incorrect bytes (i.e. 16
    bits in 16 different bytes in the worst case, and
    168 bits in a row in the best case.)

19
Finite-State Automata
A finite state automaton is a machine that can
make a few decisions, but it is much weaker than
a computer because it does not have an expandable
memory and it can only run one predetermined
program.
Examples Vending machines,
20
  • Definition
  • A finite-state automaton consists of five objects
  • a set I called the input alphabet, of input
    symbol
  • a set S of states the automaton can be in
  • a designate state s0 , called the initial state
  • a designate set of states called the set of
    accepting states
  • a next-state function N S I ? S

21
Finite-State Automaton
Simple Vending Machine accepts only 25 or
50 - gives a bottle of soda for 1 - does not
return changes
50
25 desposited
75 desposited
25
25
25
50
25
0 desposited
25
1 or more desposited
50
50
50 desposited
50
22
The Next-State Table
Input
Original State
Next State in blue
23
Examples
  • Construct a finite state automaton that accepts
    exactly the set of strings of 0s and 1s that
    start with the pattern 110.
  • Construct a finite state automaton that accepts
    exactly the set of strings of 0s and 1s for
    which the number of 1s is divisible by 3.
  • Construct a finite state automaton that accepts
    exactly the set of strings of 0s and 1s that do
    not contain the pattern 1011.

24
Question
For any given set A of strings of 0s and 1s,
can we build a finite-state automaton that
accepts exactly the strings in the set A? In
particular, can we build one machine that accepts
exactly those strings where the number of 0s is
equal to the number of 1s? And can we build one
machine that accepts exactly those strings that
are palindromes? (eg. 0110110)
25
7.2 1-to-1, Onto, and Inverse functions
Definition Let F be a function from a set X to a
set Y. F is one-to-one (or injective) if, for all
elements x1 and x2 in X
Or equivalently,
Remark If the function f is from ? to ? and is
differentiable, then f is one-to-one if f (x)
gt 0 for all x or if f (x) lt 0 for all x.
26
This is a one-to-one function.
This is not a one-to-one function.
2
3
a
5
b
8
c
13
d
19
e
26
We can call this a many-to-one function.
27
Examples
1. The identity function id ??? defined by
id (x)
x is one-to-one
2. Any linear function f(x) ax b with a ? 0
is one-to-one from ? to ?.
28
Examples
3. Show that the function
is one-to-one throughout its domain.
4. Show that the coding function f NNN ? N
defined by
is also one-to-one.
29
Properties of one-to-one functions. 1. If f(x)
? ? ? is one-to-one, and a, b, c are constants
with a ? 0, b ? 0, then
af(bx) c is also
one-to-one.
2. The composition of two or more one-to-one
functions is also one-to-one. example
e sin(x) is one-to-one on the domain (-p/2, p/2).
30
7.2 1-to-1 and Onto, Inverse functions
Definition Let F be a function from a set X to a
set Y. F is onto (or surjective) if,

range of F Y
Or equivalently,
31
This function is not onto.
This function is onto (even though not
one-to-one).
3
a
b
8
c
d
19
e
32
Theorem For any set S (finite or infinite),
there is no onto function from S to P (S).
33
7.2 1-to-1 and Onto, Inverse functions
Definition Let f be a function from a set X to
a set Y. If f is both one-to-one and onto,
then we say that f is a bijection or a
one-to-one correspondence between X and Y.
Theorem Suppose that f X ? Y is a bijection,
then there is a function f -1 Y ? X
defined by f -1 (y) the unique
element x in X such that f (x) y
Definition The function f -1 defined above is
called the inverse of f.
34
7.2 1-to-1 and Onto, Inverse functions
Theorem If X and Y are sets and f X ? Y is
one-to-one and onto, then
f -1 Y ? X is also one-to-one and onto.
Theorem If X and Y are sets and f X ? Y is a
function. Suppose further that there is a
function g Y ? X such that
g ? f X ?
X is the identity
function, then f is one-to-one and onto.
35
Special cases
  • Suppose that both X and Y are finite sets and f
    X ? Y is a function,
  • if n(X) gt n(Y), then f cannot be one-to-one,
  • if n(X) lt n(Y), then f cannot be onto,
  • if n(X) n(Y), and f is one-to-one, then f is
    also onto,
  • if n(X) n(Y), and f is onto, then f is also
    one-to-one.

36
Example
Let f R ? R be a continuous but non-constant
function that preserves addition and
multiplication, i.e. f (x y) f (x)
f (y) and f (x y) f (x) f (y) Prove
that f is one-to-one.
  • Solution
  • We need to divide the proof into several steps.
  • prove that f (0) 0
  • prove that f (-x) - f (x)
  • prove that f (x) 0 implies that x 0.
  • prove that f (x) f (y) implies that x y.

In fact, we can prove (in exercise) that this f
is actually the identity function, hence it is
also onto.
37
7.3 The Pigeonhole Principle
Definition A set S is called finite if there is
no bijection between S and a proper subset of
S. A set is called infinite if it is not
finite. (In other words, a set S is infinite if
we can construct a bijection from S to a proper
subset of S.
ExampleThe set of natural numbers N is
infinite because we can construct the bijective
function
f(n) n 1 from N to a proper subset
1, 2, 3, 4, of N itself.
38
Theorem For any function f from a finite set X
to a finite set Y, if n(X) gt n(Y), then f
cannot be one-to-one.
This theorem is called the Pigeon hole Principle
or the Dirichlet box principle.
39
Examples
1. If 14 cards are randomly chosen a standard
deck prove that two of them must be of
the same denomination.
2. If 9 different integers are chosen from the
set 1, 2, 3, , 16
prove that one of them must be
odd.
3. If 6 different integers are chosen from the
set S 3, 4, 5, 6, 7, 8, 9, 10,
11, 12 prove that there must be two whose
sum is 15.
40
Examples
4. How many integers from 100 through 999 must be
chosen in order to guarantee at least two of them
have a digit in common?
5. Show that within any set of 13 integers chosen
from the set 2, 3, 4, , 40, at least two of
them have a common divisor bigger than 1.
41
Examples
6. Given a set of 52 distinct integers, show that
there must be two of them whose sum or difference
is divisible by 100.
42
The Generalized Pigeon hole Principle
Let X and Y be finite sets such that
n(X ) gt k n(Y )
for some positive integer k, then for any
function f X ? Y, there must be at least one
b ? Y such that n(f
-1(b)) gt k
43
More advanced examples
1. If 101 different numbers are chosen from 1 to
200 inclusively, prove that there must be two
with the property that one is divisible by
another.
2. For any positive integer n, if you choose any
n different integers, prove that there must be a
sub-collection whose sum is divisible by n.
44
More advanced examples
3. A basketball team had to play at least one
game each day in a 30 day period. If we know that
they did not play more than 45 games in that 30
days, prove that there must be a consecutive
period of days that they played exactly 14 games.
(Hint the number 14 comes from the formula 230
- 45 - 1)
4. Prove that in any sequence of n2 1 distinct
integers, there must be a subsequence of length n
1 that is either increasing or
decreasing. (This is not really a proof by the
pigeonhole principle, but rather a proof by
contradiction that uses the pigeonhole principle.)
45
7.5 Cardinality and Applications
Definition Two sets A and B are said to have the
same cardinality i.e.
card(A) card(B) if and only if there is a
bijection between them.
Definition A set S is said to be infinite if S
has at least one proper subset W such that
card(W) card(S)
Examples card(0,1,2,3,4,5, )
card (0,2,4,6,8, ) card (Z)
46
Exercises
1. Show that the interval (0, 1) has the same
cardinality as the longer interval (5,
8).
2. Show that the interval (0, 1) has the same
cardinality as the infinite interval (0,
8).
3. Show that the interval (0, 1) has the same
cardinality as the infinite interval
(-8, 8).
4. Show that the closed interval 0, 1 has the
same cardinality as the open interval (0, 1).
47
4. Show that the closed interval 0, 1 has the
same cardinality as the open interval (0, 1).
Solution Consider the function
It is not difficult to check that f is one-to-one
and it maps 0, 1 onto (0, 1)
48
Definition Given any two sets A and B, we say
that card(A) card(B) if
there is a injection from A into B.
Schröder-Bernstein Theorem Given two sets A and
B, if card(A) card(B) and card(A) card(B),
then card(A)
card(B).
49
Theorem The set of real numbers has the same
cardinality as the set S x
? ? 0 lt x lt 1
Proof Consider the function
which is one-to-one and maps (0, 1) exactly onto
(-8, 8).
50
Countable Sets
Definition A set S is said to be countably
infinite if it has the same cardinality as the
set of natural numbers N. A set S is said to be
countable if it is either finite or countably
infinite.
Loosely speaking, a set is countable if you can
put its elements in a linear order such that
every elements has only finitely many
predecessors.
A set S is said to be uncountable if it is not
countable.
51
  • Theorem
  • Any subset of a countable set is countable.
  • The union of two countable sets is countable.
  • The Cartesian product of any two countable sets
    is countable.

Examples (a) The set Z of integers is
countable. (b) The set Q of rational numbers is
countable.
Axiom of countable choice Any countable union of
countable sets is countable. (Note this is the
weakest version of the general axiom of choice.)
52
Theorem The set Q of positive rational
numbers is countable.
Proof
53
Theorem The set of real numbers in the interval
0, 1 is uncountable.
Proof (Cantor Diagonalization method) By
contradiction. Suppose that we can arrange those
numbers in a sequence a1, a2, a3, ??? and
since each number in the sequence is a decimal,
we can write their decimal forms as
a1 0.a11a12a13a14
a2 0.a21a22a23a24
a3 0.a31a32a33a34
(here we use the non-terminating form if
there are two choices, i.e. 1 0.999)
54
Next we construct a number b whose decimal form
is b 0.b1b2b3b4 and such that
bk akk 1 if akk lt 9 and
bk 0 if akk 9
Then b will be a real number between 0 and 1, but
b is not equal to any of the numbers in the list
a1, a2, a3, , a contradiction!
55
Theorem The set of algebraic numbers is countable
and hence there are uncountably many
transcendental (i.e. non-algebraic) numbers.
56
Theorem Given any set S, the power set P (S) has
a strictly larger cardinality than S.
Definition The first infinite ordinal number ? is
defined to be the set 0, 1, 2,
3, ??? ? 1 is defined to be the 2nd infinite
ordinal number, and it is the set 0, 1, 2, 3,
??? , ? (note there is no ? 1 because ? is
not constructed by adding just one more element
to any set.) ? (n 1) is the set 0, 1, 2, 3,
??? , ?, ?1, ?2, ???, ?n ? ? is the set
0, 1, 2, 3, ??? , ?, ?1, ?2, ?3, ???
57
Theorem ? n is countable for any whole number
n. ? ? is countable. ?2 ( ??) is
countable. ?n is countable for all whole number
n. ?? is uncountable.
Definition 2? is the set of all functions from ?
to 2 (0, 1) ?? is the set of all functions
from ? to ?.
Theorem (a) card(2?) card(P (?)) (b) card(2?)
card(??) (c) card(?) card(2?)
58
Comment Since card(P (?)) is uncountable, and any
set obtained from ? using set operations other
than power set is countable, hence we say that
card(P (?)) is a weakly inaccessible cardinal.

Continuum Hypothesis There is no set whose
cardinality is strictly between that of card(?)
and card(P (?))
General Continuum Hypothesis For any infinite set
X, there is no set whose cardinality is strictly
between that of card(X) and card(P (X))
59
Application in computer science
Theorem Given any computer language, the set of
programs in that language is countable.
Corollary The set of computable functions from ?
to ? is countable. Hence there are uncountably
many functions from ? to ? that are not
computable (i.e. they cannot be generated by a
computer program.)
Write a Comment
User Comments (0)
About PowerShow.com