Functions Defined on General Sets Lecture 30 Section 7.1 Fri, Mar 4, 2005
Relations A relation R from a set A to a set B is a subset of A B. If x A and y B, then x has the relation R to y if (x, y) R. We may also write x R y.
Examples: Relations Let A = B = R. Let x, y R. Define x R y to mean that y = x2. Describe R. Let A = B = R. Let x, y R. Define x R y to mean that y < x2. Is R R a relation? Is a relation?
Functions Let A and B be sets. A function from A to B is a relation from A to B with the property that for every x A, there exists exactly one y B such that (x, y) f. Write f : A B and f(x) = y. A is the domain of f. B is the co-domain of f.
Functions Note that functions and algebraic expressions are two different things. For example, do not confuse the algebraic expression (x + 1)2 with the function f : R R defined by f(x) = (x + 1)2.
Examples: Functions f : R R by f(x) = x2. g : R R R by g(x, y) = 1 – x – y. h : R R R R by h(x, y) = (-x, -y). For any set A, k : (A) (A) (A) by k(X, Y) = X Y. For any sets A and B, m : (A) (B) by m(X) = X B.
Examples: Functions Let n be the size of a complete binary tree. Define f : N R by f(n) = the average number of nodes visited to locate a randomly selected value in the tree. We found earlier that if n = 2k – 1, then f(n) k – 1. In general, what expression approximately describes the values of this function?
Inverse Images If f(x) = y, we say that y is the image of x and that x is an inverse image of y. The inverse image of y is the set f -1(y) = {x X | f(x) = y}. In the previous examples, find f -1(4). g-1(0). h-1(5, 10).
Equality of Functions Let f : X Y and g : X Y be two functions. Then f = g if f(x) = g(x) for all x X. Are the functions f(x) = |x| and g(x) = x2 equal? Are the functions f(x) = 1 and g(x) = sec2 x – tan2 x equal?
Boolean Functions A Boolean function is a function whose domain is {0, 1} … {0, 1} and codomain is {0, 1}. Example: Let p, q be Boolean variables and define f(p, q) = p q. p q f(p, q) 1
The Number of Boolean Functions How many Boolean functions are there in 2 variables? What are they? How many Boolean functions are there in 3 variables? How many Boolean functions are there in n variables?
Boolean Functions What Boolean function is defined by f(x, y) = xy? f(x, y) = x + y – xy? f(x) = 1 – x? f(x, y, z) = 1 – xy – z + xyz?