# Sets Basics

## Membership

A set is made up of elements.

e.g.

$A = \lbrace dog, cat, hamster \rbrace$

$dog \enspace\in\enspace A$

$elephant \enspace\notin\enspace A$

## 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 = \lbrace dog, cat, hamster \rbrace$

$B = \lbrace dog, helicopter, dinosaur \rbrace$

$A \enspace\cap\enspace B = \lbrace dog \rbrace$

## Union

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

$A = \lbrace dog, cat, hamster \rbrace$

$B = \lbrace dog, helicopter, dinosaur \rbrace$

$A \enspace\cup\enspace B = \lbrace dog, cat, hamster, helicopter, dinosaur \rbrace$

## Inclusion-Exclusion formula

$|A \enspace\cup\enspace B| = |A| + |B| - |A \enspace\cap\enspace B|$

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

### Copyright

Unless otherwise noted all content on this site is (c) copyright Julian Elve 2020 onwards, released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International licence.

Sets Basics