Relations

Two sets sit side by side — a list of book titles and a list of authors, or a set of countries and a set of capitals. A relation is simply the mathematical device for saying which items from the first set are linked to which items from the second: it is a chosen subset of ordered pairs picked out of the Cartesian product A×BA \times B. Once you can form A×BA \times B, a relation just filters that product down to the pairs that satisfy some rule or connection you care about — "is the square of," "divides," "is the capital of." This article builds the formal definition, shows how to read off a relation's domain, co-domain and range, and counts how many different relations can exist between two finite sets. Reflexive, symmetric and transitive relations are a Class 12 topic and are deliberately left out here.

The core insight

A relation RR from AA to BB is any subset of A×BA \times B, and it can always be described by roster form, set-builder form or an arrow diagram, with domain, co-domain and range read off from the ordered pairs it contains.

The core idea

Given two non-empty sets AA and BB, a relation RR from AA to BB is defined as any subset of the Cartesian product:

R⊆A×B.R \subseteq A \times B.

where: A×BA \times B is the set of all ordered pairs (a,b)(a,b) with a∈Aa \in A and b∈Bb \in B, and RR is whichever pairs we choose to keep. If (a,b)∈R(a,b) \in R we say aa is related to bb under RR, written a R ba\,R\,b. A relation can be written in three equivalent ways. In roster form the pairs are listed explicitly, e.g. R={(1,2),(2,4),(3,6)}R = \{(1,2),(2,4),(3,6)\}. In set-builder form the defining rule is stated instead of the pairs, e.g. R={(x,y):y=2x, x∈A, y∈B}R = \{(x,y) : y = 2x,\ x \in A,\ y \in B\}. In an arrow diagram, AA and BB are drawn as two ovals and an arrow is drawn from each aa to every bb with (a,b)∈R(a,b) \in R — a picture of the same information. Every relation carries three associated sets. The domain is the set of first components actually used:

Domain(R)={a:(a,b)∈R for some b}.\text{Domain}(R) = \{a : (a,b) \in R \text{ for some } b\}.

The co-domain is the whole of BB, fixed in advance regardless of what gets used. The range is the set of second components actually hit:

Range(R)={b:(a,b)∈R for some a}.\text{Range}(R) = \{b : (a,b) \in R \text{ for some } a\}.

where: range is always a subset of co-domain, but the two need not be equal — co-domain is the declared target set BB, while range is only the part of BB that some pair actually reaches.

Figure
Two ovals labelled A and B with arrows from selected elements of A to selected elements of B, and the used elements of B marked as the range inside the larger co-domain oval
A relation R as a subset of ordered pairs from A to B A B (co-domain) range 1 2 3 4 9 25 Elements 3 and 25 sit unused; co-domain stays all of B while range is only the hit part

The number of possible relations from A to B

Since a relation is nothing more than a chosen subset of A×BA \times B, the goal here is to count, in one formula, how many distinct relations can be formed between two finite sets AA and BB purely from the sizes of the sets, using only the fact that A×BA \times B has n(A)⋅n(B)n(A)\cdot n(B) elements and that a set with kk elements has 2k2^k subsets in total.

Derivation ACounting the relations between two finite sets

The goal is to show that if n(A)=pn(A) = p and n(B)=qn(B) = q, the total number of relations that can be defined from AA to BB — including the empty relation and the full relation R=A×BR = A \times B — is exactly 2pq2^{pq}, by combining the size of the Cartesian product with the subset-counting rule.

Step 1. Find the size of A×BA \times B. Every element of AA can be paired with every element of BB, so A×BA \times B contains exactly n(A)×n(B)=pqn(A) \times n(B) = pq ordered pairs. This is the ground set from which a relation is drawn.

Step 2. Recall that a relation RR is, by definition, any subset of A×BA \times B — there is no restriction on which pairs may be included or excluded, so every subset of A×BA \times B is a legitimate relation, and every relation is some subset of A×BA \times B.

Step 3. Count the subsets of a set with pqpq elements. A standard result (proved by choosing, independently, to include or exclude each of the pqpq elements) is that a set with kk elements has exactly 2k2^k subsets. Applying this with k=pqk = pq gives 2pq2^{pq} subsets of A×BA \times B.

Step 4. Conclude. Since relations from AA to BB are exactly the subsets of A×BA \times B, the total number of possible relations from AA to BB is 2pq=2n(A)⋅n(B)2^{pq} = 2^{n(A)\cdot n(B)}. This count includes the empty relation (∅\varnothing, where nothing is related to anything) and the full relation (R=A×BR = A \times B, where everything is related to everything).

Worked example

Let A={1,2,3,4}A = \{1,2,3,4\} and B={1,4,9,16,25}B = \{1,4,9,16,25\}, and define R={(x,y):y=x2, x∈A, y∈B}R = \{(x,y) : y = x^2,\ x \in A,\ y \in B\}.

