↓ Skip to main content

The Language of Sets

An introduction to Set Theory as the foundation of Discrete Mathematics: definitions, operations (union, intersection, complement), Venn diagrams, the Inclusion-Exclusion Principle and cardinality, with practical examples in Python and SQL.

The articles are listed below, in the order they were written.

Venn Diagrams and Set Operations

Venn Diagrams and Set Operations

·3803 words·18 mins
Union, intersection, difference, and complement are the basic operations on sets, and they show up in SQL as UNION, INTERSECT, and EXCEPT. We see each one in Venn diagrams, along with De Morgan’s laws, distributivity, and the difference between a Venn diagram and an Euler diagram.
Sets in Python: set, frozenset, and Operations

Sets in Python: set, frozenset, and Operations

·2753 words·13 mins
Testing whether an element is in a set takes constant time on average, while in a list the time grows with its size. We will see how set theory becomes Python code: set and frozenset, comprehension, membership and inclusion, union, intersection and difference, hashing, and practical applications.