Relations and Functions
Pick up any two collections of things — a set of colours and a set of garments, a set of states and a set of licence codes, a set of students and a set of roll numbers — and ask a simple question: in how many ordered ways can you pair one item from the first set with one item from the second? That question, asked and answered precisely, is where this chapter begins. Pairing every element of a set with every element of a set , in a fixed order, produces the Cartesian product , and once you can count and manipulate these ordered pairs, a much richer idea appears almost for free: a relation, which is nothing but a chosen subset of — a rule that links some elements of to some elements of . Among all possible relations, one very special kind deserves its own name, because it is the one that mathematics leans on more than any other single idea: a function, a relation in which every input has exactly one output. Functions are the machines of mathematics — feed in a number, get out a number, always the same one for the same input. This chapter builds that machine from scratch: ordered pairs, then Cartesian products, then relations with their domain and range, then functions, then a gallery of standard functions (identity, constant, polynomial, rational, modulus, signum, greatest integer) whose graphs you must be able to sketch on sight, and finally an algebra for combining functions by adding, subtracting, multiplying and dividing them. Everything that follows in your mathematical life — trigonometric functions, exponential and logarithmic functions, limits, derivatives — is built on the vocabulary fixed here. Master the distinction between a relation and a function now, and the rest of calculus reads as a natural extension rather than a fresh mystery.
- An ordered pair has order built in: if and only if and ; in general .
- The Cartesian product collects every ordered pair with first entry from and second entry from ; if and , then .
- Cartesian product is not commutative: in general, and for any set .
- A relation from to is any subset of ; its domain is the set of first elements used, its range is the set of second elements used, and the whole set is its codomain, with range codomain always.
- The total number of relations from a set with to a set with is , since a relation is any subset of the -element set .
- A function is a relation from to in which every element of has one and only one image in ; if we write , with the preimage and the image.
- A real function has both its domain and its range as subsets of ; the chapter catalogues seven standard real functions — identity, constant, polynomial, rational, modulus, signum, greatest integer — each with a signature graph.
- The algebra of real functions lets you build new functions from old: , , , and wherever .
- Finding the domain of an algebraic real function usually means excluding points that make a denominator zero or a square-root argument negative; the range is found by analysing what values the formula can actually output.
- Key idea: a relation is any chosen subset of the Cartesian product A times B, and a function is the special relation in which every element of the domain has exactly one image, so the whole chapter is a ladder from ordered pairs to Cartesian products to relations to functions to an algebra for combining them.
A relation from to is any subset of the Cartesian product , and a function is the special case where every element of is paired with exactly one element of , giving the entire chapter's ladder: ordered pairs Cartesian products relations (domain, codomain, range) functions standard real functions and their algebra.
What this chapter covers
The chapter climbs a short, tight ladder of ideas. It opens with the ordered pair and the rule for when two ordered pairs are equal, then builds the Cartesian product of two sets, counts its elements, and records how it interacts with union, intersection and the empty set. On top of that foundation sits the relation: any subset of , described either by roster or set-builder form, together with the vocabulary of domain, codomain and range and the count of all possible relations between two finite sets. The chapter then isolates the function as the relation obeying the strict "one image per input" rule, and works through a gallery of standard real functions — identity, constant, polynomial, rational, modulus, signum and greatest integer — each defined algebraically and sketched graphically. It closes with the algebra of real functions, the rules for adding, subtracting, scaling, multiplying and dividing two functions defined on a common domain.
The core ideas
Ordered pairs and the Cartesian product
An ordered pair is a pair of elements written in a fixed order and grouped in brackets, , with coming from one set and from another. Order matters absolutely: the licence code is not the same object as . This gives the defining rule for equality of ordered pairs, and from it the formal definition of the Cartesian product.
where: in equation , are the first entries and the second entries of two ordered pairs, and the double arrow means the two conditions on the right are both necessary and sufficient for the pair equality on the left. In equation , and are any two non-empty sets, and (read " cross ") is the set of every ordered pair with first coordinate in and second coordinate in . For and , listing all such pairs gives — six pairs in all, one for every way of picking a colour and then an object. If either or is empty, there is nothing to pair, so for every set . The product does not commute: swapping the roles of and generally gives a genuinely different set of pairs, since and are equal only in the special case . The idea extends naturally to three sets: , whose members are called ordered triplets, and is precisely the set of coordinates of every point in the Cartesian plane — the reason this construction is named after Descartes.
Relations: domain, codomain and range
A relation turns a raw Cartesian product into something meaningful by selecting only the pairs that satisfy some rule.
Definition. A relation from a non-empty set to a non-empty set is a subset of the Cartesian product . The subset is picked out by describing a relationship between the first element and the second element of each ordered pair. If , we say is the image of under , and is a preimage of .
where: the domain collects every first element actually used by some pair in , the range collects every second element actually used, and the codomain is the entire target set , whether or not every element of gets used. Range is always a subset of codomain, and it can be a proper subset — an element of that no pair points to simply sits in the codomain unused. For and , the roster form is , so the domain is (element has no partner and drops out), the range is , and the codomain remains the full set by definition, regardless of what is actually hit. A relation can be written in roster form (listing pairs), in set-builder form (stating the rule), or drawn as an arrow diagram, with arrows running from each element of to its image or images in . Since a relation is any subset of , and a set with elements has subsets, the total number of relations from a set of size to a set of size is — proved in full in the third derivation below.
Functions: the relations that behave
Among all possible relations from to , functions are the ones that behave like reliable machines: put in an input, always get exactly one predictable output.
Definition. A relation from a non-empty set to a non-empty set is a function if every element of has one and only one image in . Equivalently, is a function if its domain is all of , and no two distinct ordered pairs in share the same first element. If , we write , calling the image of and the preimage of , and denote the function .
where: the symbol reads "for every," reads "there exists exactly one," so equation is the precise translation of the definition: every single element of , with no exception, must be matched to exactly one element of — not zero, not two or more. This single sentence is the sharpest possible test of "is this relation a function?" Two failure modes cover every non-function you will ever meet: some element of has no image at all (domain is not all of ), or some element of has two or more images (the "one and only one" clause is violated). A real valued function is one whose range is or a subset of ; if its domain is also or a subset of , it is called a real function — the kind this chapter graphs.
Standard real functions and their graphs
Seven functions recur so often that you must recognise their formulas and their graphs on sight.
where: in the polynomial function is a non-negative integer and are constants; in the rational function and are polynomial functions with never allowed to vanish. The identity function graphs as the straight line through the origin at ; the constant function graphs as a horizontal line at height , with domain but range the single value . The modulus function folds the negative -axis up onto the positive -values, producing a symmetric "V" with vertex at the origin; the signum function collapses every positive input to and every negative input to , with a single defined value exactly at the origin, so its range is the three-point set . The greatest integer function (also called the floor function) stays constant at each integer value across the half-open interval , then jumps up by exactly at the next integer — so , and ; its graph is a staircase, rising in unit steps and constant between consecutive integers, with each step including its left endpoint but not its right.
Algebra of real functions
Two real functions defined on the same domain can be combined pointwise — evaluate each function at separately, then combine the two numbers with ordinary arithmetic.
where: are real functions sharing the common domain , is any real scalar, and every combined function is again defined for , except the quotient, which additionally needs — so the domain of is with the zeros of removed. Each rule is simply "do the arithmetic operation to the two output numbers, at every input separately" — nothing here is new arithmetic, only new bookkeeping about where the resulting function is defined. For and : , , , and for — the one point where the quotient's domain shrinks relative to and individually.
Two worked derivations and one counting proof
The chapter states, as a remark rather than a proved theorem, that if and then . This is worth proving properly, because the same counting argument reappears almost unchanged when counting the total number of relations later in this chapter. The goal is to show, by a simple counting argument, that the number of ordered pairs built from a -element set and a -element set is exactly , with no pair counted twice and none missed.
Step 1. List as and as . Every ordered pair in has the form for some index and , and every such choice of indices gives exactly one pair. So counting is the same as counting choices of the index pair .
Step 2. Arrange the count as a grid. Fix : the pairs give exactly pairs, one per choice of . The same holds for every other fixed : each of the choices of contributes its own row of pairs.
Step 3. No pair is shared between two rows, because pairs from different rows have different first coordinates ( for ), so by the equality rule in equation they can never coincide. The rows are disjoint, so the total is the sum of rows of size : .
Step 4. Hence exactly, since every pair falls into exactly one row and every row contributes exactly new pairs. This is exactly the rectangular array in the Cartesian-product figure above: columns, rows, one dot per pair, dots total.
Go deeper · Derivation B · 1 minThe distributive law of Cartesian product over intersection
NCERT's own worked example verifies, for one specific choice of , and , that . A single numerical check is not a proof — it only shows the claim did not fail for that triple. The goal here is to establish the identity for arbitrary sets, using the standard double-inclusion technique: show an arbitrary element of the left side lies in the right side, and vice versa, which together force the two sets to be identical.
Step 1. Take an arbitrary . By definition of the Cartesian product, and ; by definition of intersection, and simultaneously.
Step 2. We now have , , and . Combining with gives ; combining with gives .
Step 3. Since belongs to both and , it belongs to their intersection: . This proves .
Step 4. Run the argument in reverse for the other inclusion. Take arbitrary , so and ; hence , and with this gives . The two inclusions together force equality: , for every choice of , , , not merely the one triple NCERT checks numerically.
Go deeper · Derivation C · 1 minCounting the total number of relations from A to B
The chapter records, as a side note, that the total number of relations from a set with to a set with is . The goal is to justify this from first principles, using only the definition of a relation as "any subset of " and the basic fact that a finite set with elements has subsets, reducing the relation-count to that more familiar counting fact.
Step 1. By definition, a relation from to is any subset of , with no further restriction. So the number of possible relations equals the number of subsets of .
Step 2. By the counting derivation above, , so the question becomes: how many subsets does a -element set have?
Step 3. Label the elements . Building any subset means making an independent yes/no decision for each element — is included (2 choices), is included (2 choices), and so on. Each element contributes an independent factor of , since one element's decision never restricts another's.
Step 4. Multiplying the independent factors of gives subsets in total, so the number of relations from to is . Check: for , , , so relations number — every subset of , from the empty relation to all of , counts as one distinct relation.
Worked examples
Board level - equal ordered pairs and the size of a Cartesian product (Example 1 pattern)
If , find the values of and . Also, if a set has elements and , find the number of elements in .
Step 1. Since the two ordered pairs are equal, their corresponding entries must be equal individually, by equation : and .
Step 2. Solve each small equation on its own: from , ; from , .
Step 3. For the second part, and (since has three listed elements). By equation and the counting derivation above, .
Step 4. No further simplification is needed; both parts are independent applications of the two basic rules of this section. Answer: x = 2, y = 3, and n(A × B) = 9.
Board level - testing relations for the function property (Example 11 pattern)
Examine each relation below and state, with reasons, whether it is a function. For each one that is, give its domain and range. (i) (ii) (iii) .
Step 1. Apply the function test from equation to : the first elements used are , all distinct, and each is paired with exactly one image ( respectively — note that two different inputs, and , are allowed to share the same output ; the rule only forbids one input having two outputs). So is a function, with domain and range .
Step 2. Apply the same test to : the first element appears twice, once paired with and once paired with . A single input cannot have two different images and still satisfy "one and only one image," so fails the function test — it is a relation, but not a function.
Step 3. Apply the test to : the first elements are all distinct, and each is paired with exactly one image. So is a function, with domain and range .
Step 4. Collect the verdicts: two of the three relations qualify as functions, and one does not, purely because of a repeated first element with conflicting images. Answer: R1 is a function (domain {2,3,4}, range {1,2}); R2 is not a function (2 has two images); R3 is a function (domain {1,2,3,4,5,6}, range {2,3,4,5,6,7}).
Competitive level (JEE / NEET) - domain of a function combining a square root and a factorable denominator
Find the domain of the real function .
Step 1. Two separate restrictions apply simultaneously, and the domain is the set of satisfying both at once. The square root in the numerator forces its argument to be non-negative: , i.e. .
Step 2. The denominator must never be zero. Factorise it exactly as in Example 21 of the chapter: , which vanishes when or . So and are required, on top of the condition from Step 1.
Step 3. Combine both restrictions on the real line: start with (a closed ray from onward), then delete the two isolated points and that would make the denominator vanish. This is the classic JEE domain pattern — an inequality restriction from an even root, intersected with finitely many excluded points from a factorable denominator.
Step 4. Write the resulting domain in interval notation as a union of intervals: . Answer: domain of f = [1, 2) ∪ (2, 3) ∪ (3, ∞). Timing note: budget about ninety seconds. The efficient order is always "handle the root's inequality first, then factor the denominator for excluded points, then intersect" — doing the factoring before the inequality wastes no time either, but skipping the inequality altogether (a very common slip when a numerator also has algebraic structure) silently admits values like that make the square root undefined. Always write the final domain as an explicit interval, since JEE and NEET options are frequently designed to catch a student who reports "all reals except 2 and 3" and forgets the restriction entirely.
Common traps
The single most frequent error in this chapter is treating "relation" and "function" as interchangeable — every function is a relation, but most relations are not functions, and examiners exploit this by presenting a relation with a repeated or missing first element and asking whether it qualifies. A related slip is forgetting that codomain and range differ: the codomain is the whole target set fixed by the problem, while the range is only the part actually hit, and range codomain is normal, not an error. Students also mishandle versus , assuming commutativity that fails except in trivial cases. In the algebra of real functions, the common oversight is forgetting that needs its own smaller domain — every point where must be excluded even if is defined there. With the greatest integer function, students round to the nearest integer instead of always rounding down: , not .
You should be able to…
- State the precise rule for when two ordered pairs are equal, and use it to solve for unknowns inside ordered pairs.
- Define the Cartesian product , compute , and explain why in general.
- Write a relation in roster form, set-builder form, and as an arrow diagram, and correctly identify its domain, codomain and range.
- Count the total number of relations between two finite sets as , and explain why this counts subsets of .
- State the precise definition of a function, and correctly classify any given relation as a function or not, with a stated reason.
- Recognise and sketch the graphs of the identity, constant, polynomial, rational, modulus, signum and greatest integer functions.
- Evaluate correctly for negative non-integer inputs, without confusing "greatest integer " with simple truncation.
- Combine two real functions using the algebra of functions — sum, difference, scalar multiple, product, quotient — including the extra domain restriction for a quotient.
- Find the domain of an algebraic real function by combining even-root non-negativity conditions with denominator-nonzero conditions.
- Prove simple set-theoretic identities about Cartesian products, such as distributivity over intersection, using the element-chasing double-inclusion method.
Ask the tutor: Want to work through classifying a tricky relation as a function, or finding the domain of a harder algebraic function, step by step together?
What exactly is the difference between codomain and range?
The codomain is announced upfront as part of the definition of the relation or function — it is the entire target set that outputs are allowed to land in, whether or not every element of it is actually used. The range is discovered afterward: it is only the elements of that some input actually maps to. So range is always a subset of codomain, and it is completely normal for the range to be strictly smaller. For instance, if is defined by , the codomain is announced as all of , but the range turns out to be only the non-negative reals, since a square can never be negative. Neither number is "wrong" — they answer different questions, one about the stated target and one about the actual output.
Why is A times B generally not equal to B times A?
Because the Cartesian product remembers order, and swapping which set supplies the first coordinate versus the second genuinely changes almost every pair. Take and : then while , and by the ordered-pair equality rule unless . The two sets do have the same number of elements, since either way — counting doesn't care about order — but the actual pairs listed are different objects. Cartesian product is commutative only in special coincidental cases, such as , or when one of the sets is empty (both products are then empty).
How do I quickly decide whether a set of ordered pairs is a function without drawing an arrow diagram every time?
List only the first coordinates of every pair. If any value appears more than once in that list, check whether it is paired with the same second coordinate every time or with different ones; if it is ever paired with two genuinely different second coordinates, the relation is not a function, immediately. If every first coordinate in the list is distinct (no repeats at all), the relation is automatically a function, because there is no possibility of one input having two outputs. This first-coordinates check is exactly the arrow-diagram test in algebraic form: an arrow diagram fails to be a function only when some starting point sends out two or more arrows, which is precisely "the same first coordinate with two different second coordinates."
Is the greatest integer function the same as simply chopping off the decimal part of a number?
Only for non-negative numbers — for negative numbers, chopping the decimal part and taking the greatest integer give different results, and this is a very common source of error. For , both "chop the decimal" and "" give . But for , chopping the decimal naively gives , while the greatest integer function requires the greatest integer that is still less than or equal to , which is , not (since , it fails the "less than or equal to" requirement). The safe method for negative inputs is to move left on the number line to the nearest integer at or below the given value, never toward zero.
Why does the quotient of two functions need its own separate domain restriction?
Because division by zero is undefined in ordinary arithmetic, and the quotient function performs an actual division at every input. Even if both and are individually defined everywhere on some domain , the moment for some particular in , the expression becomes meaningless at that one point, so it must be excluded from the domain of specifically, even though it remains perfectly fine in the domains of and separately. For and , both are defined for every real , yet is undefined exactly at , the single point excised from an otherwise unrestricted domain.