IMOClass 11 › Relations and Functions

Relations and Functions

Cartesian Product and Relations

An ordered pair $(a, b)$ is two objects written in a fixed order — a first component $a$ and a second component $b$. Unlike a set, order is essential: $(a, b) = (c, d)$ only if $a = c$ and $b = d$. So $(2, 3) \ne (3, 2)$, whereas $\{2,3\} = \{3,2\}$.

The Cartesian product $A \times B$ is the set of all ordered pairs whose first component comes from $A$ and second from $B$:

$$A \times B = \{(a, b) : a \in A \text{ and } b \in B\}$$

Think of it as every possible pairing — one element of $A$ matched with one element of $B$, exhaustively. Because each of the $n(A)$ first components can be paired with each of the $n(B)$ second components, the size multiplies:

$$n(A \times B) = n(A) \times n(B)$$

Key properties:

PropertyStatement
Not commutative$A \times B \ne B \times A$ in general (unless $A = B$ or one is empty)
Empty factorIf $A = \varnothing$ or $B = \varnothing$, then $A \times B = \varnothing$
Distributes over $\cup,\cap$$A \times (B \cup C) = (A \times B) \cup (A \times C)$
Plane and space$\mathbb{R} \times \mathbb{R} = \mathbb{R}^2$ (the plane); $\mathbb{R}^3$ is the ordered triples $(x,y,z)$

The familiar $xy$-plane is exactly $\mathbb{R} \times \mathbb{R}$: every point is an ordered pair of real numbers. This is why the chapter matters — coordinate geometry, graphs of functions and the whole of calculus live inside a Cartesian product.

Deeper Insight — why "ordered" changes everything: The single word ordered is what separates this chapter from the previous one on sets. A set answers only "is this object in or out?"; an ordered pair additionally records "in which role?" — first or second, input or output, $x$ or $y$. That extra bit of structure is precisely what lets a Cartesian product model relationships between two collections rather than just a lump of objects. Once you grasp that $A \times B$ lists every conceivable pairing, the next two ideas fall out naturally: a relation is just a chosen subset of those pairings (the ones that actually satisfy some rule), and a function is a relation disciplined by one extra condition. Everything downstream — domain, range, graphs, even the coordinate plane you have used since Class 9 — is built on this one move from unordered membership to ordered pairing.

Cartesian product A times B as a grid of ordered pairs A × B with A = {1, 2}, B = {x, y, z} BA 12zyx (1,z)(1,y)(1,x)(2,z)(2,y)(2,x) 6 pairs2 × 3
Example 1: If $A = \{1, 2\}$ and $B = \{a, b, c\}$, write $A \times B$ and state $n(A \times B)$.
  1. Pair each element of $A$ with every element of $B$.
  2. $A \times B = \{(1,a),(1,b),(1,c),(2,a),(2,b),(2,c)\}$.
  3. $n(A \times B) = 2 \times 3 = 6$.

Answer: $6$ ordered pairs as listed above.

Example 2: If $(x + 1, y - 2) = (3, 1)$, find $x$ and $y$.
  1. Equal ordered pairs ⇒ components equal: $x + 1 = 3$ and $y - 2 = 1$.
  2. $x = 2$, $y = 3$.

Answer: $x = 2,\ y = 3$.

Example 3: If $n(A) = 3$ and $n(B) = 4$, how many elements are in $A \times B$, and how many in $A \times A$?
  1. $n(A \times B) = n(A) \cdot n(B) = 3 \times 4 = 12$.
  2. $n(A \times A) = 3 \times 3 = 9$.

Answer: $12$ and $9$ respectively.

Example 4: If $A \times B = \{(p, q), (p, r), (m, q), (m, r)\}$, find $A$ and $B$.
  1. First components form $A$: $\{p, m\}$.
  2. Second components form $B$: $\{q, r\}$.
  3. Check: $2 \times 2 = 4$ pairs ✓.

Answer: $A = \{p, m\}$, $B = \{q, r\}$.

Example 5: Let $A = \{1, 2\}$. Is $(1, 2) \in A \times A$? Is $(1, 3) \in A \times A$?
  1. $A \times A = \{(1,1),(1,2),(2,1),(2,2)\}$.
  2. $(1,2)$ appears in the list — yes.
  3. $3 \notin A$, so $(1,3)$ cannot be in $A \times A$ — no.

