Part 1 · Chapter 01

Sets, Relations and Functions

The grammar of all higher mathematics — collections, the links between them, and the machines that turn one into another

Fundamentals of Mathematics Prof. Mithun Mondal Reading time ≈ 35 min
i What you'll learn
  • Why a set — a well-defined collection of distinct objects — is the single idea every later topic is written in.
  • How to name, classify and combine sets, and prove statements with Venn diagrams and De Morgan's laws.
  • Counting overlapping groups with the inclusion–exclusion principle.
  • How a relation links two sets, and what makes one an equivalence relation that slices a set into classes.
  • What a function really is, how to find its \(\text{domain}\) and \(\text{range}\), and how to tell one-one from onto from bijective.
  • The standard library of functions, plus composition, inverses, and even / odd / periodic behaviour.
Section 1-1

The Language of Sets

If physics begins with measurement, mathematics begins with the set. Numbers, points, lines, matrices, functions, even probabilities — every object you will ever meet in this book is, underneath, a set or a collection built from sets. Learn this language well and the rest of mathematics reads like sentences instead of riddles.

The idea is due to Georg Cantor in the 1870s. A set is simply a well-defined collection of distinct objects. The objects are its elements (or members). Two words carry all the weight:

Well-defined

For any object, you can decide without argument whether it belongs. "All prime numbers below 20" is a set; "all large numbers" is not — there is no sharp test for membership.

Distinct

An element is either in or out — it is never counted twice. So \(\{1,2,2,3\}\) is just the set \(\{1,2,3\}\).

Unordered

Order does not matter inside a set: \(\{a,b,c\}=\{c,a,b\}\). (Order will matter later, for ordered pairs.)

We write membership with the symbol \(\in\) ("belongs to") and its negation \(\notin\). Sets are named with capital letters, elements with small letters:

Membership
\[ 3 \in \{1,2,3,4\} \qquad\qquad 7 \notin \{1,2,3,4\} \]
Read these as "3 is an element of the set" and "7 is not an element of the set."
Section 1-2

Describing a Set

There are two standard ways to pin down exactly which elements a set contains.

{ } Roster (tabular) form

List every element between braces, separated by commas: \(A=\{2,3,5,7\}\). For an unmistakable pattern you may use dots: the natural numbers are \(\mathbb{N}=\{1,2,3,\dots\}\).

| Set-builder form

State the rule for membership: \(A=\{x : x \text{ is prime and } x<10\}\). Read the bar "|" or colon ":" as "such that." This is the form competitive exams love.

The number systems, once and for all. These named sets reappear everywhere: natural numbers \(\mathbb{N}\), whole numbers \(\mathbb{W}\), integers \(\mathbb{Z}\), rationals \(\mathbb{Q}=\{p/q : p,q\in\mathbb{Z},\, q\neq0\}\), reals \(\mathbb{R}\), and complex numbers \(\mathbb{C}\). They nest neatly: \(\mathbb{N}\subset\mathbb{W}\subset\mathbb{Z}\subset\mathbb{Q}\subset\mathbb{R}\subset\mathbb{C}\).
Section 1-3

Types of Sets

Table 1-1 · A field guide to sets
NameMeaningExample
Empty / null setContains no element; written \(\varnothing\) or \(\{\,\}\)\(\{x:x^2=-1,\,x\in\mathbb{R}\}\)
SingletonExactly one element\(\{0\}\)
Finite setA countable, ending list of elements\(\{a,e,i,o,u\}\)
Infinite setElements never run out\(\mathbb{Z},\ \mathbb{R}\)
Equal setsExactly the same elements: \(A=B\)\(\{1,2\}=\{2,1\}\)
Equivalent setsSame number of elements (same cardinality)\(\{a,b\}\sim\{9,10\}\)

The number of elements in a finite set \(A\) is its cardinal number, written \(n(A)\) or \(|A|\). Note carefully: equal sets are always equivalent, but equivalent sets need not be equal.

