Two small things happen on your phone every day. You type a bKash number and exactly one account opens, never two and never none. Then you look at your friend list and find that Rahim is in three of your groups while Mita is in none. In the first case every input has exactly one answer. In the second, an input can have many answers, or no answer at all.
Mathematicians gave both situations a name. The loose connection, any collection of "this goes with that" facts, is a relation. The strict one, where every input has exactly one answer, is a function. A database table is a relation. A hash table, a sorting rule, a graph, the "is a prerequisite of" chart in a polytechnic's syllabus: all of them are relations of one kind or another, which is why this chapter sits under so much of what comes later. And it is a chapter the exams like, because its questions have crisp answers: is this relation an equivalence relation, how many injective functions are there, what is the domain of this formula.
By the end of the chapter you will be able to write a relation as pairs, as an arrow diagram and as a matrix, and chain two relations together. You will test any relation for the four basic properties and count how many relations on a small set have each one. You will repair a relation by taking its closure. You will recognise an equivalence relation and list its classes, and recognise a partial order and draw its Hasse diagram. Then you will move to functions: evaluate them, find the domain and range of a formula, tell injective from surjective from bijective, count functions between small sets, compose two functions and reverse one.
We go in nine parts, from easy to hard: pairs and relations, the four properties, counting relations, closures, equivalence relations, partial orders, functions, the three kinds of function with their counts, and finally composition and inverses.