Relations and Functions Continued

David Lu
July 30, 2018

Recall that the answers are in the comments of the .md file. Replace the .html with .md to view it.

Functions Examples and Exercises

Some definitions first.

Functions are ordinarily denoted by symbols. Suppose that for each element of a set AA, the domain, we assign a unique element of a set BB, the codomain. The collection of these assignments is called a function from AA to BB. Let ff denote that function. We write:

f:ABf: A \to B

We can also say that ff maps AA to BB.

Functions are often expressed by means of a mathematical formula. For example, consider the function which maps each real number to its square. We can denote this function by writing

In the first notation, xx is called a variable or argument and the letter ff denotes the function.
In the second, the barred arrow \mapsto is read "goes to" or "maps to". (The LaTeX command is \mapsto).
In the last, xx is called the independent variable and yy is called the dependent variable since the value of yy depends on the value of xx.

Exercises:
Find the domain DD of each of the following real-valued functions of a real variable:

(a) f(x)=1x2f(x) = \frac{1}{x-2}

(b) f(x)=x23x4f(x) = x^2 - 3x - 4

(c) f(x)=25x2f(x) = \sqrt{25-x^2}

Functions as Relations

Every function f:ABf: A \to B defines a relation from AA to BB called the graph of ff

Graph of f={a,baA,f(a)=bB}f = \{\langle a, b \rangle | a \in A,f(a) = b \in B\}

Two functions f:ABf: A \to B and g:ABg: A \to B are equal if for every aAa \in A, f(a)=g(a)f(a) = g(a), i.e. they have the same graph.

Exercise: Map the function f(x)=x22x3f(x) = x^2 - 2x - 3

Classes of Functions

A function is injective (one-to-one) if each element of the codomain is mapped to by at most one element of the domain.
That is, for all x,xAx, x' \in A, f(x)=f(x)x=xf(x) = f(x') \to x = x'

A function is surjective (onto) if each element of the codomain is mapped to by at least one element of the domain.
That is, for all yBy \in B, there exists an xAx \in A such that f(x)=yf(x) = y

A function is bijective (one-to-one and onto or one-to-one correspondence) if each element of the codomain is mapped to by exactly one element of the domain.

Exercises:
Consider functions f:ABf: A \to B and g:BCg: B \to C. Prove the following:
(a) if ff and gg are injective (one-to-one), then the composition function gfg \circ f is injective (one-to-one)$.

(b) if ff and gg are surjective (onto) functions, then gfg \circ f is an surjective (onto) function.

Determine if each function is injective (one-to-one):
(c) To each person on the earth, assign the number which corresponds to her or his age.
(d) To each country in the world, assign the latitude and longitude of its capital.
(e) To each book written by only one author, assign the author.
(f) To each country in the world which has a prime minister, assign its prime minister.

Sets, Logic, Computation

Problem 3.1. Show that if ff is bijective, an inverse gg of ff exists. (define such a gg show that it is a function, and show that it is an inverse of ff.)

Proof.
Let f:ABf: A \to B be bijective. We'll define a function g:ABg: A \to B = f1f^{-1} as follows. Let bBb \in B. since ff is surjective, there exists aAa \in A such that f(a)=bf(a) = b. Let g(b)=ag(b) = a. Since ff is injective, this aa is unique, so gg is a well-defined function.

Next, we show that gg is the inverse of ff. First, we show that gf=idAg \circ f = id_A.
First, let aAa \in A. Let b=f(a)b = f(a). Then by definition g(b)=ag(b) = a. then gf(a)=g(f(a))=g(b)=ag \circ f(a) = g(f(a)) = g(b) = a.
Second, show that fg=idBf \circ g = id_B. Let bBb \in B and f1(b)=g(b)=af^{-1}(b) = g(b) = a. By definition, f(a)=bf(a) = b. It follows that fg(b)=f(g(b))=f(a)=bf \circ g(b) = f(g(b)) = f(a) = b.