! The empty set is one of a kind

There is only one empty set. And mind the difference: \(\varnothing\) contains nothing, but \(\{\varnothing\}\) is a singleton — a box containing one (empty) box. So \(n(\varnothing)=0\) while \(n(\{\varnothing\})=1\).

Section 1-4

Subsets, Power Sets & Intervals

If every element of \(A\) is also in \(B\), we call \(A\) a subset of \(B\) and write \(A\subseteq B\). If in addition \(B\) has something \(A\) lacks, \(A\) is a proper subset, \(A\subset B\). Two facts hold for every set:

Two universal truths
\[ A \subseteq A \qquad\qquad \varnothing \subseteq A \]
Every set is a subset of itself, and the empty set hides inside every set. Also: \(A=B \iff A\subseteq B \text{ and } B\subseteq A\) — the workhorse for proving two sets equal.

Collect all the subsets of \(A\) into one set and you get the power set \(P(A)\). If \(n(A)=n\), then:

🔢
Counting subsets
A set of \(n\) elements has \(2^{n}\) subsets, so \(n\big(P(A)\big)=2^{n}\).

Of these, \(2^{n}-1\) are proper subsets, and \(2^{n}-2\) are non-empty proper subsets. Why \(2^n\)? Each element independently chooses "in or out" — two choices, \(n\) times.

In any given discussion, all sets are subsets of one big universal set \(U\). For real analysis, the most useful subsets of \(\mathbb{R}\) are intervals — continuous stretches of the number line. A filled dot (closed, \([\,]\)) includes the endpoint; a hollow dot (open, \((\,)\)) excludes it.

a b [a, b] a b (a, b)
Closed interval (endpoints included) vs. open interval (endpoints excluded)
Table 1-2 · Intervals of the real line
NotationSet-builderEndpoints
\([a,b]\)\(\{x:a\le x\le b\}\)both included
\((a,b)\)\(\{x:a< x< b\}\)both excluded
\([a,b)\)\(\{x:a\le x< b\}\)left only
\((a,b]\)\(\{x:a< x\le b\}\)right only
\((a,\infty)\)\(\{x:x> a\}\)\(\infty\) never closed
Section 1-5

Set Operations & Venn Diagrams

A Venn diagram draws the universal set as a rectangle and each set as a region inside it. Shading the answer turns an abstract set identity into a picture you can simply read off.

