Basic Structures: Functions, Sequences, and Sums - PowerPoint PPT Presentation

1 / 49
About This Presentation
Title:

Basic Structures: Functions, Sequences, and Sums

Description:

Bipartite Graph. Like Venn diagrams. A. B. Based on Rosen, Discrete ... Bipartite (2-part) graph representations of functions that are (or not) one-to-one: ... – PowerPoint PPT presentation

Number of Views:102
Avg rating:3.0/5.0
Slides: 50
Provided by: michael1563
Category:

less

Transcript and Presenter's Notes

Title: Basic Structures: Functions, Sequences, and Sums


1
Basic Structures Functions, Sequences, and Sums
2
Functions
  • From calculus, you are familiar with the concept
    of a real-valued function f, which assigns to
    each number x?R a particular value yf(x), where
    y?R.
  • But, the notion of a function can also be
    naturally generalized to the concept of assigning
    elements of any set to elements of any set.

3
Function Formal Definition
  • For any sets A, B, we say that a function f from
    (or mapping) A to B (fA?B) is a particular
    assignment of exactly one element f(x)?B to each
    element x?A.

4
Graphical Representations
  • Functions can be represented graphically in
    several ways

5
Some Function Terminology
  • If fA?B, and f(a)b (where a?A 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 1 pre-image.
  • The range R?B of f is b ?a f(a)b .

6
Range versus Codomain
  • The range of a function might not be its whole
    codomain.
  • The codomain is the set that the function is
    declared to map all domain values into.
  • The range is the particular set of values in the
    codomain that the function actually maps elements
    of the domain to.

7
Range vs. Codomain - Example
  • Suppose I declare to you that f is a function
    mapping students in this class to the set of
    grades A,B,C,D,F.
  • At this point, you know fs codomain is
    __________, and its range is ________.
  • Suppose the grades turn out all As and Bs.
  • Then the range of f is _________, but its
    codomain is __________________.

A,B,C,D,F
A,B,C,D,F
A,B
A,B,C,D,F
8
Operators (general definition)
  • An n-ary operator over the set S is any function
    from the set of ordered n-tuples of elements of
    S, to S itself.
  • E.g., if ST, F, ? can be seen as a unary
    operator, and ?,? are binary operators on S.
  • Another example ? and ? are binary operators on
    the set of all sets.

9
Constructing Function Operators
  • If ? (dot) is any operator over B, then we can
    extend ? to also denote an operator over
    functions fA?B.
  • E.g. Given any binary operator ?B?B?B, and
    functions f,gA?B, we define(f ? g)A?B to be
    the function defined by?a?A, (f ? g)(a)
    f(a)?g(a).

10
Function Operator Example
  • ?, (plus, times) are binary operators over
    R. (Normal addition multiplication.)
  • Therefore, we can also add and multiply functions
    f,gR?R
  • (f ? g)R?R, where (f ? g)(x) f(x) ? g(x)
  • (f g)R?R, where (f g)(x) f(x) g(x)

11
Function Composition Operator
  • For functions gA?B and fB?C, there is a special
    operator called compose (?).
  • It composes (creates) a new function out of f, g
    by applying f to the result of g.
  • (f ? g)A?C, where (f ? g)(a) f(g(a)).
  • Note g(a)?B, so f(g(a)) is defined and ?C.
  • Note that ? (like Cartesian ?, but unlike ,?,?)
    is non-commuting. (Generally, f ? g ? g ? f.)

12
Images of Sets under Functions
  • Given fA?B, and S?A,
  • The image of S under f is simply the set of all
    images (under f) of the elements of S.f(S) ?
    f(s) s?S ? b ? s?S f(s)b.
  • Ex Let Aa, b, c, d, e and B1, 2, 3, 4 with
    f(a) 2, f(b) 1, f(c) 4, f(d) 1 and f(e)
    1. The image of the subset S b, c, d is the
    set f(S) 1, 4.

13
One-to-One Functions
  • A function is one-to-one (1-1), or injective, or
    an injection, iff every element of its range has
    only 1 pre-image.
  • Formally given fA?B,x is injective ?
    (??x,y x?y ? f(x)?f(y)).
  • Only one element of the domain is mapped to any
    given one element of the range.
  • Domain range have same cardinality.

14
One-to-One Functions
  • Each element of the domain is injected into a
    different element of the range.
  • Ex Determine whether the function f from a, b,
    c, d to 1, 2, 3, 4, 5 with f(a)4, f(b)5,
    f(c)1 and f(d)3 is one-to-one.

Yes
15
One-to-One Illustration
  • Bipartite (2-part) graph representations of
    functions that are (or not) one-to-one

o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
16
Sufficient Conditions for 1-1ness
  • For functions f over numbers,
  • f is strictly (or monotonically) increasing iff
    xgty ? f(x)gtf(y) for all x, y in domain
  • f is strictly (or monotonically) decreasing iff
    xgty ? f(x)ltf(y) for all x, y in domain
  • If f is either strictly increasing or strictly
    decreasing, then f is one-to-one. e.g. x3

17
Onto (Surjective) Functions
  • A function fA?B is onto or surjective or a
    surjection iff its range is equal to its codomain
    (?b?B, ?a?A f(a)b).
  • An onto function maps the set A onto (over,
    covering) the entirety of the set B, not just
    over a piece of it.
  • E.g., for domain codomain R, x3 is onto,
    whereas x2 isnt. (Why not?)

18
Illustration of Onto
  • Some functions that are or are not onto their
    codomains

19
Bijections
  • A function f is a one-to-one correspondence, or a
    bijection, or reversible, or invertible, iff it
    is both one-to-one and onto.
  • For bijections fA?B, there exists an inverse of
    f, written f ?1B?A, which is the unique function
    such that
  • (I is the identity function)

20
Inverse Function
  • Definition Let f be a one-o-one correspondence
    from the set A to the set B. The inverse function
    of f is the function that assigns to an element b
    belonging to B the unique element a in A such
    that f(a)b. The inverse function of f is denoted
    by f-1. Hence, f-1(b)a when f(a)b.

21
The Identity Function
  • For any domain A, the identity function IA?A
    (variously written, IA, 1, 1A) is the unique
    function such that ?a?A I(a)a.
  • Some identity functions youve seen
  • ?ing 0, ing by 1, ?ing with T, ?ing with F, ?ing
    with ?, ?ing with U.
  • Note that the identity function is both
    one-to-one and onto (bijective).

22
Identity Function Illustrations
  • The identity function

23
Graphs of Functions
  • We can represent a function fA?B as a set of
    ordered pairs (a, f(a)) a?A.
  • Note that ?a, there is only 1 pair (a, f(a)).
  • For functions over numbers, we can represent an
    ordered pair (x, y) as a point on a plane. A
    function is then drawn as a curve (set of points)
    with only one y for each x.

24
A Couple of Key Functions
  • In discrete math, we will 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.

25
Visualizing Floor Ceiling
  • Real numbers fall to their floor or rise to
    their ceiling.
  • Note that if x?Z,??x? ? ? ?x?
  • ??x? ? ? ?x?
  • Note that if x?Z, ?x? ?x? x.

26
Plots with floor/ceiling
  • Note that for f(x)?x?, the graph of f includes
    the points (a, 0) for all values of a such that
    a?0 and alt1, but not for a1. We say that the
    set of points (a, 0) that is in f does not
    include its limit or boundary point (a, 1).
  • Sets that do not include all of their limit
    points are called open sets. In a plot, we draw
    a limit point of a curve using an open dot
    (circle) if the limit point is not on the curve,
    and with a closed (solid) dot if it is on the
    curve.

27
Plots with floor/ceiling Example
  • Plot of graph of function f(x) ?x/3?

28
Review of Functions
  • Function variables f, g, h,
  • Notations fA?B, f(a), f(A).
  • Terms image, pre-image, domain, codomain, range,
    one-to-one, onto, strictly (in/de)creasing,
    bijective, inverse, composition.
  • Function unary operator f ?1, binary operators
    ?, ?, etc., and ?.
  • The R?Z functions ?x? and ?x?.

29
Sequences Summation
  • A sequence or series is just like an ordered
    n-tuple, except
  • Each element in the series has an associated
    index number.
  • A sequence or series may be infinite.
  • A summation is a compact notation for the sum of
    all terms in a (possibly infinite) series.

30
Sequences
  • Formally A sequence or series an is identified
    with a generating function f S?A for some subset
    S?N (often SN or SN?0) and for some set A.
  • If f is a generating function for a series an,
    then for n?S, the symbol an denotes f(n), also
    called term n of the sequence.
  • The index of an is n. (Or, often i is used.)

31
Sequence Examples
  • Many sources just write the sequence a1, a2,
    instead of an, to ensure that the set of
    indices is clear.
  • An example of an infinite series
  • Consider the series an a1, a2, , where
    (?n?1) an f(n) 1/n. Then an 1, 1/2, 1/3,

32
Example with Repetitions
  • Consider the sequence bn b0, b1, (note 0 is
    an index) where bn (?1)n.
  • bn 1, ?1, 1, ?1,
  • Note repetitions! bn denotes an infinite
    sequence of 1s and ?1s, not the 2-element set
    1, ?1.

33
Recognizing Sequences
  • Sometimes, youre given the first few terms of a
    sequence, and you are asked to find the
    sequences generating function, or a procedure to
    enumerate the sequence.
  • Examples Whats the next number?
  • 1,2,3,4,
  • 1,3,5,7,9,
  • 2,3,5,7,11,...

34
The Trouble with Recognition
  • The problem of finding the generating function
    given just an initial subsequence is not well
    defined.
  • This is because there are infinitely many
    computable functions that will generate any given
    initial subsequence.
  • We implicitly are supposed to find the simplest
    such function (because this one is assumed to be
    most likely).

35
What are Strings, Really?
  • We say finite sequences of the form a1, a2, ,
    an are called strings.
  • Strings are often restricted to sequences
    composed of symbols drawn from a finite alphabet.
  • The length of a (finite) string is its number of
    terms (or of distinct indexes).

36
Strings, more formally
  • Let ? be a finite set of symbols, i.e. an
    alphabet.
  • A string s over alphabet ? is any sequence si
    of symbols, si??, indexed by N or N?0.
  • If a, b, c, are symbols, the string s a, b,
    c, can also be written abc (i.e., without
    commas).
  • If s is a finite string and t is a string, the
    concatenation of s with t, written st, is the
    string consisting of the symbols in s, in
    sequence, followed by the symbols in t, in
    sequence.

37
More String Notation
  • The length s of a finite string s is its number
    of positions (i.e., its number of index values
    i).
  • If s is a finite string and n?N, sn denotes the
    concatenation of n copies of s.
  • ? denotes the empty string, the string of length
    0.
  • If ? is an alphabet and n?N,?n ? s s is a
    string over ? of length n, and? ? s s is a
    finite string over ?.

38
Summation Notation
  • Given a series an, an integer lower bound (or
    limit) j?0, and an integer upper bound k?j, then
    the summation of an from j to k is written and
    defined as follows
  • Here, i is called the index of summation.

39
Generalized Summations
  • For an infinite series, we may write
  • To sum a function over all members of a set
    Xx1, x2,

40
Simple Summation Example
  • An infinite series with a finite sum
  • Using a predicate to define a set of elements to
    sum over

41
Summation Manipulations
  • Some handy identities for summations

42
More Summation Manipulations
  • Other identities that are sometimes useful

43
Example Impress Your Friends
  • Boast, Im so smart give me any 2-digit number
    n, and Ill add all the numbers from 1 to n in my
    head in just a few seconds.
  • i.e., Evaluate the summation
  • There is a simple closed-form formula for the
    result, discovered by Euler at age 12!

44
Eulers Trick, Illustrated
  • Consider the sum12(n/2)((n/2)1)(n-1)n
  • n/2 pairs of elements, each pair summing to n1,
    for a total of (n/2)(n1).

45
Example Geometric Progression
  • A geometric progression is a series of the form
    a, ar, ar2, ar3, , ark, where a,r?R.
  • The sum of such a series is given by

46
Some Shortcut Expressions
Geometric series.
Eulers trick.
Quadratic series.
Cubic series.
47
Using the Shortcuts
  • Example Evaluate
  • Use series splitting.
  • Solve for desired summation.
  • Apply quadratic series rule.

48
Nested Summations
  • These have the meaning youd expect.
  • Note issues of free vs. bound variables, just
    like in quantified expressions, integrals, etc.

49
Summations Conclusion
  • You need to know
  • How to read, write evaluate summation
    expressions like
  • Summation manipulation laws we covered.
  • Shortcut closed-form formulas, how to use them.
Write a Comment
User Comments (0)
About PowerShow.com