chapter four functions. section 4.1 a function from a set d to set r (f: d r) is a relation from d...
TRANSCRIPT
![Page 1: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/1.jpg)
Chapter Four
Functions
![Page 2: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/2.jpg)
Section 4.1
A function from a set D to set R (f: DR) is a relation from D to R such that each x in D is related to one and only one y in R. D is called the domain of the function and R is called the range of the function.
Note: every function is a relation but not every relation is a function.
Ex:
The cost of gold is a function of its weight.
![Page 3: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/3.jpg)
Functions
Functions are represented by cloud diagrams.
X
t
f(x)
f(t)
![Page 4: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/4.jpg)
Functions
Ex1:
If f(x)=x+2 is used as a formula that defines a function from {-1,0,1,2} to {1,2,3,4}, what relation defines f??
Solution:
f = {(-1,1),(0,2),(1,3),(2,4)}
![Page 5: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/5.jpg)
Functions
Ex2:
The relation R ={(a,2),(a,3),(b,4),(c,5)} is not a function from D={a,b,c} to R={2,3,4,5}, why?
![Page 6: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/6.jpg)
Functions
Ex3:
The relation {(a,3),(c,2)} from the domain {a,b,c} to the range {2,3,4,5} is not a function.
why?
![Page 7: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/7.jpg)
Functions
To determine if a relation is a function:
1- each element in the domain is related to an element in the range.
2- no element in the domain is related to more than one element in the range.
![Page 8: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/8.jpg)
Functions
A function can have 2 or 3 variables or more.
f(x,y)= xy+x^2
G(x,y,z)= x+2y+z
![Page 9: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/9.jpg)
One to one functions
A function is one to one (or injection) if different elements of the domain are related to different elements of the range.
Ex:
ca
1 2 3
b
4
d
![Page 10: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/10.jpg)
Ex:
Is the following one-to-one? Why?
1 2 3 4
a b c d
![Page 11: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/11.jpg)
Onto functions
A function is called onto (surjection) if each element of the range is related to at least one element in the domain.
Ex:1 2 3
a b c d
![Page 12: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/12.jpg)
Bijection functions
A function is one to one and onto (bijection) or one to one correspondence if each element in the range is related to one and only one element of the domain.
Ex:
a b c d
1 2 3 4
![Page 13: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/13.jpg)
Functions
Ex4:Determine whether each if the following is a function, if so is it
onto? Is it one to one?1- D= {a,b,c,d} R={1,2,3,4}F= { (a,1),(a,2),(b,1), (c,2), (d,3)}2- D= {-2,-1,0,1,2} R= {0,1,4}F(x)=x^23- D= {-2,-1,0,1,2} R= {0,1,2,3,4}F(x)=x^24- D= {0,1,2} R= {0,1,4}F(x)=x^2
![Page 14: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/14.jpg)
The image of a function
The set of range values actually related to some domain elements is called the image of a function.
![Page 15: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/15.jpg)
Sequences, n-tuples and sums
A function whose domain is a set of consecutive integers is called a sequence.
Ex:
If s (i)=i for each i>=0, then s is a sequence.
Si is the ith term of the sequence.
![Page 16: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/16.jpg)
Sequences, n-tuples and sums
Ex5:
Write the third term of the sequence
Si= i(i-1)+1 for i>=1
Solution: s3=3(2)+1=7
![Page 17: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/17.jpg)
Sequences, n-tuples and sums
Ex6:Write the first 5 terms for the sequence si=i^2+2, for
i>=0
Solution:S0= 2S1= 3S2=6S3=11S4=18
![Page 18: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/18.jpg)
Sequences, n-tuples and sums
Ex7:
Find a formula for the ith term of the sequence 1,4,9,16,25. For what values of i is your formula valid?
Solution: si=i^2, i>=1
![Page 19: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/19.jpg)
Sequences, n-tuples and sums
(1,2,4,9,16) is a 5-tuple. Order is important.
![Page 20: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/20.jpg)
Summing Finite Sequences
∑ ai (i=m, n) = am + am+1 + am+2 +…..+an Ex8:Find ∑ i^2 (i=1, 3).Solution:1+4+9=14Ex9:Find ∑ 2j-1 (j=0, 4).Solution:-1+1+3+5+7=15
![Page 21: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/21.jpg)
Gauss’s Formula
∑ i (i=1, n) = n(n+1)/2
Proof given in class.
![Page 22: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/22.jpg)
Summing Finite Sequences
Theorem:- ∑(ai+bi) (i=m,n) = ∑ ai (i=m,n) + ∑ bi (i=m,n) - ∑cai (i=m,n)= c ∑ai (i=m,n) - ∑c (i=m,n)= c(n-m+1) Theorem:The sum of the arithmetic series ∑(a*i+b)
(i=1,n) = an(n+1)/2+nb*proof given in class
![Page 23: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/23.jpg)
Summing Finite Sequences
Ex:
solve
∑(3i-1)(i=1,10)
![Page 24: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/24.jpg)
Section 4.2
Cartesian graphsThe Cartesian graph of a relation R consists of all points (x,y) in
the plane such that x is related to y by R ( that is, (x,y) ε R or xRy).
Ex: Graph of- X2+y2 =1- Y=X2
- Y=X3
- Y=x- Y=2x
Graphs drawn in class
![Page 25: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/25.jpg)
Functions
Vertical lines are used to determine whether a certain relation is a function
Horizontal lines are used to determine whether a function is one to one or onto.
If all vertical lines cross the graph exactly once over a certain domain then the graph is a function on that domain
If the horizontal lines cross the function’s graph more than once it is not one to one.
If there are horizontal lines that do not cross the function’s graph on a certain range, the function is not onto on that range.
![Page 26: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/26.jpg)
Composition and Inverse
The composition of function f with a function g is the relation f g (f composed with g) that contains the pair (x,y) if and only if y=f(g(x)) (f of g of x)
The image of g must be a subset of the domain of f in order for f g to be defined
![Page 27: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/27.jpg)
Composition and Inverse
Find f(g(x))
1- f = { (1,-1), (2,-2),(3,-3),(4,-4),(5,-5)}
g= { (1,3), (2,4), (3,5)}
2- f(y) = y3+1
g(x)= x 1/3
3- f(x)= x3+1
g(x)= (x-1)1/3
![Page 28: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/28.jpg)
Composition and Inverse
Ex:
454g in 1 lb
16 oz in 1lb
P(x)= x/16
G(x)= 454x
Find the equation that converts from ounces (oz) to pounds (lb)
![Page 29: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/29.jpg)
Inverses
Whenever f and g are two functions such that f(g(x))=x and g(f(y))=y for each x in the domain of g and each y in the domain of f, we say that f and g are inverses of each other, f is the inverse of g and g is the inverse of f
Theorem:
A function g from D to R has an inverse if and only if g is one to one. The domain of g-1 is the image of g.
![Page 30: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/30.jpg)
Inverse
Ex:
G(x) = x3 -1
Find the inverse and its domain
![Page 31: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/31.jpg)
Inverse
Theorem: If g is one to one, the points on the graph of g-1 may
be obtained by interchanging the x and y coordinates of the points on the graph of g.
Ex:Find the inverse of y=x3 and its graphEx:F(x) = 2x is to one from R to R+
Find the inverse and its graph
![Page 32: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/32.jpg)
Section 4.3 ( Growth Rate of Functions)
Algorithm smallestInput: a list of numbers in any orderOutput: a list of the same numbers with the smallest firstSteps:For i from 2 to n do:If (the number in position i < the number in position 1)Then exchange both numbersExample: apply algorithm on 5,2,1,3 and on 5,4,3,2 for the worst
case- Find the total time taken by the algorithm
![Page 33: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/33.jpg)
Quadratic time algorithms
Selection Sort
For(i=0; i<=n-2; i++)
{
L= min-position(iteration,n-1);
Exchange (list [iteration], list [L]);
}- Apply on 8,2,4,0,1,3- Find the total time taken by the algorithm
![Page 34: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/34.jpg)
Growth Rate of Functions
We say that f is a big O of g, or f(x) = O(g(x)),
If there is a constant c>0 and a number N such
that for all x>N, f(x) <= c.g(x)
Ex:
f(x)= x2
g(x)= x3
Show that f(x) = O(g(x))
![Page 35: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/35.jpg)
Growth Rate of Functions
Consider
F(n) = 3n2+2n
G(n)= n2
Show that f(n)= O(g(n))
![Page 36: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/36.jpg)
Growth Rate of Functions
If lim x∞ g(x)/f(x) = ∞
Then g(x) is not O(f(x)) If lim x∞ g(x)/f(x) = 0
Then g(x)=O(f(x)), but not vise versa If lim x∞ g(x)/f(x) = c, where c is constant ≠ 0
Then f(x)=O(g(x)) and g(x)=O(f(x))
![Page 37: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/37.jpg)
Growth Rate of Functions
Ex:f(x)= 10xG(x)= x2
H(x)=x3
Is f(x) = O(g(x))?Is G(x)=O(h(x))?Is G(x)=O(f(x))?
![Page 38: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/38.jpg)
Growth Rate of Functions
Ex:
F(x)=2x
G(x)=4x
![Page 39: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/39.jpg)
Growth Rate of Functions
Theorem
For any real number r, x= O(2x) and
1- 2x is not O(xr)
2- logx = O(xr)
3- xr is not O(logx)
![Page 40: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/40.jpg)
Growth Rate of Functions
Ex:
F(x)= xx
G(x)= x2x
![Page 41: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/41.jpg)
Growth Rate of Functions
1- constants2- log(log(x))3- log(x)4- (log(x))n
5- (x)1/k
6- x7- x2
8- xn
9- 2x
10- x!
![Page 42: Chapter Four Functions. Section 4.1 A function from a set D to set R (f: D R) is a relation from D to R such that each x in D is related to one and](https://reader035.vdocuments.us/reader035/viewer/2022062500/5697bfaa1a28abf838c9a925/html5/thumbnails/42.jpg)
Theorem
F(x) is of order g(x) means that f(x)= O(g(x))and g(x)= O(f(x))Ex: Which of the following functions are O(x2) and which
of them are of order x2?- f(x) = 2x(x)1/2
- f(x)= x2+(x)1/2
- F(x)=x3+(x)1/2
- F(x)=(x3+1)/x