Skip to main content

Boolean Algebra of Sets

(Content adapted from Critchlow & Eck)

It is clear that set theory is closely related to logic. The intersection and union of sets can be defined in terms of the logical "and" and logical "or" operators. The notation {xP(x)}\{x\mid P(x)\} makes it possible to use predicates to specify sets. And if AA is any set, then the formula xAx\in A defines a one place predicate that is true for an entity xx if and only if xx is a member of AA. So it should not be a surprise that many of the rules of logic have analogs in set theory.

For example, we have already noted that \cup and \cap are commutative operations. This fact can be verified using the rules of logic. Let AA and BB be sets. According to the definition of equality of sets, we can show that AB=BAA\cup B=B\cup A by showing that x((xAB)(xBA))\forall x\,\big((x\in A\cup B)\leftrightarrow(x\in B\cup A)\big). But for any xx,

xABx\in A\cup BxAxB\leftrightarrow x\in A \lor x\in Bdefinition of \cup
xBxA\leftrightarrow x\in B \lor x\in Acommutativity of \lor
xBA\leftrightarrow x\in B \cup Adefinition of \cup

The commutativity of \cap follows in the same way from the definition of \cap in terms of \land and the commutativity of \land, and a similar argument shows that union and intersection are associative operations.

The distributive laws for propositional logic give rise to two similar rules in set theory. Let AA, BB, and CC be any sets. Then

A(BC)=(AB)(AC)A\cup(B\cap C)=(A\cup B)\cap(A\cup C)
A(BC)=(AB)(AC)A\cap(B\cup C)=(A\cap B)\cup(A\cap C)

These rules are called the distributive laws for set theory. To verify the first of these laws, we just have to note that for any xx,

xA(BC)x\in A\cup(B\cap C)(xA)((xB)(xC))\leftrightarrow (x\in A)\lor((x\in B)\land (x\in C))definition of \cup, \cap
((xA)(xB))((xA)(xC))\leftrightarrow ((x\in A)\lor(x\in B)) \land((x \in A)\lor (x\in C))distributivity of \lor
(xAB)(xAC)\leftrightarrow (x\in A\cup B) \land (x \in A\cup C)definition of \cup
x((AB)(AC))\leftrightarrow x\in ((A\cup B)\cap(A\cup C))definition of \cap

The second distributive law for sets follows in exactly the same way.

Complement

While \cup is analogous to \lor and \cap is analogous to \land, we have not yet seen any operation in set theory that is analogous to the logical "not" operator, ¬\lnot. Given a set AA, it is tempting to try to define {x¬(xA)}\{x\mid \lnot(x\in A)\}, the set that contains everything that does not belong to AA. Unfortunately, the rules of set theory do not allow us to define such a set. The notation {xP(x)}\{x\mid P(x)\} can only be used when the domain of discourse of PP is a set, so there must be an underlying set from which the elements that are/are not in AA are chosen, i.e. some underlying set of which AA is a subset. We can get around this problem by restricting the discussion to subsets of some fixed set. This set will be known as the universal set. Keep in mind that the universal set is only universal for some particular discussion. It is simply some set that is large enough to contain all the sets under discussion as subsets. Given a universal set UU and any subset AA of UU, we can define the set {xU¬(xA)}\{x\in U\mid \lnot(x\in A)\}.

Let UU be a given universal set, and let AA be any subset of UU. We define the complement of AA in UU to be the set A\overline{A} that is defined by A={xUx∉A}\overline{A}=\{x\in U\mid x\not\in A\}.

Usually, we will refer to the complement of AA in UU simply as the complement of AA, but you should remember that whenever complements of sets are used, there must be some universal set in the background.

Given the complement operation on sets, we can look for analogs to the rules of logic that involve negation. For example, we know that p¬p=Fp\land\lnot p=\F for any proposition pp. It follows that for any subset AA of UU,

AAA\cap\overline{A}={xU(xA)(xA)}= \{x\in U\mid (x\in A)\land (x\in \overline{A})\}definition of \cap
={xU(xA)(x∉A)}= \{x\in U\mid (x\in A)\land (x\not\in A)\}definition of complement
={xU(xA)¬(xA)}= \{x\in U\mid (x\in A)\land \lnot(x\in A)\}definition of ∉\not\in)
== \emptyset

