Unit 1Sets, Relations and Functions
Follows IGNOU MCS-212, Block 2 Unit 1
Sets, relations and functions are the vocabulary of all of computer science. A database table is a relation; a hash map is a function; a type in a programming language is a set of values. In this unit you learn the precise meaning of these three ideas, the operations on them, and the properties that make some relations and functions special. You will also see that the laws of set algebra are the same laws you met for logic and Boolean algebra in Block 1.
In this unit you will learn to
- describe sets in roster and set-builder form, and use subsets, power sets and Venn diagrams;
- perform union, intersection, difference, complement and symmetric difference, and use the laws of set algebra;
- form Cartesian products, and represent relations as sets of pairs, matrices and directed graphs;
- test a relation for the reflexive, symmetric and transitive properties, and recognise equivalence relations;
- define a function, its domain, codomain and range, and decide whether it is one-one, onto or bijective;
- find inverse functions and perform operations on functions, including composition.
Sections in this unit
- 1.1Sets and how to describe themWhat a set is, elements and membership, roster and set-builder forms, the empty set, and finite and infinite sets.7 min
- 1.2Subsets, power sets and Venn diagramsSubsets, proper subsets and equal sets, the power set and why it has 2ⁿ elements, the universal set, and Venn diagrams.10 min
- 1.3Operations on setsUnion, intersection, difference, complement and symmetric difference with Venn diagrams, examples and a C program using bit sets.11 min
- 1.4Laws of set algebra and dualityThe laws of set operations (associative, commutative, identity, complement, distributive, De Morgan), their link to logic, duality and proofs.13 min
- 1.5Cartesian products and relationsOrdered pairs, Cartesian products, relations as subsets of A × B, counting relations, and representing relations by matrices and digraphs.12 min
- 1.6Properties of relations and equivalence relationsReflexive, symmetric and transitive relations, how to test them on pairs, matrices and digraphs, and equivalence relations with their classes.7 min
- 1.7FunctionsFunctions as special relations: definition, domain, codomain and range, examples and non-examples, and important functions like floor and modulus.7 min
- 1.8One-one, onto and inverse functionsInjective (one-one), surjective (onto) and bijective functions, permutations, and how to find the inverse of a bijection.11 min
- 1.9Operations on functions and compositionSum, difference, product and quotient of functions with their domains, equality of functions, composition, and products of permutations.14 min