What this les­son cov­ers

A func­tion is a rule that pairs each ele­ment of one set with exactly one ele­ment of another. To say this pre­cisely we first need the Carte­sian prod­uct of two sets and the idea of a rela­tion. This les­son builds those ideas and then defines image, pre-image, domain, co-domain and range.

Carte­sian prod­uct of two sets

Let AA and BB be two sets. Their Carte­sian prod­uct, writ­ten A×BA \times B and read "A cross B", is the set of all ordered pairs whose first entry comes from AA and sec­ond entry from BB:

A×B={(a,b)∣a∈A, b∈B}.A \times B = \{(a, b) \mid a \in A,\ b \in B\}.

If AA has mm ele­ments and BB has nn ele­ments, then A×BA \times B has mnmn ele­ments.

Rela­tion

Any sub­set of A×BA \times B is called a rela­tion from AA to BB.

For exam­ple, let A={1,2,3}A = \{1, 2, 3\} and B={a,b}B = \{a, b\}. Then

A×B={(1,a),(1,b),(2,a),(2,b),(3,a),(3,b)},A \times B = \{(1, a), (1, b), (2, a), (2, b), (3, a), (3, b)\},

and R={(1,a),(1,b),(2,a)}R = \{(1, a), (1, b), (2, a)\} is a rela­tion from AA to BB.

Func­tion

A rela­tion ff from AA to BB is called a func­tion if every ele­ment of AA is asso­ci­ated with a unique ele­ment of BB. We write f:A→Bf : A \to B, read "f maps A to B".

Two things can stop a rela­tion from being a func­tion: some ele­ment of AA has no part­ner in BB, or some ele­ment of AA has two or more part­ners. Ele­ments of BB, on the other hand, may be left unused or used more than once.

Con­sider three arrow dia­grams.

  • ff from A={1,2,3,4}A = \{1, 2, 3, 4\} to B={a,b,c,d,e,f}B = \{a, b, c, d, e, f\}, in which 11 is joined to two let­ters and 44 is joined to noth­ing. This is not a func­tion.
  • gg from C={1,2,3,4}C = \{1, 2, 3, 4\} to D={5,7,9,11}D = \{5, 7, 9, 11\} with 1→51 \to 5, 2→52 \to 5, 3→93 \to 9, 4→114 \to 11. Every ele­ment of CC has exactly one arrow, so gg is a func­tion, even though 55 is used twice and 77 is unused.
  • hh from E={1,2,3,4}E = \{1, 2, 3, 4\} to F={a,b,c,d,e,f}F = \{a, b, c, d, e, f\}, in which one ele­ment of EE sends arrows to two dif­fer­ent let­ters. This is not a func­tion.

Num­ber of func­tions. If AA and BB are finite, each of the n(A)n(A) ele­ments of AA can be sent to any of the n(B)n(B) ele­ments of BB, so the num­ber of func­tions from AA to BB is

{n(B)}n(A).\{n(B)\}^{n(A)}.

Image and pre-image

If f:A→Bf : A \to B is a func­tion and (a,b)∈f(a, b) \in f with a∈Aa \in A, b∈Bb \in B, then bb is called the image of aa, and aa is called a pre-image of bb. We write b=f(a)b = f(a).

Domain, co-domain and range

Let f:A→Bf : A \to B be a func­tion. Then

  • AA is the domain of ff,
  • BB is the co-domain of ff,
  • the set of all images of ele­ments of AA is the range of ff, writ­ten f(A)f(A).

The range is always a sub­set of the co-domain.

Exam­ple 1

For the func­tion g:{1,2,3,4}→{5,7,9,11}g : \{1, 2, 3, 4\} \to \{5, 7, 9, 11\} with 1→51 \to 5, 2→52 \to 5, 3→93 \to 9, 4→114 \to 11:

Domain ={1,2,3,4}= \{1, 2, 3, 4\}, co-domain ={5,7,9,11}= \{5, 7, 9, 11\}, range ={5,9,11}= \{5, 9, 11\}.

Exam­ple 2

Let A={1,2,3}A = \{1, 2, 3\}, B={1,4,9,16,25}B = \{1, 4, 9, 16, 25\} and f(x)=x2f(x) = x^2. Is f:A→Bf : A \to B a func­tion?

f(1)=12=1,f(2)=22=4,f(3)=32=9.f(1) = 1^2 = 1, \quad f(2) = 2^2 = 4, \quad f(3) = 3^2 = 9.

Each ele­ment of AA has exactly one image in BB, so ff is a func­tion. Domain ={1,2,3}= \{1, 2, 3\}, co-domain ={1,4,9,16,25}= \{1, 4, 9, 16, 25\}, range ={1,4,9}= \{1, 4, 9\}.

Exam­ple 3

The rela­tion from R\mathbb{R} to R\mathbb{R} given by f(x)=x2f(x) = x^2 is a func­tion: every real num­ber has exactly one square.

The rela­tion from R\mathbb{R} to R\mathbb{R} given by f(x)=xf(x) = \sqrt{x} is not a func­tion. For instance −1∈R-1 \in \mathbb{R} (the domain), but −1\sqrt{-1} is not a real num­ber, so −1-1 has no image in the co-domain R\mathbb{R}.

Prac­tice

  1. If A={1,2}A = \{1, 2\} and B={x,y,z}B = \{x, y, z\}, write A×BA \times B and state how many ele­ments it has.
  2. How many rela­tions are there from AA to BB in ques­tion 1?
  3. How many func­tions are there from a set with 3 ele­ments to a set with 4 ele­ments?
  4. Is {(1,2),(2,3),(1,4)}\{(1, 2), (2, 3), (1, 4)\} a func­tion from {1,2}\{1, 2\} to {2,3,4}\{2, 3, 4\}? Why?
  5. For f:{−2,−1,0,1,2}→Zf : \{-2, -1, 0, 1, 2\} \to \mathbb{Z}, f(x)=x2+1f(x) = x^2 + 1, find the range.
  6. For f(x)=2x−3f(x) = 2x - 3 on the domain {0,1,2,3}\{0, 1, 2, 3\}, find the pre-image of 33.

Answers

Show answers
  1. {(1,x),(1,y),(1,z),(2,x),(2,y),(2,z)}\{(1,x), (1,y), (1,z), (2,x), (2,y), (2,z)\}, which has 66 ele­ments.
  2. Every sub­set of A×BA \times B is a rela­tion, so there are 26=642^6 = 64.
  3. 43=644^3 = 64.
  4. No: 11 has two images, 22 and 44.
  5. {1,2,5}\{1, 2, 5\}.
  6. 2x−3=32x - 3 = 3 gives x=3x = 3.