girgit.org

Relations and Functions

Domain, range and codomain of a relation

The big ideaThe domain of a relation is the set of first elements it actually uses, the range is the set of second elements it actually reaches, and the codomain is the whole set \( B \) the second elements were allowed to come from.

In simple words

Think of a list of who sent a rakhi to whom. The people who sent at least one form the first group. The people who got at least one form the second group. The second group sits inside the bigger crowd of everyone who could have got one. A relation also has these three groups, and the sizes of the groups let you count how many relations there can be.

Domain, range and codomain

Let \( R \) be a relation from \( A \) to \( B \).

  • The domain of \( R \) is the set of all first elements of the ordered pairs in \( R \).
  • The range of \( R \) is the set of all second elements of the ordered pairs in \( R \): the set of all images.
  • The codomain of \( R \) is the whole set \( B \).

Every second element of \( R \) comes from \( B \), so

\[ \text{range} \subset \text{codomain} \]

The range can be all of \( B \), or a smaller part of it. In the same way the domain is a subset of \( A \).

Worked example

Let \( A = \{1, 2, 3, 4, 5, 6, 7, 8\} \) and define a relation on \( A \) by \( R = \{\, (x, y) : y = 2x \,\} \). Find the domain, range and codomain.

  1. We need both \( x \) and \( 2x \) in \( A \): \( x = 1, 2, 3, 4 \) give \( 2, 4, 6, 8 \). For \( x = 5 \), \( 2x = 10 \notin A \).
  2. \( R = \{(1, 2), (2, 4), (3, 6), (4, 8)\} \).
  3. Domain \( = \{1, 2, 3, 4\} \), range \( = \{2, 4, 6, 8\} \), codomain \( = A = \{1, 2, \dots, 8\} \).

In the arrow diagram, 5, 6, 7 and 8 on the left have no arrow leaving them, and the odd numbers on the right have no arrow arriving.

Try it: change the rule and watch which numbers drop out of the domain and which get ringed in the range.

Worked example

\( P = \{1, 4, 16\} \), \( Q = \{-4, -2, -1, 1, 2, 3, 4\} \). Let \( R = \{\, (x, y) : x = y^2,\ x \in P,\ y \in Q \,\} \). Find \( R \), its domain and its range.

  1. \( 1 = (\pm 1)^2 \): pairs \( (1, 1), (1, -1) \).
  2. \( 4 = (\pm 2)^2 \): pairs \( (4, 2), (4, -2) \).
  3. \( 16 = (\pm 4)^2 \): pairs \( (16, 4), (16, -4) \).
  4. Domain \( = \{1, 4, 16\} \). Range \( = \{-4, -2, -1, 1, 2, 4\} \).

The element 3 of \( Q \) is in the codomain but not in the range: no element of \( P \) is its square.

How many relations are there?

A relation from \( A \) to \( B \) is just a subset of \( A \times B \). So the number of relations is the number of subsets of \( A \times B \). From the chapter on sets, a set with \( k \) elements has \( 2^k \) subsets. With \( n(A) = p \) and \( n(B) = q \), the product has \( pq \) elements, so

\[ \text{number of relations from } A \text{ to } B = 2^{pq} \]

Worked example

\( A = \{a, b, c\} \) and \( B = \{0, 1\} \). How many relations are there from \( A \) to \( B \)?

  1. \( n(A \times B) = 3 \times 2 = 6 \).
  2. Each of the 6 pairs is either in the relation or not: two choices, six times.
  3. Number of relations \( = 2^6 = 64 \). This count includes \( \phi \) and the whole of \( A \times B \).

See it happen: every relation is a row of yes/no switches, one per pair.

A relation from \( A \) to the same set \( A \) is called a relation on A. If \( n(A) = p \), there are \( 2^{p^2} \) relations on \( A \).

Three questions worth asking about a relation on A

For a relation on a set, three tests come up often (in Class 12 they get the names reflexive, symmetric and transitive):

  1. Is every element related to itself: is \( (a, a) \in R \) for all \( a \)?
  2. If \( (a, b) \in R \), must \( (b, a) \in R \) too?
  3. If \( (a, b) \in R \) and \( (b, c) \in R \), must \( (a, c) \in R \)?

Worked example

On \( \mathbf{Z} \), let \( R = \{\, (a, b) : a - b \text{ is a multiple of } 5 \,\} \). Answer the three questions.

  1. \( a - a = 0 = 5 \times 0 \), a multiple of 5. So \( (a, a) \in R \) for every integer \( a \). Yes.
  2. If \( a - b = 5k \), then \( b - a = 5(-k) \), also a multiple of 5. Yes.
  3. If \( a - b = 5k \) and \( b - c = 5m \), then \( a - c = (a - b) + (b - c) = 5(k + m) \). Yes.

Compare "\( a \lt b \)" on \( \mathbf{Z} \): it fails the first two tests and passes the third. No number is less than itself, and \( 2 \lt 3 \) does not give \( 3 \lt 2 \), but \( a \lt b \) and \( b \lt c \) do give \( a \lt c \).

Remember

  • Domain: first elements used. Range: second elements reached. Codomain: all of \( B \).
  • Range \( \subset \) codomain.
  • \( n(A) = p,\ n(B) = q \Rightarrow \) there are \( 2^{pq} \) relations from \( A \) to \( B \).
  • A relation from \( A \) to \( A \) is a relation on \( A \).

Try it. (a) Find the domain and range of \( R = \{\, (x, x - 2) : x \in \{3, 4, 5, 6\} \,\} \). (b) \( A = \{1, 2\} \), \( B = \{p, q, r\} \). How many relations from \( A \) to \( B \)?

Answer
(a) \( R = \{(3, 1), (4, 2), (5, 3), (6, 4)\} \). Domain \( = \{3, 4, 5, 6\} \), range \( = \{1, 2, 3, 4\} \). (b) \( n(A \times B) = 6 \), so there are \( 2^6 = 64 \) relations.

Words to know

Domain of a relation
The set of all first elements of its pairs.
Range of a relation
The set of all second elements of its pairs: all the images.
Codomain
The whole set \( B \) in a relation from \( A \) to \( B \).
Relation on \( A \)
A relation from \( A \) to \( A \) itself.
\( 2^{pq} \)
The number of relations from a \( p \)-element set to a \( q \)-element set.

\( R = \{(1, 3), (2, 3), (4, 7)\} \) is a relation from \( A = \{1, 2, 3, 4\} \) to \( B = \{3, 5, 7\} \). What is its range?

  1. \( \{3, 5, 7\} \)
  2. \( \{3, 7\} \)
  3. \( \{1, 2, 4\} \)

\( n(A) = 2 \) and \( n(B) = 3 \). How many relations are there from \( A \) to \( B \)?

  1. \( 6 \)
  2. \( 8 \)
  3. \( 64 \)

For any relation from \( A \) to \( B \), which is always true?

  1. Range \( \subset \) codomain
  2. Range \( = \) codomain
  3. Domain \( = \) range