Step 1. Apply the rule to each element of AA. For x=1x=1, y=1∈By=1 \in B, so (1,1)∈R(1,1) \in R. For x=2x=2, y=4∈By=4 \in B, so (2,4)∈R(2,4) \in R. For x=3x=3, y=9∈By=9 \in B, so (3,9)∈R(3,9) \in R. For x=4x=4, y=16∈By=16 \in B, so (4,16)∈R(4,16) \in R.

Step 2. Write RR in roster form: R={(1,1),(2,4),(3,9),(4,16)}R = \{(1,1),(2,4),(3,9),(4,16)\}.

Step 3. Read off the three sets. Domain ={1,2,3,4}= \{1,2,3,4\}, since every element of AA appeared as a first entry. Co-domain =B={1,4,9,16,25}= B = \{1,4,9,16,25\}, the full declared set. Range ={1,4,9,16}= \{1,4,9,16\} — note 2525 sits in the co-domain but not the range, since no x∈Ax \in A satisfies x2=25x^2 = 25.

Step 4. Apply the counting formula from the derivation as a check on scale. Here n(A)=4n(A) = 4 and n(B)=5n(B) = 5, so n(A×B)=20n(A\times B) = 20 and the total number of possible relations from AA to BB is 220=1,048,5762^{20} = 1{,}048{,}576 — the single relation RR above is just one of over a million subsets of A×BA \times B.

The relation is R={(1,1),(2,4),(3,9),(4,16)}R = \{(1,1),(2,4),(3,9),(4,16)\}, with domain {1,2,3,4}\{1,2,3,4\}, co-domain {1,4,9,16,25}\{1,4,9,16,25\} and range {1,4,9,16}\{1,4,9,16\}.

Competitive stretch

Take A={2,3,5}A = \{2,3,5\}, B={4,6,9,10}B = \{4,6,9,10\}, and R={(a,b):a divides b}R = \{(a,b) : a \text{ divides } b\}. Checking divisibility pair by pair gives R={(2,4),(2,6),(2,10),(3,6),(3,9),(5,10)}R = \{(2,4),(2,6),(2,10),(3,6),(3,9),(5,10)\}, so domain ={2,3,5}= \{2,3,5\} and range ={4,6,9,10}= \{4,6,9,10\} — here every element of BB is hit, so range equals co-domain. Since n(A)=3n(A)=3 and n(B)=4n(B)=4, n(A×B)=12n(A\times B)=12, so the total number of possible relations from AA to BB is 212=40962^{12} = 4096.

Common traps

  • Confusing co-domain with range. Co-domain is the entire set BB as declared; range is only the part of BB actually reached by some pair. They coincide only when every element of BB is used.
  • Treating the rule as the relation. "y=x2y = x^2" or "aa divides bb" is just a description of which pairs belong to RR; the relation itself is the resulting set of ordered pairs, not the formula.
  • Applying reflexive, symmetric or transitive labels. These classifications belong to Class 12 — this syllabus only asks for domain, co-domain, range and the three representations.
  • Forgetting the 2pq2^{pq} count includes the empty and full relations. Students often only count "interesting" relations and undercount, or forget that R=∅R = \varnothing and R=A×BR = A \times B are both valid relations.

Ask the tutor: Still mixing up domain, co-domain and range, or want more practice converting a word rule into roster form? Ask the AI tutor for a fresh set of examples with step-by-step working.

Is every relation also a function

No. A function is a special kind of relation where every element of the domain set AA is related to exactly one element of BB — no element of AA may have two arrows going out or none at all. A general relation has no such restriction: some elements of AA can point to several elements of BB, and others can point to none. The Class 11 relations chapter only asks you to identify domain, co-domain and range for a given relation; the extra function condition and its vocabulary come right after this topic.

Why does range not always equal co-domain

Co-domain is simply the set BB you declared at the start, fixed before you even define RR. Range is worked out afterward, from whichever pairs actually satisfy the rule of RR. If some elements of BB never get paired with anything from AA — like 2525 in the squares example, since no element of A={1,2,3,4}A = \{1,2,3,4\} squares to 2525 — those elements stay in the co-domain but are excluded from the range. Range equals co-domain only in the special case where every element of BB happens to be used.

How do I quickly count the number of relations possible between two sets

Multiply the sizes of the two sets to get n(A×B)=n(A)⋅n(B)n(A \times B) = n(A) \cdot n(B), then raise 2 to that power. This works because a relation is any subset of A×BA \times B, and a set with kk elements has exactly 2k2^k subsets. For example, with n(A)=3n(A) = 3 and n(B)=4n(B) = 4, n(A×B)=12n(A \times B) = 12, so there are 212=40962^{12} = 4096 possible relations, ranging from the empty relation to the full relation A×BA \times B itself.

Before this

Where this leads