the last equality following because the proposition (xA)¬(xA)(x\in A)\land \lnot(x\in A) is false for any xx. Similarly, we can show that AA=UA\cup\overline{A}=U and that A=A\overline{\overline{A}}=A (where A\overline{\overline{A}} is the complement of the complement of AA, that is, the set obtained by taking the complement of A\overline{A}.)

The most important laws for working with complements of sets are De Morgan's Laws for sets. These laws, which follow directly from De Morgan's Laws for logic, state that for any subsets AA and BB of a universal set UU,

AB=AB\overline{A\cup B}=\overline{A}\cap\overline{B}
AB=AB\overline{A\cap B}=\overline{A}\cup\overline{B}

For example, we can verify the first of these laws with the calculation

AB\overline{A\cup B}={xUx∉(AB)}= \{x\in U\mid x \not\in (A\cup B)\}definition of complement
={xU¬(xAB)}= \{x\in U\mid \lnot( x\in A\cup B)\}definition of ∉\not\in
={xU¬(xAxB)}= \{x\in U\mid \lnot(x\in A \lor x\in B)\}definition of \cup
={xU(¬(xA))(¬(xB))}= \{x\in U\mid (\lnot(x\in A))\land(\lnot(x\in B))\}De Morgan's Law for logic
={xU(x∉A)(x∉B)}= \{x\in U\mid (x\not\in A) \land (x\not\in B)\}definition of ∉\not\in
={xU(xA)(xB)}= \{x\in U\mid (x\in\overline{A}) \land (x\in\overline{B})\}definition of complement
=AB= \overline{A}\cap\overline{B}definition of \cap

Comparison with Propositional Boolean Algebra

Just as the laws of logic allow us to do algebra with logical formulas, the laws of set theory allow us to do algebra with sets. Because of the close relationship between logic and set theory, their algebras are very similar. The algebra of sets, like the algebra of logic, is Boolean algebra. When George Boole wrote his 1854 book about logic, it was really as much about set theory as logic. In fact, Boole did not make a clear distinction between a predicate and the set of objects for which that predicate is true. His algebraic laws and formulas apply equally to both cases. More exactly, if we consider only subsets of some given universal set UU, then there is a direct correspondence between the basic symbols and operations of propositional logic and certain symbols and operations in set theory, as shown in this table:

LogicSet Theory
T\TUU
F\F\emptyset
pqp\land qABA\cap B
pqp\lor qABA\cup B
¬p\lnot pA\overline{A}

Any valid logical formula or computation involving propositional variables and the symbols T\T, F\F, \land, \lor, and ¬\lnot can be transformed into a valid formula or computation in set theory by replacing the propositions in the formula with subsets of UU and replacing the logical symbols with UU, \emptyset, \cap, \cup, and the complement operator.

Here are some of the laws of Boolean Algebra for sets. AA, BB, and CC are sets. For the laws that involve the complement operator, they are assumed to be subsets of some universal set, UU. For the most part, these laws correspond directly to laws of Boolean Algebra for propositional logic.

Name

Law

Double complement

A=A\overline{\overline{A}}=A

Miscellaneous laws

AA=UA\cup\overline{A}=U

AA=A\cap\overline{A}=\emptyset

A=\emptyset\cap A=\emptyset

A=A\emptyset\cup A=A

Idempotent laws

AA=AA\cap A= A

AA=AA\cup A= A

Commutative laws

AB=BAA\cap B = B\cap A

AB=BAA\cup B=B\cup A

Associative laws

A(BC)=(AB)CA\cap (B\cap C) = (A\cap B)\cap C

A(BC)=(AB)CA\cup (B\cup C) = (A\cup B)\cup C

Distributive laws

A(BC)=(AB)(AC)A\cap(B\cup C) = (A\cap B)\cup (A\cap C)

A(BC)=(AB)(AC)A\cup (B\cap C) = (A\cup B)\cap (A\cup C)

De Morgan's laws

AB=AB\overline{A\cap B} = \overline{A}\cup\overline{B}

AB=AB\overline{A\cup B} = \overline{A}\cap\overline{B}

Precedence