Answer: $(1,2) \in A \times A$; $(1,3) \notin A \times A$.

Example 6: If $A = \{-1, 1\}$, find $A \times A \times A$ and state how many ordered triples it contains.
  1. $n(A \times A \times A) = 2^3 = 8$.
  2. The triples are all $(\pm1, \pm1, \pm1)$: $(-1,-1,-1),(-1,-1,1),(-1,1,-1),(-1,1,1),(1,-1,-1),(1,-1,1),(1,1,-1),(1,1,1)$.

Answer: $8$ ordered triples (the eight $(\pm1,\pm1,\pm1)$ combinations).

Quick recap
  • An ordered pair $(a,b)$ fixes order: $(a,b) = (c,d) \iff a = c$ and $b = d$.
  • $A \times B = \{(a,b) : a \in A,\ b \in B\}$ — every possible pairing.
  • $n(A \times B) = n(A) \cdot n(B)$; the product is empty if either factor is empty.
  • $A \times B \ne B \times A$ in general; the $xy$-plane is $\mathbb{R} \times \mathbb{R}$.
✓ Quick check
If R = {(1,a),(2,b),(3,a)}, then the range of R is:
Range consists of actual second components used.
In the ordered pair (4,7), the first component is:
The first component of (4,7) is 4.

Functions, Domain and Range

A relation $R$ from set $A$ to set $B$ is any subset of $A \times B$. So a relation simply selects the ordered pairs that satisfy some rule, leaving the rest out:

$$R \subseteq A \times B; \qquad (a, b) \in R \text{ is written } a\,R\,b$$

For each relation we name three sets:

TermMeaning
Domainset of all first components in $R$ — the inputs actually used
Rangeset of all second components in $R$ — the outputs actually produced
Codomainthe whole target set $B$ — every output that could appear

The range is always a subset of the codomain ($\text{range} \subseteq B$), but they need not be equal — the codomain is the "menu", the range is "what was ordered".

Counting relations: a relation is a subset of $A \times B$, which has $n(A)\cdot n(B)$ pairs. Since a set with $k$ elements has $2^k$ subsets, the number of possible relations from $A$ to $B$ is

$$\text{number of relations} = 2^{\,n(A)\cdot n(B)}$$

Relations are often given by a rule, e.g. $R = \{(x, y) : y = x + 1,\ x \in A\}$, which you then list in roster form by testing each input.

Deeper Insight — a relation is a filter, and that is the bridge to functions: The whole content of this idea is "subset of the Cartesian product". $A \times B$ offers every possible pairing; a relation keeps only the pairings that obey a chosen condition — it is a filter on pairings. Reading the definition this way makes the domain/range distinction obvious: the domain is which inputs survived the filter, the range is which outputs they map to. It also explains the codomain, the subtlest of the three: we declare a target set $B$ in advance (the codomain) before we know which of its members will actually be hit (the range). This advance declaration is exactly what makes the next section possible — a function is nothing more than a relation with one extra rule imposed on the filter ("each input is used once, and exactly once"), so understanding a relation as a constrained subset is the conceptual key to the rest of the chapter.

Arrow diagram of a relation showing domain, range and codomain Relation R: a → b means (a, b) ∈ R A (domain set) B (codomain) 1232345 range = {2,3,4} ⊆ codomain {2,3,4,5}; element 5 is unused
Example 1: Let $A = \{1,2,3\}$, $B = \{4,5,6,7\}$ and $R = \{(x,y) : y = x + 3,\ x \in A\}$. Write $R$ in roster form and state its domain and range.
  1. $x=1 \Rightarrow y=4$; $x=2 \Rightarrow y=5$; $x=3 \Rightarrow y=6$.
  2. $R = \{(1,4),(2,5),(3,6)\}$.
  3. Domain $= \{1,2,3\}$; Range $= \{4,5,6\}$.

Answer: $R = \{(1,4),(2,5),(3,6)\}$; domain $\{1,2,3\}$, range $\{4,5,6\}$ (codomain is $\{4,5,6,7\}$).

