# Set Algebra & Laws — Set Theory

This is a continuation of my previous post about Set Theory. If you have not read that yet, start there.

There are few rules governing the universe of sets.

### Algebra

#### Intersection

Intersection of two sets is a set that contains elements present in both sets.

`A ∩ B = {x | x ∈ A ∧ x ∈ B}`

#### Union

Union of two sets is a set of elements that are present in at least one set.

`A ∪ B = {x | x ∈ A ∨ x ∈ B}`

#### Set Difference

Difference between two sets is a set of elements that is present in the first set but not in the second.

`A \ B = {x | x ∈ A ∧ x ∉ B}`

#### Symmetric difference

Symmetric difference between two sets is a set of elements that is present only in one set.

`A ⊕ B = (A \ B) ∪ (B \ A)`

#### Complement

Complement of a set is everything that is not found within that set but found within the universe of discourse.

`A^c = X \ A`

Please note that medium.com does not support superscript for letters. Consider that the letter `c` in `A^c` above is superscripted.

### Laws of Sets

#### Absorption

Intersection or union of a set with itself results in the original set.

`A ∩ A = A`

`A ∪ A = A`

#### Commutativity

Changing operands does not change the result of an intersection or an union operation.

`A ∩ B = B ∩ A`

`A ∪ B = B ∪ A`

#### Associativity

Groups do not have a significance when intersecting sets or taking the union of sets

`A ∩ (B ∩ C) = (A ∩ B) ∩ C`

`A ∪ (B ∪ C) = (A ∪ B) ∪ C`

#### Distributivity

Algebraic distributive laws apply when intersecting sets or taking the union of sets

`A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)`

`A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)`

#### De Morgan’s laws

Complement of an intersection or an union is equivalent to the union or intersection of the complements.

`(A ∩ B)^c = A^c ∪ B^c`

`(A ∪ B)^c = A^c ∩ B^c`

#### Duality

Complement of the universe of discourse is the empty set while the complement of the empty set is the universe of discourse.

`U^c = ∅`

`∅^c = U`

#### Identity

Identity of a set is the result of a set union with the empty set or a set intersection with the universe of discourse.

`A ∪ ∅ = A`

`A ∩ X = A`

#### Dominance

The empty set results in a set intersection with an empty set while universe of discourse results in a union of any set with universe of discourse.

`A ∩ ∅ = ∅`

`A ∪ X = X`

#### Complementation

Set has no elements in common with its complement while the union of a set and it’s complement is everything.

`A ∩ A^c = ∅`

`A ∪ A^c = X`

#### Contraposition

• If the complement of `A` is a subset of the complement of `B`, then `B` is a subset of `A`

`A^c ⊆ B^c ≡ B ⊆ A`

• If `A` is a subset of the complement of `B`, then `B` is a subset of the complement of `A`

`A ⊆ B^c ≡ B ⊆ A^c`

• If the complement of `A` is a subset of `B`, then the complement of `B` is a subset of `A`

`A^c ⊆ B ≡ B^c ⊆ A`

Originally published at medium.com on September 14, 2017.