Just as in logic, the operations of set theory can be combined to form complex expressions such as (AC)(BCD)(A\cup C)\cap\overline{(B\cup \overline{C} \cup D)}. Parentheses can always be used in such expressions to specify the order in which the operations are to be performed. In the absence of parentheses, we need precedence rules to determine the order of operation. The precedence rules for the Boolean algebra of sets are carried over directly from the Boolean algebra of propositions. When union and intersection are used together without parentheses, intersection has precedence over union. Furthermore, when several operators of the same type are used without parentheses, then they are evaluated in order from left to right. (Of course, since \cup and \cap are both associative operations, it really doesn't matter whether the order of evaluation is left-to-right or right-to-left.) For example, ABCDA\cup B\cap C \cup D is evaluated as (A((BC))D(A\cup((B\cap C))\cup D. The complement operation is a special case. Since it is denoted by drawing a line over its operand, there is never any ambiguity about which part of a formula it applies to.

Simplification

The laws of set theory can be used to simplify complex expressions involving sets. (As usual, of course, the meaning of "simplification" is partly in the eye of the beholder.) For example, for any sets XX and YY,

(XY)(YX)(X\cup Y)\cap(Y\cup X)=(XY)(XY)=(X\cup Y)\cap(X\cup Y)Commutative Law
=(XY)=(X\cup Y)Idempotent Law

where in the second step, the Idempotent Law, which says that AA=AA\cap A=A, is applied with A=XYA=X\cup Y. For expressions that use the complement operation, it is usually considered to be simpler to apply the operation to an individual set, as in A\overline{A}, rather than to a formula, as in AB\overline{A\cap B}. De Morgan's Laws can always be used to simplify an expression in which the complement operation is applied to a formula. For example,

ABAA\cap \overline{B\cup\overline{A}}=A(BA)= A\cap (\overline{B}\cap\overline{\overline{A}})De Morgan's Law
=A(BA)= A\cap (\overline{B}\cap A)Double Complement
=A(AB)= A\cap (A\cap\overline{B})Commutative Law
=(AA)B)= (A\cap A)\cap \overline{B})Associative Law
=AB= A \cap \overline{B}Idempotent Law

As a final example of the relationship between set theory and logic, consider the set-theoretical expression A(AB)A\cap (A\cup B) and the corresponding compound proposition p(pq)p\land(p\lor q). (These correspond since for any xx, xA(AB)(xA)((xA)(xB))x\in A\cap(A\cup B) \equiv (x\in A)\land ((x\in A)\lor (x\in B)).) You might find it intuitively clear that A(AB)=AA\cap(A\cup B)=A. Formally, this follows from the fact that p(pq)pp\land(p\lor q)\equiv p, which might be less intuitively clear and is surprising difficult to prove algebraically from the laws of logic. However, there is another way to check that a logical equivalence is valid: Make a truth table. Consider a truth table for p(pq)p\land(p\lor q):

ppqqpqp\lor qp(pq)p\land (p\lor q)
falsefalsefalsefalse
falsetruetruefalse
truefalsetruetrue
truetruetruetrue

The fact that the first column and the last column of this table are identical shows that p(pq)pp\land(p\lor q)\equiv p. Taking pp to be the proposition xAx\in A and qq to be the proposition xBx\in B, it follows that the sets AA and A(AB)A\cap (A\cup B) have the same members and therefore are equal.

