Canonical: https://knowlpedia.com/shared-foundations/set-difference/

# Set difference

The elements of one set that are not in another set.

A **set difference** (or **relative complement**) of sets \(A\) and \(B\) is the set
\[
A\setminus B=\{x : x\in A \text{ and } x\notin B\}.
\]

## Remarks

Set difference can be expressed using [intersection](https://knowlpedia.com/shared-foundations/intersection/) and [complement](https://knowlpedia.com/shared-foundations/complement/) once an ambient universe \(U\) is chosen: if \(B\subseteq U\), then \(A\setminus B = A\cap B^{c}\).

## Examples

- \(\{1,2,3\}\setminus\{2,4\}=\{1,3\}\).
- If \(A\subseteq B\), then \(A\setminus B=\varnothing\) (see [empty set](https://knowlpedia.com/shared-foundations/empty-set/)).
