lecture 3 functions

Upload: zubair-alam

Post on 29-May-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Lecture 3 Functions

    1/20

    Lecture 3

    Functions

    Chapter 2.3

    Kenneth Rosen Book

  • 8/8/2019 Lecture 3 Functions

    2/20

    Functions

    Def: Let A and B be sets. A function f (or more

    completely, f : A B) is a rule that assigns to

    each elementa A exactly one element f(a) B,

    called the value off at a.

    We also say that f : A B is a mapping from

    domain A to codomain B.

    f(a) is called the image of the element a, and the

    element a is called a preimage of f(a).

  • 8/8/2019 Lecture 3 Functions

    3/20

    Graphical Representations

    Functions can be represented graphically

    in several ways:

    AB

    a b

    f

    f

    x

    y

    PlotBipartite Graph

    Like Venn diagrams

    A B

  • 8/8/2019 Lecture 3 Functions

    4/20

    Some Function Terminology

    If it is written that f:ApB, and f(a)=b(where aA &bB), then we say:A is the domain off.

    B is the codomain off.

    b is the image ofa underf.

    a is apre-image ofb underf.

    In general,b may have more than 1 pre-image.

    The range RB offis R={b | a f(a)=b }.

  • 8/8/2019 Lecture 3 Functions

    5/20

    Range versus Codomain

    The range of a function might notbe its

    whole codomain.

    The codomain is the set that the functionis declaredto map all domain values into.

    The range is theparticularset of values in

    the codomain that the function actuallymaps elements of the domain to.

  • 8/8/2019 Lecture 3 Functions

    6/20

    Range vs. Codomain - Example

    Suppose I declare to you that: fis a

    function mapping students in this class to

    the set of grades {A,B,C,D,E}.

    At this point, you know fs codomain is:__________, and its range is ________.

    Suppose the grades turn out all As and

    Bs. Then the range offis _________, but its

    codomain is __________________.

    {A,B,C,D,E} unknown!

    {A,B}

    still {A,B,C,D,E}!

  • 8/8/2019 Lecture 3 Functions

    7/20

    Function Operator Example

    , (plus,times) are binary operatorsoverR. (Normal addition & multiplication.)

    Therefore, we can also add and multiplyfunctions f,g:RpR: (f g):RpR, where (f g)(x) = f(x) g(x)

    (f g):RpR, where (f g)(x) = f(x) g(x)

  • 8/8/2019 Lecture 3 Functions

    8/20

    One-to-One Functions

    A function is one-to-one (1-1), orinjective,

    oran injection, iff every element of its

    range has only1 pre-image.

    Bipartite (2-part) graph representationsof functions that are (or not) one-to-one:

    One-to-one

    Not one-to-one

    Not even a

    function!

  • 8/8/2019 Lecture 3 Functions

    9/20

    Onto (Surjective) Functions

    A function f:ApB is onto orsurjective ora surjection iff its range is equal to its

    codomain (bB,aA: f(a)=b).

    Think: An onto function maps the setA

    onto (over, covering) the entiretyof the

    set B, not just over a piece of it.

  • 8/8/2019 Lecture 3 Functions

    10/20

    Illustration of Onto

    Some functions that are, or are not,ontotheir codomains:

    Onto(but not 1-1)

    Not Onto(or 1-1)

    Both 1-1and onto

    1-1 butnot onto

  • 8/8/2019 Lecture 3 Functions

    11/20

    Some more examples

  • 8/8/2019 Lecture 3 Functions

    12/20

    Bijections

    A function fis said to be a one-to-one

    correspondence, ora bijection, or

    reversible, orinvertible, iff it is

    both one-to-one and onto.

    For bijections f:ApB, there exists aninverse of f, written f1:BpA, which is theunique function such that

    (where IA is the identity function onA)AIff ! Q

    1

  • 8/8/2019 Lecture 3 Functions

    13/20

    Composition of f and g

  • 8/8/2019 Lecture 3 Functions

    14/20

    Graphs of Functions

    We can represent a function f:ApB as aset of ordered pairs {(a,f(a)) | aA}.

    Note that a, there is only 1 pair(a,b).

    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 yfor eachx.

  • 8/8/2019 Lecture 3 Functions

    15/20

    A Couple of Key Functions

    In discrete math, we will frequently use the

    following two functions over real numbers:

    The floorfunction -

    :RZ, where -x (floor ofx) means the largest (most positive) integerex. I.e.,-x : max({iZ|ix}).

    The ceilingfunction :RZ, where x(ceiling ofx) means the smallest (most

    negative) integerux. -x : min({iZ|ix})

  • 8/8/2019 Lecture 3 Functions

    16/20

    Visualizing Floor& Ceiling

    Real numbers fall to their floor or rise to

    their ceiling.

    Note that ifxZ,-x { -x &x { x

    Note that ifxZ,-x = x =x.

    0

    1

    1

    2

    3

    2

    3

    ..

    .

    .

    . .

    . . .

    1.6

    1.6=2

    -1.4= 2

    1.4

    1.4= 1

    -1.6=1

    3

    3=-3= 3

  • 8/8/2019 Lecture 3 Functions

    17/20

    Plots with floor/ceiling

    Note that forf(x)=-x, the graph offincludes thepoint (a, 0) for all values ofa such that au0 anda

  • 8/8/2019 Lecture 3 Functions

    18/20

    Plots with floor/ceiling: Example

    Plot of graph of function f(x) = -x/3:

    x

    f(x)

    Set of points (x,f(x))

    +3

    2

    +2

    3

  • 8/8/2019 Lecture 3 Functions

    19/20

    Plots with floor/ceiling

  • 8/8/2019 Lecture 3 Functions

    20/20

    Review of 2.3 (Functions)

    Function variables f,g,h,

    Notations: f:ApB, f(a),f(A).

    Terms: image, preimage, domain, codomain,

    range, one-to-one, onto, strictly (in/de)creasing,

    bijective, inverse, composition.

    Function unary operatorf1,

    binary operators ,,etc., and . The RpZ functions -x and x.