Example 2: If $n(A) = 3$ and $n(B) = 2$, how many relations can be defined from $A$ to $B$?
  1. $n(A \times B) = 3 \times 2 = 6$.
  2. Number of relations $= 2^{6} = 64$.

Answer: $64$ relations.

Example 3: A relation $R$ on $A = \{1,2,3,4,5,6\}$ is $R = \{(x,y) : y = 2x\}$. Write $R$ in roster form.
  1. Keep only pairs where both $x$ and $2x$ lie in $A$.
  2. $x=1 \to 2$; $x=2 \to 4$; $x=3 \to 6$. For $x=4,5,6$, $2x$ exceeds $6$.

Answer: $R = \{(1,2),(2,4),(3,6)\}$.

Example 4: Write the domain and range of $R = \{(x, x^2) : x \text{ is a prime} < 10\}$.
  1. Primes below $10$: $2, 3, 5, 7$.
  2. $R = \{(2,4),(3,9),(5,25),(7,49)\}$.

Answer: Domain $= \{2,3,5,7\}$; Range $= \{4,9,25,49\}$.

Example 5: The figure-free relation $R = \{(1,3),(1,5),(2,5)\}$ is from $A=\{1,2\}$ to $B=\{3,5\}$. Is this a valid relation? Find its domain and range.
  1. Every pair has its first component in $A$ and second in $B$, so $R \subseteq A \times B$ — valid.
  2. Domain $= \{1,2\}$ (first components).
  3. Range $= \{3,5\}$ (second components).

Answer: Yes, valid; domain $\{1,2\}$, range $\{3,5\}$. (Note $1$ relates to two values — fine for a relation.)

Example 6: Let $R = \{(a,b) : a, b \in \mathbb{N},\ a + b = 5\}$. Write $R$ and its range.
  1. Natural-number pairs summing to $5$: $(1,4),(2,3),(3,2),(4,1)$.
  2. ($a=5$ would need $b=0 \notin \mathbb{N}$.)

Answer: $R = \{(1,4),(2,3),(3,2),(4,1)\}$; range $= \{1,2,3,4\}$.

Quick recap
  • A relation $R$ from $A$ to $B$ is any subset of $A \times B$.
  • Domain = first components used; range = second components produced; codomain = the whole target $B$.
  • Always $\text{range} \subseteq \text{codomain}$, but they may differ.
  • Number of relations from $A$ to $B$ is $2^{n(A)\cdot n(B)}$.
✓ Quick check
A function f: R → R is defined as f(x) = c, where c is a real constant. What type of function is this?
A function that maps all elements of the domain to a single constant value c is called a Constant Function.
The signum function sgn(0) equals:
Signum of zero is 0.

Types and Special Functions

A function $f$ from $A$ to $B$ is a relation in which every element of $A$ is paired with exactly one element of $B$. Two demands, both essential: every input is used (no element of $A$ left out), and each input gives one output (never two). We write $f : A \to B$ and $y = f(x)$.

$$f : A \to B \text{ is a function} \iff \text{each } x \in A \text{ has a unique image } f(x) \in B$$

The vertical line test captures this graphically: a curve is a function exactly when no vertical line meets it more than once (one $x$, one $y$).

Standard real functions you must recognise by formula and graph:

FunctionRuleDomainRange
Identity$f(x) = x$$\mathbb{R}$$\mathbb{R}$
Constant$f(x) = c$$\mathbb{R}$$\{c\}$
Modulus$f(x) = |x|$$\mathbb{R}$$[0, \infty)$
Signum$f(x) = \dfrac{|x|}{x}\,(x\ne0)$$\mathbb{R}$$\{-1, 0, 1\}$
Greatest integer$f(x) = [x]$$\mathbb{R}$$\mathbb{Z}$
Reciprocal$f(x) = \dfrac{1}{x}$$\mathbb{R}\setminus\{0\}$$\mathbb{R}\setminus\{0\}$

Algebra of real functions: for functions with overlapping domains you may add, subtract, multiply and divide them pointwise: $(f \pm g)(x) = f(x) \pm g(x)$, $(fg)(x) = f(x)g(x)$, and $\left(\tfrac{f}{g}\right)(x) = \tfrac{f(x)}{g(x)}$ wherever $g(x) \ne 0$.

