Definition:Set Difference

Definition
The (set) difference between two sets $S$ and $T$ is written $S \setminus T$, and means the set that consists of the elements of $S$ which are not elements of $T$:
 * $x \in S \setminus T \iff x \in S \land x \notin T$

It can also be defined as:
 * $S \setminus T = \left\{{x \in S: x \notin T}\right\}$
 * $S \setminus T = \left\{{x: x \in S \land x \notin T}\right\}$

Illustration by Venn Diagram
The red area in the following Venn diagram illustrates $S \setminus T$:


 * VennDiagramSetDifference.png

Example
For example, if $S = \left\{{1, 2, 3}\right\}$ and $T = \left\{{2, 3, 4}\right\}$, then $S \setminus T = \left\{{1}\right\}$, while $T \setminus S = \left\{{4}\right\}$.

It can immediately be seen that $S \setminus T$ is not commutative, in general (and in fact, that Set Difference is Anticommutative).

Also known as
Some sources refer to $S \setminus T$ as the difference set (as opposed to set difference).

$S \setminus T$ can be voiced:
 * $S$ slash $T$
 * $S$ cut down by $T$.

Another frequently seen notation for $S \setminus T$ is $S - T$. Both notations may be encountered on this website, but $\setminus$ is preferred.

Some authors call $S \setminus T$ the relative difference between $S$ and $T$.

Some authors call $S \setminus T$ the (relative) complement of $T$ in $S$, but the standard definition for the latter concept requires that $T \subseteq S$.

Also see

 * Definition:Symmetric Difference