FORMIAX


Mathematical calculators Physical calculators Economic calculators Other calculators
Mathematical calculators Physical calculators Economic calculators Other calculators


 

Sets and Venn diagram

 

Grab a number and move it around the diagram — the membership table and the element counts are recalculated instantly.

Photo
U A B A \ B A ∩ B B \ A
Formula & notes

A ∩ B  ·  A ∪ B  ·  A \ B

|A ∪ B| = |A| + |B| − |A ∩ B|

A ∩ B = intersection — elements belonging to A and to B

A ∪ B = union — elements belonging to A or to B

A \ B = difference — elements of A that are not in B

|A| = cardinality — the number of elements of set A

U = universe — all the elements under consideration

What is it?

A set is a collection of mutually distinguishable elements. For every element we can say unambiguously whether it belongs to the set (x ∈ A) or does not belong to it (x ∉ A). A Venn diagram shows the sets as circles inside a rectangle that stands for the universe U — all the elements under consideration.

The overlap of the circles is the intersection A ∩ B, the whole area of both circles is the union A ∪ B and the part of circle A outside B is the difference A \ B. Since the common elements would be counted twice in the plain sum |A| + |B|, we subtract them once when counting the union — that is the inclusion–exclusion principle.

Calculator
Elementx ∈ Ax ∈ BA ∩ BA ∪ BA \ BB \ A
Elements in A  |A|0
Elements in B  |B|0
Intersection  |A ∩ B|0
Union  |A ∪ B|0
Inclusion–exclusion principle
Interactive graph

Drag the numbers into the circles + add elementreset

U A B
1. Intersection and union
  • Intersection A ∩ B: elements belonging at the same time to A and to B — the overlap of the circles.
  • Union A ∪ B: elements belonging to at least one of the sets; the common ones are counted only once.
  • Disjoint sets: if they share no element, then A ∩ B = ∅.
  • Both operations are commutative: A ∩ B = B ∩ A and A ∪ B = B ∪ A as well.
2. Difference of sets
  • A \ B: elements that are in A but are not in B.
  • It is not commutative: A \ B and B \ A are usually different sets.
  • Decomposition: A ∪ B can be split into three non-overlapping parts — A \ B, A ∩ B and B \ A.
  • If A ⊆ B (A is a subset of B), then A \ B = ∅.
3. Number of elements
  • Cardinality |A| is the number of elements of set A.
  • Inclusion–exclusion principle: |A ∪ B| = |A| + |B| − |A ∩ B|.
  • Why minus: the common elements would be counted twice in the sum |A| + |B|.
  • If the sets are disjoint, the formula simplifies to |A ∪ B| = |A| + |B|.
Worked example
You might be interested

Video
Video coming soon
Practice problems

Solve it step by step — the next step unlocks only after a correct answer. You can type decimals with a dot or a comma.

Frequently asked questions
What is the intersection of sets?
A ∩ B is the set of elements that belong at the same time to A and to B — in a Venn diagram the overlapping part of the circles. If no common element exists, the intersection is the empty set ∅.
What is the union of sets?
A ∪ B is the set of elements that belong to at least one of the sets. It is the whole area of both circles, with the common elements counted only once.
How does A \ B differ from B \ A?
A \ B are the elements of A that are not in B; B \ A conversely the elements of B that are not in A. The difference is not commutative, so the two sets are usually different.
Why is the intersection subtracted in the formula?
When adding |A| + |B| we would count the elements lying in both sets twice. So we subtract them once: |A ∪ B| = |A| + |B| − |A ∩ B|. This is the inclusion–exclusion principle.


Formiax