In set theory and other branches of mathematics, the complement of a set B relative to a set A, also known as set theoretic difference of A and B, is the set of elements in A but not in B


A\\B in Venn diagram

The complement of B relative to A is standardly written "A\\B". Formally:

x is an element of A\\B if and only if
  • x is an element of A and
x is not an element of B.

Occasionally the complement of B relative to A is denoted by A-B.

For example, {1,2,3}\\{2,3,4} is {1} and {2,3,4}\\{1,2,3} is {4}.

Absolute complement

If a universal set U is defined, then absolute complement (or simply complement) of a subset B of U is just U \\ B and is denoted by B'.

For example, if the universal set is the set of natural numbers, then the complement of the set of odd numbers is the set of even numbers.

If both A and B are subsets of U then A\\B=AB' (the intersection of A and the complement of B).