# Computing - Sets

> Source: https://ollybritton.com/notes/a-level/computing/topics/sets/ · Updated: 2024-08-25 · Tags: computing, regular-languages, school

### 2021-01-07
##### What is a set??
A well-defined collection of objects.

##### What are the two terms for objects in a set??
* Members
* Elements

##### What's the difference between a set and a list??
Sets are unordered.

##### What's the symbol for an empty set??
$$
\varnothing
$$

##### What does $$x \in S$$ mean??
$x$ is a member of the set $S$.

##### What does $$x \notin S$$ mean??
$x$ is not a member of the set $S$.

##### How could you write the set of even natural numbers using set comprehension??
$$
\\{ x | x \in \mathbb{N} \wedge x \,\text{is even} \\}
$$

##### What would the compact form of $$\{ x | x \in \mathbb{N} \wedge $x$ \,\text{is even} \}$$ be??
$$
\\{ x \in \mathbb{N} | x \,\text{is even} \\}
$$

##### What set does $$\{10^n | n \le 1\}$$ describe??
$$
\\{ 10, 100, 1000, 10000 \\}
$$

##### How would you describe the set $\{ 5, 10, 15, ...\}$??
$$
\\{ x | x \in N \wedge x \mod 5 = 0 \\}
$$

##### What does $A \\ B$ mean??
All the members that are in A but not in B.

##### What is the $A \\ B$ operator called??
Difference.

##### What does the Venn diagram for $A \\ B$ look like??
![PHOTO A DIFFERENCE B](paste-c29345fd53005001afc3dfaf703b41569fc833a1.jpg)

##### What does it mean for $A$ to be a subset of $B$??
Every member of $A$ is also a member of $B$.

##### What is the notation for $A$ being a subset of $B$??
$$
A \subseteq B
$$

##### What is the notation for $A$ being a proper subset of $B$??
$$
A \subset B
$$

##### What's the difference between a subset and a proper subset??
A proper subset means $A$ is a subset of $B$ and they are not equal.

##### What is the Cartesian product of two sets $A$ and $B$??
The set of all ordered pairs $(a, b)$ such thta $a \in A$ and $b \in B$.

##### What is the set comprehension notation for the Cartesian product of $A$ and $B$??
$$
A \times B = \\{ (a, b) | a \in A \wedge b \in B \\}
$$

##### What is the notation for the Cartesian product of $A$ and $B$??
$$
A \times B
$$

##### What is the cardinality of a set??
The number of members in the set.

##### What is the notation for the carinality of $A$??
$$
| A |
$$

##### What is a countably infinite set??
A set whose members can be counted by using the infinite set $\mathbb{N}$.

##### What is the formula for the cardinality of the Cartesian product of two sets $A$ and $B$??
$$
|A|\times|B|
$$

---
Olly Britton — https://ollybritton.com. Machine-readable index: https://ollybritton.com/llms.txt
