relations and functions another foundational concept copyright © 2014 – curt hill
TRANSCRIPT
Relations and Functions
Another Foundational Concept
Copyright © 2014 – Curt Hill
Relations• Ordered pairs express relationships• A set of ordered pairs define a
relation• This relation may or may not be a
function• Every function is a relation but not
every relation is a function
Copyright © 2014 – Curt Hill
Example• An example relation is the
origin and destination of all airline flights– (Fargo, Bismarck)– (Fargo, Minneapolis)– (Fargo, Winnipeg)– (Minneapolis, Fargo)– (Minneapolis, St. Louis)
• When we see a set of ordered pairs, they are always a relation
Copyright © 2014 – Curt Hill
Terminology• The first item in the ordered
pair is the domain and second is the range– Rosen likes codomain instead of
range• The domain and range are sets• Airline example the domain
was {Fargo, Minneapolis} and the range {Bismarck, Minneapolis, Winnipeg, St. Louis} Copyright © 2014 – Curt Hill
Example• Suppose the following ordered
pairs:• (2,3),(2,4),(3,5),(4,2),(7,4)• What is the domain and range?
Copyright © 2014 – Curt Hill
The concept of a function• A function is a relation with
one item in the range corresponding to only one item in the domain
• A function is like a black box:– You push a value into the black
box– Turn the crank – Out comes a new number
• Example square root• Push in 1 out comes 1• Push in 4 out comes 2• Push in 9 out comes 3• Push in 16 out comes 4
Copyright © 2014 – Curt Hill
Airlines Again• The airline example was not a
function• Fargo flew to both Minneapolis and
Bismarck• A function must always give the
same output for the same input• A function may have many
parameters– If we increase the parameters from
origination city to also include flight number it will then be a function
Copyright © 2014 – Curt Hill
Functions• Also called mappings or
transformations– A function maps one or more values
onto a single value– It also transforms values
• Most sets of ordered pairs are the result of a function
• The parameter is the first item and the result is the second
• So the square root function produces the following ordered pairs (1,1) (4,2) (9,3) (16,4)
Copyright © 2014 – Curt Hill
Again• Many functions produce an
infinite number of ordered pairs
• We have two values here:– The independent and dependent
variable• Independent is the one that is
input to the function– There may multiple independents
• The dependent variable is output Copyright © 2014 – Curt Hill
Notation• A function may be represented
as:y = f(x)
• When we know the exact computation of f we can also write– f(x) = 2x+3
• We can also use set notation to represent a function: {(x,y)| y=3x-2}
• We traditionally use the letters starting at f to designate functions: f,g,h, F,G,H
Copyright © 2014 – Curt Hill
Equality• Two functions are equal if and only
if they have the same:– Domain– Range– Mapping
Copyright © 2014 – Curt Hill
Square• Consider the square function:
– f(x) = x2
– Domain: all reals– Range: positive reals and zero
• Notice that this maps two values onto a single value– f(2)=f(-2)=4
• Still a function since each value maps to just one
Copyright © 2014 – Curt Hill
Other functions• Contrast the square function with:
– f(x) = 2x+1– Domain and range is all reals
• This function has two properties that the square function does not:– One to one– Onto
• One to one means it does not map two values onto one
• Onto means that the domain and range are exactly the same
Copyright © 2014 – Curt Hill
Terminology• One to one functions are also
called injunctions– Adjective form is injective
• Onto functions are also called surjections– Adjective is surjective
• If both one to one and onto it is a bijection– Bijective
Copyright © 2014 – Curt Hill
Composite functions• We can also do composite
functions, which is f(g(x)) or (fg)(x)
• Suppose f(x) = 4x – 3• Suppose g(x) = 2x + 1• Then 2x+1 gets substituted for
x in f:• Then (f g)(x) = 4(2x+1)-3 =
8x+1• All this is having a function as an
input to another functionCopyright © 2014 – Curt Hill
Inverse Functions• Functions that are one to one allow
the possibility of an inverse function
• An inverse function reverses the mapping, range and domain of a function
• The inverse of f(x) is denoted f-1(x)• f(f-1(x)) = f-1(f(x)) = x• The inverse function only exists for
one to one functionsCopyright © 2014 – Curt Hill
Graphs• In this section a graph has nothing
to do with visual representation• Instead it is a set of ordered pairs
– Which is actually how we generate the visual representation that you remember from algebra
• Let us consider a couple of examples
Copyright © 2014 – Curt Hill
Graph Example 1• Suppose the domain of function f is
the set S = {-1, 0, 2, 4, 7}• If f(x) = 2x + 1, what is the graph?• It is a set of ordered pairs, the first
item comes from S and the second is found by plugging the item into f
• {(-1,-1), (0,1), (2,5), (4,9), (7,15)}
Copyright © 2014 – Curt Hill
Graph Example 2• The above method does not work
that well for very large sets• We do this using set builder
notation• Specify a set of ordered pairs and
give the formula for generation• If the domain of the previous
function was the real numbers then we would give the following:{(x,y)|xR y=f(x)}
Copyright © 2014 – Curt Hill
Important Functions• Floor of x is denoted by
– The largest integer smaller than x• Ceiling of x is denoted by
– The smallest integer larger than x• Factorial of a positive integer n is
n!– n! = 2*3*…*n
Copyright © 2014 – Curt Hill
Partial functions• We sometimes refer to functions
with limited domains as partial functions
• The square root function is not the inverse of the square function– It’s domain is reals greater than or
equal zero• Using an element outside of the
domain is undefined
Copyright © 2014 – Curt Hill
Exercises• 2.3
– 5, 9, 21, 27 61, 77
Copyright © 2014 – Curt Hill