# Functions

Definition. A function f from a set X to a set Y is a subset f of the product such that if , then .

Instead of writing , you usually write . In ordinary terms, to say that an ordered pair is in f means that x is the "input" to f and y is the corresponding "output".

The requirement that implies means that there is a unique output for each input. (It's what is referred to as the "vertical line test" for a graph to be a function graph.)

(Why not say, as in precalculus or calculus classes, that a function is a rule that assigns a unique element of Y to each element of X? The problem is that the word "rule" is ambiguous. The definition above avoids this by identifying a function with its graph.)

The notation means that f is a function from X to Y.

X is called the domain, and Y is called the codomain. The image (or range) of f is the set of all outputs of the function:

Note that the domain and codomain are part of the definition of a function. For example, consider the following functions:

These are different functions; they're defined by the same rule, but they have different domains or codomains.

Example. Suppose is given by

Is this a function?

This does not define a function. For example, could be 3, since 3 is an integer bigger than 2.6. But it could also be 4, or 67, or 101, or .... This "rule" does not produce a unique output for each input.

Mathematicians say that such a function --- or such an attempted function --- is not well-defined.

In basic algebra and calculus, functions are often given by rules, without mention of a domain and codomain. In this case, the natural domain ("domain" for short) is the largest subset of consisting of numbers which can be "legally" plugged into the function.

Example. Find the natural domain of

(i) I must have in order for to be defined.

(ii) I must have in order to avoid division by zero.

Hence, the domain of f is .

Example. Define by

Prove that .

In words, the claim is that the outputs of y consist of all numbers other than 3. To see why 3 might be omitted, note that

That is, is a horizontal asymptote for the graph. Now this isn't a proof, because a graph can cross a horizontal asymptote; it just provides us with a "guess".

To prove , I'll show each set is contained in the other.

Suppose . On scratch paper, I solve for x in terms of y and get . (This is defined, since .) Now I prove that this input produces y as an output:

This proves that , so .

Conversely, suppose , so for some x. I must show that . I'll use proof by contradiction: Suppose . Then

This contradiction proves . Thus, .

Therefore, .

Definition. Let X and Y be sets. A function is:

(a) Injective if for all , implies .

(b) Surjective if for all , there is an such that .

(c) Bijective if it is injective and surjective.

Definition. Let A, B, and C be sets, and let and be functions. The composite of f and g is the function defined by

In my opinion, the notation " " looks a lot like multiplication, so (at least when elements are involved) I prefer to write " " instead. However, the composite notation is used often enough that you should be familiar with it.

Example. Define by and by . Find and .

Example. Define and by

Find:

(a) .

(b) .

(a)

(b)

If you get confused doing this, keep in mind two things:

(i) The variables used in defining a function are "dummy variables" --- just placeholders. For example, defines the same function f as above.

(ii) The variables are "positional", so in " " the "x" stands for "the first input to f" and the "y" stands for "the second input to f". In fact, you might find it helpful to rewrite the definition of f this way:

Definition. Let S and T be sets, and let be a function from S to T. A function is called the inverse of f if

Not all functions have inverses; if the inverse of f exists, it's denoted . (Despite the crummy notation, " " does not mean " ".)

You've undoubtedly seen inverses of functions in other courses; for example, the inverse of is . However, the functions I'm discussing may not have anything to do with numbers, and may not be defined using formulas.

Example. Define by . Find the inverse of f.

To find the inverse of f (if there is one), set . Swap the x's and y's, then solve for y in terms of x:

Thus, . To prove that this works using the definition of an inverse function, do this:

Recall that the graphs of f and are mirror images across the line :

I'm mentioning this to connect this discussion to things you've already learned. However, you should not make the mistake of equating this special case with the definition. The inverse of a function is not defined by "swapping x's and y's and solving" or "reflecting the graph about ". A function might not involve numbers or formulas, and a function might not have a graph. The inverse of a function is what the definition says it is --- nothing more or less.

Lemma. Let and be invertible functions. Then is invertible, and its inverse is

Proof. Let and let . Then

This proves that .

The next result is very important, and I'll often use it in showing that a given function is bijective.

Theorem. Let S and T be sets, and let be a function. f is invertible if and only if f is both injective and surjective.

Proof. ( ) Suppose that f is both injective and surjective. I'll construct the inverse function .

Take . Since f is surjective, there is an element such that . Moreover, s is unique: If and , then . But f is injective, so .

Define

I have defined a function . I must show that it is the inverse of f.

Let . By definition of , to compute I must find an element such that . But this is easy --- just take . Thus, .

Going the other way, let . By definition of , to compute I find an element such that . Then , so

Therefore, really is the inverse of f.

( ) Suppose f has an inverse . I must show f is injective and surjective.

To show that f is surjective, take . Then , so I've found an element of S --- namely --- which f maps to t. Therefore, f is surjective.

To show that f is injective, suppose and . Then

Therefore, f is injective.

Corollary. The composite of bijective functions is bijective.

Proof. Since a function is bijective if and only if it has an inverse, the corollary follows from the fact that the composite of invertible functions is invertible.

Example. Define by

Prove that f is bijective by constructing an inverse for f and proving that it works.

First, I do some scratch work to guess the inverse. I need , where u and v are the unknown outputs of in terms of a and b. Now

Equating corresponding components, I get

The second equation gives . Plugging this into the first equation, I get

Based on this scratch work, I'll define by

Note that I got this by working backwards; I still need to verify that f and are inverses.

This proves that f and are inverses, so f is bijective.

Example. (a) Prove that given by is neither injective nor surjective.

(b) Prove that given by is not injective, but it is surjective.

(c) Prove that given by is injective and surjective.

(a) It is not injective, since and : Different inputs may give the same output.

It is not surjective, since there is no such that .

(b) It is not injective, since and : Different inputs may give the same output.

It is surjective, since if , is defined, and

(c) It is injective, since if , then . But in this case, , so by taking square roots.

It is surjective, since if , then is defined, and

Notice that in this example, the same "rule" --- --- was used, but whether the function was injective or surjective changed. The domain and codomain are part of the definition of a function.

Example. Let be given by

Prove that f is injective.

Suppose and . I must prove that .

means that . Clearing denominators and doing some algebra, I get

Therefore, f is injective.

Example. Let be given by

Prove that f is injective.

It would probably be difficult to prove this directly. Instead, I'll use the following fact:

Suppose is differentiable, and that for all x or for all x. Then f is injective.

In this case, note that, since even powers are nonnegative,

Since the derivative is always positive, f is always increasing, and hence f is injective.

Here's a proof of the result I used in the last example.

Proposition. Suppose is differentiable, and that for all x or for all x. Then f is injective.

Proof. Suppose that f is differentiable and always increasing. Suppose that . I want to prove that .

Suppose on the contrary that . There's no harm in assuming (otherwise, switch them). By the Mean Value Theorem, there is a number c such that and

Since and for all x,

This contradiction proves that . Therefore, f is injective.

The same proof works with minor changes if for all x.

Example. Define by .

(a) Prove directly that f is injective and surjective.

(b) Prove that f is injective and surjective by showing that f has an inverse .

(a) Suppose . Then , so , and hence . Therefore, f is injective.

Suppose . I must find x such that . I want . Working backwards, I find that . Verify that it works:

This proves that f is surjective.

(b) Define . I'll prove that this is the inverse of f:

Therefore, is the inverse of f. Since f is invertible, it's injective and surjective.

Example. Define by . Show that f is not injective, but that f is surjective. f is not injective, since and .

The graph suggests that f is surjective. To say that every is an output of f means graphically that every horizontal line crosses the graph at least once (whereas injectivity means that every horizontal line crosses that graph at most once).

To prove that f is surjective, take . I must find such that , i.e. such that .

The problem is that finding x in terms of y involves solving a cubic equation. This is possible, but it's easy to change the example to produce a function where solving algebraically is impossible in principle.

It follows from the definition of these infinite limits that there are numbers a and b such that

But f is continuous --- it's a polynomial --- so by the Intermediate Value Theorem, there is a point c such that and . This proves that f is surjective.

Note, however, that I haven't found c; I've merely shown that such a value c must exist.

Example. Define

Prove that f is surjective, but not injective.

Let . If , then , so

If , then is defined and , so

This proves that f is surjective.

However,

Hence, f is not injective.

Example. Consider the function defined by

(a) Show that f is injective and surjective directly, using the definitions.

(b) Show that f is injective and surjective by constructing an inverse .

(a) First, I'll show that f is injective. Suppose . I want to show that .

means

Equate corresponding components:

Rewrite the equations:

The second of these equations gives . Substitute this into the first equation:

Plugging this into gives , so . Therefore, , and f is injective.

To show f is surjective, I take a point , the codomain. I must find such that .

I want

I'll work backwards from this equation. Equating corresponding components gives

The second equation gives , so plugging this into the first equation yields

Plugging this back into gives

Now check that this works:

Therefore, f is surjective.

(b) I actually did the work of constructing the inverse in showing that f was surjective: I showed that if , that

But the second equation implies that if exists, it should be defined by

Now I showed above that

For the other direction,

This proves that , as defined above, really is the inverse of f. Hence, f is injective and surjective.

In linear algebra, you learn more efficient ways to show that functions like the one above are bijective.

Example. Consider the function defined by

Prove that f is neither injective nor surjective.

Therefore, f is not injective.

To prove f is not surjective, I must find a point which is not an output of f. I'll show that is not an output of f. Suppose on the contrary that . Then

This gives two equations:

Multiply the second equation by -2 to obtain . Now I have and , so , a contradiction.

Therefore, there is no such , and f is not surjective.

Example. Let be defined by

Is f injective? Is f surjective?

First, I'll show that f is injective. Suppose . I have to show that .

Equating the second components, I get . By taking cube roots, I get . Equating the first components, I get . But , so subtracting I get . Now taking the log of both sides gives . Thus, , and f is injective.

I'll show that f is not surjective by showing that there is no input which gives as an output. Suppose on the contrary that . Then

Equating the second components gives , so . Equating the first components gives . But , so I get . This is impossible, since is always positive. Therefore, f is not surjective.

Contact information