Sets, functions and relations

Sets and their operations, functions and their types, and relations with equivalence classes and partial orders: the structures that data and programs are built from.

About 5 hours of study

Learning objectives

Lessons

  1. 1

    Sets

    Writing sets, subsets, union, intersection, difference and complement, Venn diagrams, power sets, Cartesian products and counting with inclusion-exclusion.

  2. 2

    Functions

    Domain, codomain and range; one-to-one, onto and bijective functions, checked in Python; composition, inverses, floor and ceiling, and counting functions.

  3. 3

    Relations

    Relations as sets of pairs; reflexive, symmetric, antisymmetric and transitive relations; equivalence relations and their classes; and partial orders.

Module practice

Module quiz

1. How many subsets does a set with 4 elements have?
2. What is the size of the Cartesian product of a 3-element set and a 5-element set?
3. A function is one-to-one when...
4. Which relation on the integers is an equivalence relation?
5. How many onto functions are there from a 3-element set to a 2-element set?
6. What does the transitive closure of a relation add?

‹ Proof and inductionCounting and recurrences ›