girgit.org

Relations and Functions

How many relations? Counting with pairs

The big ideaLay the n × n possible pairs of a set out as a grid; every relation is a choice of cells, so counting relations of a given type is counting which cells are forced, which are free, and which must be chosen in mirror-image twos.

In simple words

Picture a square board with a row and a column for each element. Each square stands for one pair. A relation is just a choice of squares to colour in. Some rules force certain squares to be coloured. Some rules say "if you colour this square, colour its mirror square too". Count the free choices left, and you have counted the relations.

Not in the current textbook, but JEE asks it: NCERT's examples count a few relations by hand (such as how many equivalence relations contain a given pair). JEE Main goes further and asks for counts with formulas. Here is the method.

The grid of pairs

For A = {1, 2, 3}, A × A has 9 pairs. Arrange them in a 3 × 3 grid, row a and column b holding (a, b). The diagonal holds (1, 1), (2, 2), (3, 3). Every other cell (a, b) has a mirror cell (b, a) across the diagonal.

For a set with \( n \) elements:

  • total cells: \( n^2 \); diagonal cells: \( n \); off-diagonal cells: \( n^2 - n \), which pair up into \( \frac{n(n-1)}{2} \) mirror pairs.

Four counts from the grid

Type of relationWhat the grid rule saysCountn = 2n = 3
Any relationevery cell free\( 2^{n^2} \)16512
Reflexivediagonal forced in; other \( n^2 - n \) cells free\( 2^{n^2 - n} \)464
Symmetricdiagonal cells free; each mirror pair chosen as one\( 2^{n} \cdot 2^{\frac{n(n-1)}{2}} = 2^{\frac{n(n+1)}{2}} \)864
Reflexive and symmetricdiagonal forced; mirror pairs chosen as one\( 2^{\frac{n(n-1)}{2}} \)28

Transitive relations have no simple formula: there are 13 on a 2-element set, 171 on a 3-element set and 3994 on a 4-element set, found by listing or by computer. Equivalence relations are counted by partitions, as on the previous page: 1, 2, 5, 15, 52 for sets of size 1 to 5.

Try it: guess first, then switch rules and count the numbered switches.

The smallest-relation method

JEE also asks questions like "how many relations of type X contain these pairs?". The steady method:

  1. Build the smallest relation with the required pairs and properties (add (a, a), mirror pairs, and chain shortcuts as needed).
  2. List the pairs still left over.
  3. Try adding them, one or one mirror-couple at a time, and see which additions keep the properties you want and break the ones you don't.

Worked examples

  1. Reflexive and symmetric, containing (1, 2), but not transitive, in {1, 2, 3}. Smallest: R₀ = {(1, 1), (2, 2), (3, 3), (1, 2), (2, 1)}. This is transitive, so it does not count. Symmetry means the leftover pairs can only be added in couples: {(1, 3), (3, 1)} or {(2, 3), (3, 2)}.
    • Add {(1, 3), (3, 1)}: now 2 → 1 → 3 needs (2, 3), which is missing. Not transitive. Counts.
    • Add {(2, 3), (3, 2)}: now 1 → 2 → 3 needs (1, 3). Not transitive. Counts.
    • Add both: this is the universal relation, which is transitive. Does not count.
    Answer: 2.
  2. Symmetric and transitive but not reflexive, in {1, 2}. Any relation containing (1, 2) must, by symmetry, contain (2, 1), and then by transitivity both (1, 1) and (2, 2): that is the universal relation, which is reflexive. So (1, 2) can't be used. Among the relations using only (1, 1) and (2, 2): \( \phi \), {(1, 1)}, {(2, 2)} work, and {(1, 1), (2, 2)} is reflexive. Answer: 3.
  3. Reflexive relations in {1, 2, 3} that contain (1, 2) and (2, 1). 3 diagonal cells forced, 2 more cells forced, \( 9 - 5 = 4 \) cells free: \( 2^4 = 16 \).

These answers were checked by listing all 512 relations on {1, 2, 3} by computer.

Don't mix these up

  • Relations in an \( n \)-set: \( 2^{n^2} \). Relations from an \( m \)-set to an \( n \)-set: \( 2^{mn} \). Functions from an \( m \)-set to an \( n \)-set: \( n^m \) (next pages).
  • Symmetric relations: \( 2^{n(n+1)/2} \), with a plus. Reflexive and symmetric: \( 2^{n(n-1)/2} \), with a minus, because the diagonal is no longer free.

Try it. How many symmetric relations are there in a set with 4 elements? How many of them are also reflexive?

Answer
Symmetric: \( 2^{4 \cdot 5 / 2} = 2^{10} = 1024 \). Reflexive and symmetric: \( 2^{4 \cdot 3 / 2} = 2^6 = 64 \).

Words to know

Diagonal
The pairs (a, a), where an element is paired with itself.
Mirror pair
The two pairs (a, b) and (b, a) with a ≠ b.
Smallest relation
The relation with only the pairs that the conditions force.
Partition count
The number of ways to split a set into boxes; equals the number of equivalence relations.

How many reflexive relations are there in a set with 3 elements?

  1. 512
  2. 64
  3. 8

How many equivalence relations are there in {a, b, c}?

  1. 2
  2. 5
  3. 8

How many relations are there in {1, 2, 3} that are reflexive and symmetric and contain (2, 1) and (2, 3), but are not transitive?

  1. 1
  2. 2
  3. 4