Why Every Function Is a Relation but Not Every Relation Is a Function
Form Cartesian products and count their elements, define relations as subsets of A × B using arrow diagrams, roster and set-builder form, find domain, co-domain and range, and tell a relation from a function.
How do relations connect the elements of two sets?
Is a sibling of, is less than, is the capital of — everyday language is full of links between objects. Mathematics captures these links as relations built from ordered pairs, and one special kind of relation becomes the function studied in the next chapter.
This lesson covers Cartesian products, relations and their representations, domain, co-domain and range, and how a relation differs from a function.
This lesson covers Cartesian products, relations and their representations, domain, co-domain and range, and how a relation differs from a function.
What is the Cartesian product of two sets, and how many elements does it have?
**The Cartesian product is the set of all ordered pairs with and , and if A has p elements and B has q elements, then has elements.
Ordered pairs.** only when and , so .
Worked example. Let and .
so . The product also has 6 elements, but its pairs are different.
Useful facts:
- unless or one of the sets is empty
- If A or B is empty, then
An everyday example. A dosa stall offering 4 kinds of dosa with 3 chutneys has dosa-chutney combinations — a Cartesian product.
The substance. Order matters in a pair but not in a set — , yet .
Ordered pairs.** only when and , so .
Worked example. Let and .
so . The product also has 6 elements, but its pairs are different.
Useful facts:
- unless or one of the sets is empty
- If A or B is empty, then
An everyday example. A dosa stall offering 4 kinds of dosa with 3 chutneys has dosa-chutney combinations — a Cartesian product.
The substance. Order matters in a pair but not in a set — , yet .
How is a relation from A to B defined and shown using arrow diagrams, roster form and set-builder form?
**A relation R from A to B is any subset of ; it can be shown as an arrow diagram joining related elements, in roster form as a list of ordered pairs, or in set-builder form as the rule the pairs satisfy.
Worked example.** Let , and let R relate a to b when .
- Roster form —
- Arrow diagram — arrows from 1 to 1, 2 to 4, 3 to 9 and 4 to 16; the element 25 receives no arrow
- Set-builder form —
Counting relations. Since has elements, the number of relations from A to B is . With and , there are relations, including the empty relation.
An everyday example. Linking each student to the school clubs they have joined — one student to several clubs, some clubs to nobody — is a relation.
The substance. The empty set is also a relation — it is a subset of , simply one with no pairs.
Worked example.** Let , and let R relate a to b when .
- Roster form —
- Arrow diagram — arrows from 1 to 1, 2 to 4, 3 to 9 and 4 to 16; the element 25 receives no arrow
- Set-builder form —
Counting relations. Since has elements, the number of relations from A to B is . With and , there are relations, including the empty relation.
An everyday example. Linking each student to the school clubs they have joined — one student to several clubs, some clubs to nobody — is a relation.
The substance. The empty set is also a relation — it is a subset of , simply one with no pairs.
How do you find the domain, co-domain and range of a relation?
The domain of a relation R from A to B is the set of first elements of its ordered pairs, the co-domain is the whole set B, and the range is the set of second elements that actually occur, which is always a subset of the co-domain.
For the squares relation above, :
- Domain
- Co-domain
- Range
Worked example. Let and define R on A by . Then
so the domain is , the range is and the co-domain is A.
An everyday example. Relating each post office to its six-digit PIN code — the codes actually used form the range, while all possible six-digit codes form the co-domain.
The substance. Range and co-domain are not the same — 25 is in the co-domain of the squares relation but appears in no pair, so it is not in the range.
For the squares relation above, :
- Domain
- Co-domain
- Range
Worked example. Let and define R on A by . Then
so the domain is , the range is and the co-domain is A.
An everyday example. Relating each post office to its six-digit PIN code — the codes actually used form the range, while all possible six-digit codes form the co-domain.
The substance. Range and co-domain are not the same — 25 is in the co-domain of the squares relation but appears in no pair, so it is not in the range.
What is the difference between a relation and a function, with examples?
A function from A to B is a relation in which every element of A has exactly one image in B — so every function is a relation, but a relation fails to be a function if some element of A has no image or more than one image.
**Conditions for a function :
- Every element of A appears as a first element
- No element of A is the first element of two different pairs
- Two elements of A may share the same image — that is allowed
Worked example.** Let and .
- — a function; 2 and 3 share an image, which is fine
- — not a function; 1 has two images
- — not a function on A; 3 has no image
Counting. With and , there are functions from A to B, but relations.
An everyday example. Each student in a class has exactly one roll number, so 'student to roll number' is a function, while 'student to subjects studied' is only a relation, since one student takes several subjects.
The substance. The vertical line test captures the same idea on a graph — a vertical line meeting a curve twice means one input has two outputs.
**Conditions for a function :
- Every element of A appears as a first element
- No element of A is the first element of two different pairs
- Two elements of A may share the same image — that is allowed
Worked example.** Let and .
- — a function; 2 and 3 share an image, which is fine
- — not a function; 1 has two images
- — not a function on A; 3 has no image
Counting. With and , there are functions from A to B, but relations.
An everyday example. Each student in a class has exactly one roll number, so 'student to roll number' is a function, while 'student to subjects studied' is only a relation, since one student takes several subjects.
The substance. The vertical line test captures the same idea on a graph — a vertical line meeting a curve twice means one input has two outputs.
Exam tip
What earns full marks on relations and Cartesian products?
List the ordered pairs in roster form before naming the domain and range — examiners award the listing step.
-
- Number of relations from A to B:
- Domain = first elements; range = second elements that occur; co-domain = B
The trap. Giving B as the range. The range contains only the images that actually occur, so it can be smaller than the co-domain.
-
- Number of relations from A to B:
- Domain = first elements; range = second elements that occur; co-domain = B
The trap. Giving B as the range. The range contains only the images that actually occur, so it can be smaller than the co-domain.
Did you know
Why are computer databases called relational?
The tables that store railway reservations, bank accounts and examination results are built on the same idea as this chapter.
Each row of such a table is an ordered tuple — a passenger's name, train number, coach and seat — and the whole table is a subset of the Cartesian product of all possible names, trains, coaches and seats. In mathematical language, the table is a relation.
That is why these systems are called relational databases.
Each row of such a table is an ordered tuple — a passenger's name, train number, coach and seat — and the whole table is a subset of the Cartesian product of all possible names, trains, coaches and seats. In mathematical language, the table is a relation.
That is why these systems are called relational databases.
Exam relevance
How are relations and functions tested in JEE Main?
Relations opens Relations and Functions, a recurring JEE Main topic that continues into the Class 12 chapter on equivalence relations and types of functions.
What gets asked. Counting relations and functions between finite sets, the **number of elements of , and deciding whether a given set of pairs is a function.
Question types. Numerical-value counting questions and statement-based questions; Class 12 adds reflexive, symmetric and transitive relations built on these definitions.
The trap that costs marks. Confusing the relations with the functions** from a set of p elements to a set of q elements.
What gets asked. Counting relations and functions between finite sets, the **number of elements of , and deciding whether a given set of pairs is a function.
Question types. Numerical-value counting questions and statement-based questions; Class 12 adds reflexive, symmetric and transitive relations built on these definitions.
The trap that costs marks. Confusing the relations with the functions** from a set of p elements to a set of q elements.
Key takeaways
What must you be able to do from this lesson?
- Cartesian product: all ordered pairs ;
- Relations: subsets of , shown by arrow diagrams, roster form or set-builder form; there are of them
- Domain, co-domain and range: first elements, the whole set B, and the second elements that occur
- Functions: relations in which every element of A has exactly one image
If and , how many functions and how many relations are there from A to B?
- Relations: subsets of , shown by arrow diagrams, roster form or set-builder form; there are of them
- Domain, co-domain and range: first elements, the whole set B, and the second elements that occur
- Functions: relations in which every element of A has exactly one image
If and , how many functions and how many relations are there from A to B?