Lecture 4

When you’re trying to work out whether something’s a function, there are three bits of the definition where things can go wrong:

“each aAa\in A

A function must be defined for every single element of the domain. Why does α(x)=1/x\alpha(x) = 1/x not define a function α:QQ\alpha:\mathbb{Q}\rightarrow\mathbb{Q}?

α\alpha is not defined at zero

“unique element”

A function must have only one value at any given element of the domain. If we set β(n)\beta(n) to be the real number xx whose square is nn, why does that not define a function β:NR\beta:\mathbb{N}\rightarrow\mathbb{R}?

β(3)\beta(3) could be +3+\sqrt{3} or 3-\sqrt{3}.

f(a)Bf(a)\in B

A function must return values within its codomain. Why does γ(n)=n7\gamma(n) = n-7 not define a function γ:NN\gamma:\mathbb{N}\rightarrow\mathbb{N}?

γ(4)=3\gamma(4)=-3 does not lie inside N\mathbb{N}.

Two functions are equal if:

Given two functions f:ABf:A\rightarrow B and g:BCg:B\rightarrow C, we can define their composite gf:ACg\circ f:A\rightarrow C by the rule: (gf)(x)=g(f(x)).(g\circ f)(x) = g(f(x)).

Functions don’t have to be described by formulae (as they are in the examples, and non-examples, above).

For example, if the domain is finite we can define them pictorially. Accordingly, here is a function from the set TT of Teletubbies, as considered earlier, to the set of colours:

image

Now we’re well-equipped to describe functions, we can start describing their properties.

Here are some useful words.


Definition: A function f:ABf:A\rightarrow B is said to be injective if, for any two elements a1,a2Aa_1,a_2\in A with a1a2a_1\neq a_2, then f(a1)f(a2)f(a_1)\neq f(a_2). I think of this as saying that “nothing is hit twice”, or equivalently that “no two elements of the domain have the same image”.


Definition: A function f:ABf:A\rightarrow B is said to be surjective if, for every element bBb\in B, there is some element aAa\in A with f(a)=bf(a)=b. I think of this as saying that “every element of the codomain is hit at least once”.


Definition: A function f:ABf:A\rightarrow B is said to be bijective if it is both injective and surjective. I think of this as saying that “every element of the codomain is hit exactly once”.

For example, let’s consider our function assigning colours to Teletubbies.

image

It is injective, because each one of the Teletubbies has a different colour.

However, it is not surjective, because there are no pink Teletubbies in all of Teletubbyland. Hence it is also not bijective.

Also, note that these properties (injective, surjective, bijective) don’t just depend on the rule that defines it: they depend on the domain and codomain.

For example, consider the rule f(n)=n2f(n)=n^2. Is this injective, considered as a function f:NNf:\mathbb{N}\rightarrow\mathbb{N}?

Yes! Every natural number has a different square.

Is it injective as a function f:ZZf:\mathbb{Z}\rightarrow\mathbb{Z}?

No; f(3)=f(3)f(3) = f(-3).

Similarly, consider the rule g(n)=n+100g(n) = n+100. Is this surjective, considered as a function g:NNg:\mathbb{N}\rightarrow\mathbb{N}?

No; there is no aNa\in\mathbb{N} with g(a)=50g(a)=50.

Is it surjective as a function g:ZZg:\mathbb{Z}\rightarrow\mathbb{Z}?

Yes it is! For any nn we have g(n100)=ng(n-100)=n.

Note that that function also has an inverse, a function which undoes gg. Namely, we can take the inverse g1:ZZg^{-1}:\mathbb{Z}\rightarrow\mathbb{Z} to be g1(n)=n100g^{-1}(n) = n-100.

You’ll see a lot more about inverses next semester.

By the way, I’d like you to try to remove phrases like “one-to-one” from your vocabulary: it’s never clear whether “ff is one-to-one” means “ff is injective”, “ff is bijective”, or simply “ff is a function”, and many people who use it treat this as an excuse for not explaining which they mean.

Logic

Now we’ll briefly move on to another building block of mathematics: logic. Logic studies the properties of statements, which can be either true or false.

Implication

Much of logic involves deductive reasoning. Here’s the definition that encapsulates that:
Definition: Let AA and BB be statements. We say that AA implies BB, written ABA\Rightarrow B, to mean “if AA is true, then BB also has to be true”.

There are many common ways of saying the same thing, used by mathematicians. These include:

Notice that ABA\Rightarrow B cannot be used to mean “AA is true, and so BB is also true”.

For example, let AA be the statement “I visited Cardiff last week”, and BB be the statement “I’ve been to Wales this month”. We can all agree that ABA\Rightarrow B is true, which says

“If I visited Cardiff last week, then I must have been to Wales in the last month.”

However, as it happens, neither of these is true: in fact, I haven’t been in Wales for a while longer than that.

As such, it is quite different to saying “AA is true, and therefore BB is also true”. Beginning students often get these confused.

The implication ABA\Rightarrow B only says something interesting about BB if AA happens to be true! If AA is false, then we have ABA\Rightarrow B no matter whether BB is true or false.

For example, it’s correct to say

“If 2+2=3372+2=337, then this course is lectured by Dr Cranch”.

or indeed

“If 2+2=3372+2=337, then this course is lectured by Robert de Niro”.

This may be a surprise if you’re basing your intuition on ordinary English, where people use the words “if…then” in several different ways, sometimes slightly ambiguously.

Another important point is that if ABA\Rightarrow B does not say that BB is true only if AA is true (that would be BAB\Rightarrow A, in fact).

So it’s correct to say

If it rains next Wednesday, then 2+2=42+2=4.

In fact, it’s true that 2+2=42+2=4 no matter whether it rains next Wednesday, but that’s not a problem. Whether or not it’s helpful to say that is another question!

We can sum up the comments above by giving a truth table for implication. We write 00 for false and 11 for true.

First off, note that if QQ is true, then PQP\Rightarrow Q is definitely true no matter whether PP is true.

Also, if PP is false, then PQP\Rightarrow Q is true no matter whether QQ is true.

In fact, it’s only if PP is true and QQ is false that PQP\Rightarrow Q is false.

PP QQ PQP\Rightarrow Q
0 0 1
0 1 1
1 0 0
1 1 1