Set Operations with Venn Diagrams

Category: Logic and Proof   Level: 201

(A ∪ B)' = A' ∩ B'

Union, intersection, difference, and complement each shade a region of a Venn diagram. De Morgan's law says the outside of a union equals the overlap of the two outsides.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Draw the universe and two sets

The rectangle U holds the numbers 1 to 10. Circle A holds 1 to 5 and circle B holds 4 to 7. The overlap holds the numbers in both.

A = {1, 2, 3, 4, 5}, B = {4, 5, 6, 7}

Step 1: Draw the universe and two sets

Step 2: Union: in A or in B

Shade everything inside either circle. The union collects every element of A and every element of B.

A ∪ B = {1, 2, 3, 4, 5, 6, 7}

Step 2: Union: in A or in B

Step 3: Intersection: in A and in B

Shade only the overlap. The intersection keeps the elements that belong to both sets.

A ∩ B = {4, 5}

Step 3: Intersection: in A and in B

Step 4: Difference: in A but not in B

Start with A and remove the part inside B. The difference is the crescent of A outside the overlap.

A - B = {1, 2, 3}

Step 4: Difference: in A but not in B

Step 5: Complement: not in A

Shade everything in U outside circle A. The complement depends on the universe: here it is every number from 1 to 10 that is not in A.

A' = {6, 7, 8, 9, 10}

Step 5: Complement: not in A

Step 6: Complement of the union

Shade what lies outside both circles. Only the numbers in neither set remain.

(A ∪ B)' = {8, 9, 10}

Step 6: Complement of the union

Step 7: De Morgan's law

Stripe the outside of A one way and the outside of B the other way. The crosshatched region is the same region as the outside of the union.

(A ∪ B)' = A' ∩ B' = {8, 9, 10}

Step 7: De Morgan's law

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render set-operations --out /tmp/set-operations

Source: svgmath/diagrams/logic.py