Exercises

  1. Use the laws of logic to verify the associative laws for union and intersection. That is, show that if AA, BB, and CC are sets, then A(BC)=(AB)CA\cup(B\cup C)= (A\cup B)\cup C and A(BC)=(AB)CA\cap(B\cap C)= (A\cap B)\cap C.

  2. Show that for any sets AA and BB, AABA\subseteq A\cup B and ABAA\cap B\subseteq A.

  3. Recall that the symbol \oplus denotes the logical exclusive or operation. If AA and BB sets, define the set ABA\bigtriangleup B by AB={x(xA)(xB)}A\bigtriangleup B = \{x\mid (x\in A)\oplus (x\in B)\}. Show that AB=(AB)(BA)A\bigtriangleup B = (A\smallsetminus B)\cup(B\smallsetminus A). (ABA\bigtriangleup B is known as the symmetric difference of AA and BB.)

  4. Let AA be a subset of some given universal set UU. Verify that A=A\overline{\overline{A}}=A and that AA=UA\cup\overline{A}=U.

  5. Verify the second of De Morgan's Laws for sets, AB=AB\overline{A\cap B}=\overline{A}\cup\overline{B}. For each step in your verification, state why that step is valid.

  6. The subset operator, \subseteq, is defined in terms of the logical implication operator, \rightarrow. However, \subseteq differs from the \cap and \cup operators in that ABA\cap B and ABA\cup B are sets, while ABA\subseteq B is a statement. So the relationship between \subseteq and \rightarrow isn't quite the same as the relationship between \cup and \lor or between \cap and \land. Nevertheless, \subseteq and \rightarrow do share some similar properties. This problem shows one example.

    • Show that the following three compound propositions are logically equivalent: pqp\rightarrow q, (pq)p(p\land q)\leftrightarrow p, and (pq)q(p\lor q)\leftrightarrow q.

    • Show that for any sets AA and BB, the following three statements are equivalent: ABA\subseteq B, AB=AA\cap B = A, and AB=BA\cup B = B.

  7. De Morgan's Laws apply to subsets of some given universal set UU. Show that for a subset XX of UU, X=UX\overline{X}=U\smallsetminus X. It follows that De Morgan's Laws can be written as U(AB)=(UA)(UB)U\smallsetminus(A\cup B)=(U\smallsetminus A)\cap(U\smallsetminus B) and U(AB)=(UA)(UB)U\smallsetminus(A\cap B)=(U\smallsetminus A)\cup(U\smallsetminus B). Show that these laws hold whether or not AA and BB are subsets of UU. That is, show that for any sets AA, BB, and CC, C(AB)=(CA)(CB)C\smallsetminus(A\cup B)=(C\smallsetminus A)\cap(C\smallsetminus B) and C(AB)=(CA)(CB)C\smallsetminus(A\cap B)=(C\smallsetminus A)\cup(C\smallsetminus B).

  8. Show that A(AB)=AA\cup (A\cap B)= A for any sets AA and BB.

    Answer
    A(AB)A\cup(A\cap B)=(AA)(AB)=(A\cup A)\cap(A\cup B)Distributive Law
    =A(AB)=A\cap(A\cup B)Idempotence
    =(A)(AB)=(A\cup\emptyset)\cap(A\cup B)Identity
    =A(B)=A\cup(\emptyset\cap B)Distributive
    =A=A\cup\emptysetIntersection with empty set
    =A=AIdentity
  9. Let XX and YY be sets. Simplify each of the following expressions. Justify each step in the simplification with one of the rules of set theory.

    • X(YX)X\cup (Y\cup X)
      Answer
      X(YX)X\cup(Y\cup X)=X(XY)=X\cup(X\cup Y)Commutative
      =(XX)Y=(X\cup X)\cup YAssociative
      =XY=X\cup YIdempotent
    • (XY)X(X\cap Y) \cap \overline{X}
      Answer
      (XY)X(X\cap Y) \cap \overline{X}=(YX)X=(Y\cap X)\cap\overline{X}Commutative
      =Y(XX)=Y\cap(X\cap\overline{X})Associative
      =Y=Y\cap\emptysetDisjoint
      ==\emptysetIntersection with empty set
    • (XY)Y(X\cup Y)\cap \overline{Y}
      Answer
      (XY)Y(X\cup Y)\cap \overline{Y}=(XY)(YY)=(X\cap\overline{Y})\cup(Y\cap\overline{Y})Distributive
      =(XY)=(X\cap\overline{Y})\cup\emptysetDisjoint
      =XY=X\cap\overline{Y}Identity
      =XY=X\smallsetminus YDefinition of \smallsetminus
    • (XY)(XY)(X\cup Y) \cup (X\cap Y)
      Answer
      (XY)(XY)(X\cup Y) \cup (X\cap Y)=X(Y(XY))=X\cup(Y\cup(X\cap Y))Associative
      =X(Y(YX))=X\cup(Y\cup(Y\cap X))Commutative
      =XY=X\cup YPrevious exercise (Absorption Law)
  10. Let AA, BB, and CC be sets. Simplify each of the following expressions. In your answer, the complement operator should only be applied to the individual sets AA, BB, and CC.

    • ABC\overline{A\cup B \cup C}
      Answer

      ABC\overline{A}\cap\overline{B}\cap\overline{C}

    • ABC\overline{A\cup B \cap C}
      Answer

      ABC=A(BC)\overline{A}\cap\overline{B\cap C}=\overline{A}\cap(\overline{B}\cup\overline{C}) (note that intersection has precedence over union)

    • AB\overline{\overline{A\cup B}}
      Answer

      ABA\cup B (double complement)

    • BC\overline{B\cap \overline{C}}
      Answer

      BC\overline{B}\cup C

    • ABC\overline{A\cap \overline{B\cap \overline C}}
      Answer

      A(BC)\overline{A}\cup(B\cap\overline{C})

    • AABA\cap \overline{A\cup B}
      Answer

      AAB=B=A\cap\overline{A}\cap\overline{B}=\emptyset\cap\overline{B}=\emptyset