Playground

Set Operations

Type two sets and explore union, intersection, difference, powerset, and Cartesian product.

Input
A = {1, 2, 3, 4}
B = {3, 4, 5, 6}
Relations
A ⊆ B: noB ⊆ A: noDisjoint: noA = B: no
Venn diagram
AB125634
Only-A: {1, 2} · Only-B: {5, 6} · A∩B: {3, 4}
Operations
Union (A ∪ B)AcupBA \\cup B
{1, 2, 3, 4, 5, 6}
Intersection (A ∩ B)AcapBA \\cap B
{3, 4}
Difference (A \\ B)AsetminusBA \\setminus B
{1, 2}
Symmetric difference (A △ B)AtriangleBA \\triangle B
{1, 2, 5, 6}
Powerset P(A) — 16 subsets
P(A)={SSA}\mathcal{P}(A) = \{S \mid S \subseteq A\}
{}{1}{2}{1, 2}{3}{1, 3}{2, 3}{1, 2, 3}{4}{1, 4}{2, 4}{1, 2, 4}{3, 4}{1, 3, 4}{2, 3, 4}{1, 2, 3, 4}
Cartesian product A × B — 16 pairs
A×B={(a,b)aA,bB}A \times B = \{(a,b) \mid a \in A, b \in B\}
(1, 3)(1, 4)(1, 5)(1, 6)(2, 3)(2, 4)(2, 5)(2, 6)(3, 3)(3, 4)(3, 5)(3, 6)(4, 3)(4, 4)(4, 5)(4, 6)