U A B
A ∪ B — everything in A or B
U A B
A ∩ B — the overlap, in A and B
U A B
A − B — in A but not in B
Table 1-3 · The five operations
OperationSymbolSet-builder definition
Union\(A\cup B\)\(\{x: x\in A \text{ or } x\in B\}\)
Intersection\(A\cap B\)\(\{x: x\in A \text{ and } x\in B\}\)
Difference\(A-B\)\(\{x: x\in A \text{ and } x\notin B\}\)
Complement\(A'\) or \(A^{c}\)\(\{x\in U: x\notin A\}=U-A\)
Symmetric difference\(A\,\triangle\,B\)\((A-B)\cup(B-A)\)
Disjoint sets share nothing: \(A\cap B=\varnothing\). Their two circles never touch. Symmetric difference is the "exclusive or" — in one set or the other, but not both.
Section 1-6

The Algebra of Sets

Set operations obey laws that mirror ordinary algebra — with one famous twist. Memorise these; many JEE shortcuts are just one identity applied cleverly.

Table 1-4 · Laws of set algebra
LawStatement
Commutative\(A\cup B=B\cup A,\quad A\cap B=B\cap A\)
Associative\((A\cup B)\cup C=A\cup(B\cup C)\)
Distributive\(A\cap(B\cup C)=(A\cap B)\cup(A\cap C)\)
Identity\(A\cup\varnothing=A,\quad A\cap U=A\)
Idempotent\(A\cup A=A,\quad A\cap A=A\)
Complement\(A\cup A'=U,\quad A\cap A'=\varnothing,\quad (A')'=A\)
⚖️
De Morgan's Laws
\((A\cup B)' = A' \cap B' \qquad\text{and}\qquad (A\cap B)' = A' \cup B'\)

The complement of a union is the intersection of complements, and vice-versa. In words: "not (A or B)" is "not A and not B." These are the most-used identities in the whole chapter.

Section 1-7

Counting: The Inclusion–Exclusion Principle

How many people read at least one of two newspapers? You cannot just add — you would count the overlap twice. So you add, then subtract the double-counted middle. That single idea, scaled up, is the inclusion–exclusion principle.

Two sets
\[ n(A\cup B)=n(A)+n(B)-n(A\cap B) \]
For three disjoint pieces it specialises nicely; for overlapping sets the correction term is essential.
Three sets
\[ n(A\cup B\cup C)=n(A)+n(B)+n(C)-n(A\cap B)-n(B\cap C)-n(C\cap A)+n(A\cap B\cap C) \]
Add the singles, subtract the pairs, add back the triple — alternating signs.
! "Exactly" vs "at least"

Problems often ask for those in exactly one region. Sketch the three-circle Venn, place the centre value first, work outward, and label all seven regions. Then read off whatever the question wants — "exactly two," "none," "at least one."

Section 1-8

Cartesian Products & Relations

Inside a set, order is irrelevant. But to describe pairings — a point \((x,y)\), a fixture between two teams — we need order to matter. An ordered pair \((a,b)\) has a first and a second slot:

Equality of ordered pairs
\[ (a,b)=(c,d) \iff a=c \text{ and } b=d \]
So \((1,2)\neq(2,1)\) — unlike sets, where \(\{1,2\}=\{2,1\}\).

The Cartesian product \(A\times B\) is the set of all ordered pairs with first entry from \(A\) and second from \(B\):

Cartesian product
\[ A\times B=\{(a,b): a\in A,\ b\in B\} \qquad\Longrightarrow\qquad n(A\times B)=n(A)\cdot n(B) \]
The plane \(\mathbb{R}\times\mathbb{R}=\mathbb{R}^2\) is the most famous Cartesian product of all.

A relation \(R\) from \(A\) to \(B\) is nothing more than a subset of \(A\times B\) — a chosen collection of the pairs that "belong together." If \((a,b)\in R\) we write \(a\,R\,b\).

  • The domain is the set of all first entries that actually appear.
  • The range is the set of all second entries that actually appear.
  • The codomain is the whole "target" set \(B\) (the range may be smaller).
🧮
How many relations?
If \(n(A)=m\) and \(n(B)=p\), there are \(2^{mp}\) relations from \(A\) to \(B\).

Because \(A\times B\) has \(mp\) pairs, and a relation is any subset of them — and a set of \(mp\) elements has \(2^{mp}\) subsets.

Section 1-9

Types of Relations on a Set

When a relation runs from a set \(A\) to itself, three properties decide its character. Test each one with the question in the right-hand column.

Table 1-5 · The three defining properties
PropertyCondition for all \(a,b,c\in A\)Ask yourself
Reflexive\(a\,R\,a\)Is every element related to itself?
Symmetric\(a\,R\,b \Rightarrow b\,R\,a\)Does the link work both ways?
Transitive\(a\,R\,b,\ b\,R\,c \Rightarrow a\,R\,c\)Does it chain through?
🟰
Equivalence relation
A relation that is reflexive, symmetric AND transitive is an equivalence relation.

Such a relation carves \(A\) into non-overlapping equivalence classes — a partition. "Has the same remainder mod 5," "is parallel to," and "is congruent to" are all equivalence relations.

Three special relations on \(A\): the empty relation \(R=\varnothing\) (nothing related), the universal relation \(R=A\times A\) (everything related), and the identity relation \(\{(a,a):a\in A\}\) (each element related only to itself). For a set of \(n\) elements there are \(2^{n^2}\) relations in all, of which \(2^{n(n-1)}\) are reflexive and \(2^{n(n+1)/2}\) are symmetric.
Section 1-10

Functions: The Big Idea

A function is a special relation — a reliable machine. Feed it an input and it returns exactly one output, every time, with no input left unprocessed. Formally, a function \(f:A\to B\) assigns to each \(a\in A\) one and only one \(b=f(a)\in B\).

Two rules separate a function from a mere relation: (1) every element of the domain must be used, and (2) none may map to two different outputs. The arrow diagrams make the distinction vivid:

A B
✓ Function — each input fires once
A B
✗ Not a function — top input maps to two outputs
The vertical line test

For a graph in the \(xy\)-plane: if any vertical line meets the curve more than once, it is not a function — that \(x\) would have two outputs. A circle fails; a parabola \(y=x^2\) passes.

Section 1-11

Classifying Functions

Two independent questions classify every function \(f:A\to B\). Do different inputs always give different outputs? (one-one). Does every target value get hit? (onto).

One-one (injective): distinct in → distinct out, but one target unused
Onto (surjective): every target hit, but two inputs share one
Bijective: one-one and onto — a perfect pairing
Table 1-6 · The four categories
TypePlain EnglishTest
One-one (injective)No two inputs share an output\(f(x_1)=f(x_2)\Rightarrow x_1=x_2\)
Many-oneSome output is sharedfails the above
Onto (surjective)Range = codomainevery \(b\in B\) has a pre-image
BijectiveOne-one and onto togetherperfectly invertible
📊
Counting functions
From a set of \(m\) elements to a set of \(n\): there are \(n^{m}\) functions in total.

Of these, the number that are one-one (needs \(m\le n\)) is \({}^{n}P_{m}=\dfrac{n!}{(n-m)!}\). When \(m=n\), one-one, onto and bijective all coincide, and there are exactly \(n!\) of them. Use the horizontal line test on a graph to spot one-one functions.

Section 1-12

The Standard Function Library

A handful of real functions appear again and again. Knowing each one's domain and range by heart is half the battle in calculus.

Table 1-7 · Standard real functions
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\(\operatorname{sgn}(x)=\tfrac{x}{|x|},\,x\neq0\)\(\mathbb{R}\)\(\{-1,0,1\}\)
Greatest integer\(f(x)=\lfloor x\rfloor\)\(\mathbb{R}\)\(\mathbb{Z}\)
Fractional part\(\{x\}=x-\lfloor x\rfloor\)\(\mathbb{R}\)\([0,1)\)
Exponential\(f(x)=a^{x},\,a>0,a\neq1\)\(\mathbb{R}\)\((0,\infty)\)
Logarithm\(f(x)=\log_a x\)\((0,\infty)\)\(\mathbb{R}\)
⌊⌋ Mind the floor on negatives

The greatest-integer (floor) function rounds down, toward \(-\infty\). So \(\lfloor 2.3\rfloor=2\) but \(\lfloor -2.3\rfloor=-3\), not \(-2\). This single sign trip-up wrecks more exam answers than almost anything else in the chapter.

Section 1-13

Algebra, Composition & Inverse

Where two functions share a domain, you can add, subtract, multiply and divide them point-by-point: \((f+g)(x)=f(x)+g(x)\), and so on — with \((f/g)(x)\) defined only where \(g(x)\neq0\).

More powerful is composition: feed the output of one machine straight into the next. \((g\circ f)(x)=g\big(f(x)\big)\) — apply \(f\) first, then \(g\).

Properties of composition
\[ (h\circ g)\circ f = h\circ(g\circ f) \qquad\text{but in general}\qquad g\circ f \neq f\circ g \]
Composition is associative but not commutative — order is everything.

A function can be "undone" only if it loses no information — that is, only if it is a bijection. Its undoing is the inverse \(f^{-1}\):

🔁
Inverse functions
\(f\) is invertible \(\iff\) \(f\) is bijective, and then \(f^{-1}\big(f(x)\big)=x\).

Useful identities: \((f^{-1})^{-1}=f\) and \((g\circ f)^{-1}=f^{-1}\circ g^{-1}\) (socks-and-shoes: undo in reverse order). Graphically, \(y=f^{-1}(x)\) is the mirror image of \(y=f(x)\) across the line \(y=x\).

Section 1-14

Even, Odd & Periodic Functions

Symmetry gives a function a personality you can exploit in integration, graphing and series.

Even

\(f(-x)=f(x)\). The graph is mirror-symmetric about the \(y\)-axis. Examples: \(x^2,\ \cos x,\ |x|\).

Odd

\(f(-x)=-f(x)\). The graph has half-turn symmetry about the origin. Examples: \(x^3,\ \sin x,\ \tan x\).

Periodic

\(f(x+T)=f(x)\) for some smallest \(T>0\), the fundamental period. \(\sin x\) has period \(2\pi\), \(\{x\}\) has period \(1\).

Every function splits into even + odd
\[ f(x)=\underbrace{\tfrac{1}{2}\big[f(x)+f(-x)\big]}_{\text{even part}}+\underbrace{\tfrac{1}{2}\big[f(x)-f(-x)\big]}_{\text{odd part}} \]
For instance \(e^{x}=\cosh x+\sinh x\) — its even and odd halves.
Worked Examples

Putting It to Work

1 Inclusion–exclusion: a subject survey

Problem. Among 100 students, 40 study Mathematics, 35 Physics and 30 Chemistry; 15 take Maths and Physics, 10 Maths and Chemistry, 12 Physics and Chemistry, and 5 take all three. How many study (a) at least one subject, (b) none, (c) exactly one?

Solution. Apply the three-set formula for "at least one":

At least one
\[ n(M\cup P\cup C)=40+35+30-15-10-12+5=73 \]

(b) None: \(100-73=27\). (c) For exactly one, subtract the shared regions. Exactly-one totals \((40+35+30)-2(15+10+12)+3(5)=105-74+15=46\) students.

2 Proving an equivalence relation

Problem. On \(\mathbb{Z}\) define \(a\,R\,b \iff (a-b)\text{ is divisible by }5\). Show \(R\) is an equivalence relation and describe its classes.

Solution.

  • Reflexive: \(a-a=0=5\cdot0\), divisible by 5. ✓
  • Symmetric: if \(a-b=5k\) then \(b-a=5(-k)\). ✓
  • Transitive: if \(a-b=5k\) and \(b-c=5m\), then \(a-c=5(k+m)\). ✓

So \(R\) is an equivalence relation. It partitions \(\mathbb{Z}\) into five classes by remainder: \([0],[1],[2],[3],[4]\) — the residue classes modulo 5.

3 Domain and range from the rule

Problem. Find the domain and range of \(f(x)=\sqrt{9-x^{2}}\).

Solution. The square root needs a non-negative inside, so \(9-x^{2}\ge0 \Rightarrow x^{2}\le9 \Rightarrow -3\le x\le3\). Hence the domain is \([-3,3]\). As \(x\) sweeps this interval, \(9-x^2\) runs from 0 (at the ends) up to 9 (at \(x=0\)), so \(f\) runs from 0 to 3. The range is \([0,3]\).

4 Composition and inverse

Problem. Let \(f:\mathbb{R}\to\mathbb{R}\), \(f(x)=2x+3\) and \(g(x)=x^{2}\). Find \((f\circ g)(x)\) and \((g\circ f)(x)\), show \(f\) is bijective, and find \(f^{-1}\).

Solution. \((f\circ g)(x)=f(x^2)=2x^2+3\), while \((g\circ f)(x)=(2x+3)^2\) — clearly different, confirming non-commutativity. For \(f\): it is one-one (slope \(2\neq0\)) and onto \(\mathbb{R}\), so bijective. Solve \(y=2x+3\) for \(x\):

Inverse
\[ x=\frac{y-3}{2} \quad\Longrightarrow\quad f^{-1}(x)=\frac{x-3}{2} \]
5 Even, odd, or neither?

Problem. Classify \(f(x)=x^{3}-x\) and decompose \(g(x)=x^2+2x\) into even and odd parts.

Solution. \(f(-x)=(-x)^3-(-x)=-x^3+x=-f(x)\), so \(f\) is odd. For \(g\), the even part is \(\tfrac12[g(x)+g(-x)]=x^2\) and the odd part is \(\tfrac12[g(x)-g(-x)]=2x\) — exactly the two terms, as expected.

Review

Chapter Summary

Sets

A well-defined collection of distinct, unordered objects. Describe by roster or set-builder; classify as empty, finite, infinite, equal or equivalent.

Subsets & operations

\(2^n\) subsets; power set \(P(A)\). Combine sets with \(\cup,\cap,-,'\) and read identities off Venn diagrams.

Algebra & counting

De Morgan's laws and distribution; \(n(A\cup B)=n(A)+n(B)-n(A\cap B)\) with the three-set extension.

Relations

A subset of \(A\times B\); \(2^{mp}\) in all. Reflexive + symmetric + transitive = equivalence, which partitions the set.

Functions

Each input one output. Classify as one-one / onto / bijective; \(n^m\) functions in total; know each standard function's domain and range.

Composition & inverse

\((g\circ f)(x)=g(f(x))\), associative but not commutative. Invertible \(\iff\) bijective; even/odd/periodic capture symmetry.

Practice

Problems

Work these with set-builder notation, Venn diagrams and careful domain checks. Difficulty rises down the list.

  1. Write \(A=\{x\in\mathbb{Z}: x^2<20\}\) in roster form, and write \(\{2,4,6,8,10\}\) in set-builder form.
  2. List every subset of \(\{a,b,c\}\). How many subsets does a 6-element set have, and how many of those are non-empty proper subsets?
  3. Given \(U=\{1,\dots,10\}\), \(A=\{1,2,3,4,5\}\), \(B=\{4,5,6,7\}\), find \(A\cup B,\ A\cap B,\ A-B,\ A'\), and verify De Morgan's law \((A\cup B)'=A'\cap B'\).
  4. In a town, 65% read newspaper X, 40% read Y, and 25% read both. What percentage read at least one? What percentage read neither?
  5. If \(n(A)=3\) and \(n(B)=2\), find \(n(A\times B)\) and the number of relations from \(A\) to \(B\).
  6. On the set \(\{1,2,3\}\), decide whether \(R=\{(1,1),(2,2),(3,3),(1,2),(2,1)\}\) is reflexive, symmetric and/or transitive.
  7. Show that "is parallel to" on the set of lines in a plane is an equivalence relation, and describe an equivalence class.
  8. Use the vertical line test to decide which of \(x^2+y^2=4\) and \(y=x^2+1\) defines \(y\) as a function of \(x\).
  9. Find the domain of \(f(x)=\dfrac{1}{\sqrt{x-2}}+\sqrt{5-x}\).
  10. Find the range of \(f(x)=\dfrac{x^2}{1+x^2}\).
  11. For \(f(x)=3x-2\) and \(g(x)=x^2+1\), compute \((g\circ f)(x)\) and \(f^{-1}(x)\).
  12. Determine whether \(f(x)=\dfrac{e^x-e^{-x}}{e^x+e^{-x}}\) is even, odd, or neither, and state its range.
Tip: for "is it a function / one-one / onto?" questions, always state the domain and codomain first — the same rule \(f(x)=x^2\) is many-one on \(\mathbb{R}\) but one-one on \([0,\infty)\). The set you choose decides the answer.