The (relative) complement of set A in B is in turn a subset of B and is colored blue here.

If and are sets and is a subset of , then the relative complement, also called set- theoretic complement or set- theoretic difference , is the set of precisely those elements which are not contained in. The formal definition of relative complement is
${\ displaystyle A}$${\ displaystyle B}$${\ displaystyle A}$${\ displaystyle B}$${\ displaystyle B}$${\ displaystyle A}$

${\ displaystyle B \ setminus A: = \ left \ {x \ in B \ mid x \ not \ in A \ right \}}$

and you say "B without A". The complement only differs from the normal subtraction of sets in that the subset relationship must exist between the sets under consideration. It is called relative because one can not specify the complement for a set without knowing the context. If, on the other hand, the set is fixed, then instead of “the relative complement of A in B” one can simply name “the complement of A”.
${\ displaystyle A}$${\ displaystyle B}$${\ displaystyle B \ setminus A}$

Examples

${\ displaystyle \ left \ {1,2,3 \ right \} \ setminus \ left \ {2,3 \ right \} = \ left \ {1 \ right \}}$

${\ displaystyle \ left \ {2,3,4 \ right \} \ setminus \ left \ {2,3 \ right \} = \ left \ {4 \ right \}}$

For (real numbers) and (rational numbers), is the set of irrational numbers.${\ displaystyle \ mathbb {R}}$${\ displaystyle \ mathbb {Q}}$${\ displaystyle \ mathbb {R} \ setminus \ mathbb {Q}}$

properties

Below are some properties of relative complements related to the set-theoretic operations union and intersection . Be , and sets, then the following identities hold:
${\ displaystyle A}$${\ displaystyle B}$${\ displaystyle C}$

${\ displaystyle C \ setminus \ left (A \ cap B \ right) = \ left (C \ setminus A \ right) \ cup \ left (C \ setminus B \ right)}$

${\ displaystyle C \ setminus \ left (A \ cup B \ right) = \ left (C \ setminus A \ right) \ cap \ left (C \ setminus B \ right)}$

${\ displaystyle C \ setminus \ left (B \ setminus A \ right) = (A \ cap C) \ cup (C \ setminus B)}$

${\ displaystyle \ left (B \ setminus A \ right) \ cap C = (B \ cap C) \ setminus A = B \ cap (C \ setminus A)}$

${\ displaystyle \ left (B \ setminus A \ right) \ cup C = (B \ cup C) \ setminus \ left (A \ setminus C \ right)}$

${\ displaystyle A \ setminus A = \ emptyset}$

${\ displaystyle A \ setminus \ emptyset = A}$

Absolute complement

definition

The complement of A in U

If a universe is defined, the relative complement of in is also called the absolute complement (or simply complement) of for every set and is noted as (sometimes also as , or also as , or if is fixed), so it is:
${\ displaystyle U}$${\ displaystyle A \ subseteq U}$${\ displaystyle A}$${\ displaystyle U}$${\ displaystyle A}$${\ displaystyle A ^ {\ rm {C}}}$${\ displaystyle A '}$${\ displaystyle {\ bar {A}}}$${\ displaystyle \ complement _ {U} A}$${\ displaystyle \ complement A}$${\ displaystyle U}$

${\ displaystyle A ^ {\ rm {C}} = U \ setminus A}$

example

For example, if the universe is the set of natural numbers, then the (absolute) complement of the set of even numbers is the set of odd numbers.

properties

Below are some properties of absolute complements related to the set-theoretic operations union and intersection . Be and subsets of the universe , then the following identities apply:
${\ displaystyle A}$${\ displaystyle B}$${\ displaystyle U}$

Relationships between relative and absolute complements:

${\ displaystyle A \ setminus B = A \ cap B ^ {\ rm {C}}}$

${\ displaystyle (A \ setminus B) ^ {\ rm {C}} = A ^ {\ rm {C}} \ cup B}$

The first two complementary laws show that if is a true nonempty subset of, then is a partition of .
${\ displaystyle A}$${\ displaystyle U}$${\ displaystyle \ {A, A ^ {\ rm {C}} \}}$${\ displaystyle U}$

Oliver Deiser: Introduction to set theory. Georg Cantor's set theory and its axiomatization by Ernst Zermelo. 2nd, improved and enlarged edition. Springer, Berlin et al. 2004, ISBN 3-540-20401-6 .