Finding the domain of a real function means listing every $x$ for which the rule gives a real value — exclude inputs that cause division by zero or an even root of a negative number. The range is the resulting set of outputs.

Deeper Insight — "exactly one output" is the entire idea, and it is what makes calculus possible: A function is a relation that has been disciplined by a single rule: one input, one output. That rule looks modest but it is the reason functions, not arbitrary relations, became the central object of mathematics — because a unique output per input is exactly what lets us speak of "the value of $f$ at $x$", differentiate it, integrate it, and invert it. The vertical line test is just this rule drawn on a graph. The standard functions in the table are worth memorising not as trivia but as a vocabulary: nearly every function you meet later is built by combining, transforming or composing these few, so knowing their shapes (the V of $|x|$, the steps of $[x]$, the three-level jump of the signum) lets you predict the behaviour of complicated expressions at a glance. Master "unique image" and the standard graphs, and the leap to Limits and Derivatives in Chapter 12 becomes a short step rather than a cliff.

Modulus and greatest-integer function graphs f(x) = |x|xyV-shape, range [0, ∞) f(x) = [x] (step)jumps at each integer, range ℤ
Example 1: Is $R = \{(1,2),(2,3),(1,4)\}$ from $A=\{1,2\}$ a function? Why or why not?
  1. Check each input has a unique output.
  2. Input $1$ maps to both $2$ and $4$ — two images.

Answer: No — it is a relation but not a function, since $1$ does not have a unique image.

Example 2: Find the domain of $f(x) = \dfrac{1}{x^2 - 4}$.
  1. The denominator must be non-zero: $x^2 - 4 \ne 0$.
  2. $x^2 \ne 4 \Rightarrow x \ne \pm 2$.

Answer: Domain $= \mathbb{R} \setminus \{-2, 2\}$.

Example 3: Find the domain and range of $f(x) = \sqrt{x - 3}$.
  1. The radicand must be $\ge 0$: $x - 3 \ge 0 \Rightarrow x \ge 3$.
  2. The square root yields values $\ge 0$.

Answer: Domain $= [3, \infty)$; Range $= [0, \infty)$.

Example 4: Evaluate the greatest integer function: $[2.7]$, $[-2.7]$ and $[5]$.
  1. $[x]$ is the greatest integer $\le x$.
  2. $[2.7] = 2$.
  3. $[-2.7] = -3$ (since $-3 \le -2.7 < -2$).
  4. $[5] = 5$.

Answer: $[2.7] = 2$, $[-2.7] = -3$, $[5] = 5$.

Example 5: If $f(x) = x^2$ and $g(x) = 2x + 1$, find $(f + g)(x)$ and $(fg)(2)$.
  1. $(f+g)(x) = f(x) + g(x) = x^2 + 2x + 1$.
  2. $(fg)(2) = f(2) \cdot g(2) = (2^2)(2\cdot2+1) = 4 \times 5 = 20$.

Answer: $(f+g)(x) = x^2 + 2x + 1$; $(fg)(2) = 20$.

Example 6: Find the range of $f(x) = |x - 2| + 1$.
  1. $|x-2| \ge 0$ for all $x$, with minimum $0$ at $x = 2$.
  2. So $f(x) = |x-2| + 1 \ge 0 + 1 = 1$, and it grows without bound.

Answer: Range $= [1, \infty)$.

Quick recap
  • A function $f:A\to B$ assigns to every $x\in A$ exactly one image $f(x)\in B$.
  • Vertical line test: a graph is a function if no vertical line cuts it more than once.
  • Know the standard functions and graphs: identity, constant, $|x|$, signum, $[x]$, $1/x$.
  • Domain excludes division by zero and even roots of negatives; functions add/subtract/multiply/divide pointwise.
✓ Quick check
If every bus route number corresponds to exactly one route, then the mapping is:
One route number maps to one route.
During Diwali, a sweets shop in Kolkata packs rasgullas. If each box contains exactly 12 pieces, the mapping from the number of boxes to the total pieces is a function. What kind of function is f(x) = 12x?
f(x) = 12x is a polynomial of degree 1, which defines a linear function. Its graph is a straight line passing through the origin.
Ready to test this chapter?
Take the Chapter Test →