My Digital Garden

Sets Basics

Sets Basics

Membership

A set is made up of elements.

e.g.

A={dog,cat,hamster}

dogA

elephantA

Cardinality

The cardinality of a set is the number of elements

e.g. |A|=3

Intersection

The elements that are in both sets

e.g.

A={dog,cat,hamster}

B={dog,helicopter,dinosaur}

AB={dog}

Union

All the elements that are in either set
e.g.

A={dog,cat,hamster}

B={dog,helicopter,dinosaur}

AB={dog,cat,hamster,helicopter,dinosaur}

Inclusion-Exclusion formula

|AB|=|A|+|B||AB|

Based on course material by Paul Bendich and Daniel Egger from Data Science Maths Skills