Functions and Inverses, Study notes of Computer Science

The concept of functions, their properties, one-to-one and onto functions, and the inverse of a function. It includes various examples and explanations of function definitions, domains, codomains, ranges, and bijective functions. The document also discusses the inverse of a function and its existence conditions.

Typology: Study notes

Pre 2010

Uploaded on 07/30/2009

koofers-user-8r5-1
koofers-user-8r5-1 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture 10: 4/30/2009
Announcements: Ps5 out: Review Problems, not to be turned in
Ps4 solutions out; Ps5 Solutions out later today and Sample midterm solutions
Midterm Tues, May 5; Open Book and Notes; Coverage through relations (today)
Discussion this Friday: Review session (run by me). Bring questions
------------
Functions (Chapter 3)
------------
Definition: A function f is a relation on A x B such that
there is one and only one pair a R b for every a A.
We write b=f(a) to mean that (a,b) f.
(Just one way to do it: we could have defined functions as the primitive
and used the function to define the relation, putting in a pair
(a,f(a)) for every a A.)
- We call A the domain of f, Dom(f).
- We call B the *codomain* (or *target*) of f.
Note that this does not mean the set {b: f(a)=b for some a in A}!
That is a different (and important) st called the *Range* (or *image*)
of f. Denote it f(A).
Example 1:
Domain={1,2,3}
f(a) = a^2.
Dom(f) = {1,2,3}
f(A) = {1,4,9}
co-domain: unclear, might be \N, might be \R, ....
Example 2:
Domain = students in this class
b(x) = birthdays, encoded as {1,..,12} x {1..31}.
b(phil) = (7,31)
b(ellen) = (4,1)
pf3
pf4
pf5

Partial preview of the text

Download Functions and Inverses and more Study notes Computer Science in PDF only on Docsity!

Lecture 10: 4/30/ Announcements: Ps5 out: Review Problems, not to be turned in Ps4 solutions out; Ps5 Solutions out later today and Sample midterm solutions Midterm Tues, May 5 ; Open Book and Notes; Coverage through relations (today) Discussion this Friday: Review session (run by me). Bring questions


Functions (Chapter 3)

Definition: A function f is a relation on A x B such that there is one and only one pair a R b for every a ∈A. We write b=f(a) to mean that (a,b) ∈ f. (Just one way to do it: we could have defined functions as the primitive and used the function to define the relation, putting in a pair (a,f(a)) for every a ∈A.)

  • We call A the domain of f, Dom(f).
  • We call B the * codomain * (or target) of f. Note that this does not mean the set {b: f(a)=b for some a in A}! That is a different (and important) st called the * Range * (or image) of f. Denote it f(A). Example 1: Domain={1,2,3} f(a) = a^2. Dom(f) = {1,2,3} f(A) = {1,4,9} co-domain: unclear, might be \N, might be \R, .... Example 2: Domain = students in this class b(x) = birthdays, encoded as {1,..,12} x {1..31}. b(phil) = (7,31) b(ellen) = (4,1)

Example 3: f: \R - > \R defined by f(x) = x^2 is it a function? Represent it as a graph Two functions f and g are equal, f=g, if their domains and ranges are equal and f(x) = g(x) for all x in Dom(f) Function composition f o g f: A - > B, g: B - > C then (g o f) : A - > C is defined by (g o f)(x) = g(f(x)) Kind of "backwards" notation, but fairly traditional. Some algebrists will reverse it, (x) (f o g) "function operates on the left" Some computer scientists like to denote functions by "lambda expressions" To say that f is the function that maps x to x^2 we write f = lambda x. x^2 Here x is just a formal variable; lambda x. x^2 = lambda y. y^2 The domain is not explicitly Functions don't have to be defined on numbers, of course |x| = maps ∑* - > \N hd(x) = the first character of the string x, x≠emptystring tl(x) = all but the first character of x (define how when x=\emptystring)? dim(A) = the dimensions of the matrix A, regarded as a pair of natural numbers


  1. One-to-one, Onto functions

Def: f:A - > B is injective (or one-to-one) if f(x)=f(y) - > x=y Def: f:A - > B is surjective (or onto) if // the image is the co-domain (for all b in B) (there exists a in A) f(a)=b

Yes, that's required by a function. Might it have two images? No, only one. So if you do have an bijective function f: A - > B, the function f^{-1}: B - > A is well defined: f^{-1}(y) = the unique x such that f(x) = y. Example: f(x) = exp(x) = e^x Draw picture. What's the domain? \R What's the image? (0,∈ f ty) Is it 1-1 on this image? YES What's it's inverse ex^ = y x = ln(y) Example: f(x) = x ex^ = y draw it. On what domain does the inverse exists? answer: [0,infinity] Could you define a larger portion of the curve on which the inverse exists: Yes, [-1/e .. infinity] Graph the function. Take its derivative to see that it vanishes at - 1, when the function takes on the value - 1/e. How would you find the inverse f-^1 (2), for example? x ex^ = 2. Binary search

  1. Important functions

\lceil x \rceil lfloor x \rfloor a mod b |x| ex 2 x 3 x log ln lg n! Review of properties of logs: log(ab) = log(a) + log(b) log_a(b) = log_c(b) / log_c(a) eab^ = (ea) b ax^ ay^ = a{x+y} Draw picture of y = lg(x)


  1. Comparing functions

Which is bigger, x^3 or 2x? Nor formal meaning we know -- it depends on x. But there is some sense in which 2^x seems bigger Draw graphs.