Skip to main content

Relations

Tuples

The notation (a,b)(a, b) is an ordered pair. And the order matters.

Paris:

  • (a,b)(b,a)(a, b) \not = (b, a)
  • (a,a)(a)(a, a) \not = (a) - repetition is allowed.
  • (cat, dog)
  • ("Dan", 19)

Cartesian Product

Given sets AA and BB we define the Cartesian Product to be the set

A×B={(a,b):aA, bB}A \times B = \{(a,b) : a \in A,\ b \in B\}

The size of A×BA \times B is given by A×B=A×B|A \times B| = |A| \times |B|

Live Editor
Result
Loading...

More Cartesian Products

More generally we have:

  • A1××An={(a1,a2,an):a1A1,anAn}A_1 \times \dots \times A_n = \{(a_1, a_2, \dots a_n) : a_1 \in A_1, \dots a_n \in A_n \}
  • An=A×A×AA^n = A \times A \times A (n copies of AA) - e.g. R2\mathbb{R}^2
  • The size A×B×C=ABC|A \times B \times C |= |A| \cdot |B| \cdot |C|

Some Examples

  • R2\mathbb{R}^2 describes points on a 2-dimensional plane.
  • {0,1}n\{0, 1\}^n is the set of bit strings of length nn.
  • {0,,1919}×{0,,1079}\{0, \dots, 1919\} \times \{0,\dots, 1079\} encodes (x,y) coordinates on a 1080p screen.

Relations

Let AA and BB be sets. A binary relation from AA to BB is a subset of A×BA \times B.

A relation over AA is a subset of A×AA \times A.

If RR is a binary relation then we write aRbaRb to mean (a,b)R(a,b) \in R. So a<ba < b is shorthand for (a,b)<(a,b) \in <.

Properties of Relations

Here are some special properties that a binary relation can have:

  • symmetric
  • reflexive
  • transitive
  • anti-symmetric
  • irreflexive

properties of relations

Symmetric

We say a binary relation is symmetric if

(a,b)R    (b,a)R(a,b) \in R \implies (b,a) \in R

That is whenever we have (a,b) we also have (b,a)

Examples
  • ==
  • ab (mod n)a \equiv b \ (\text{mod}\ n)
  • ,A×A\empty, A \times A

Anti-Symmetric

A relation RR on a set AA is anti-symmetric if a,bA\forall a,b \in A if (a,b)R(a,b) \in R and (b,a)R(b,a) \in R, then a=ba=b.

ab ((a,b)R(b,a)R    a=b)\forall a \forall b\ ((a,b) \in R \land (b,a) \in R \implies a=b)
Examples
  • R1={(a,b)A×A:a=b}R_1 = \{(a,b) \in A \times A : a=b \} - e.g., a=2, b=2a=2 ,\ b=2
  • R2={(a,b)A×A:ab}R_2 = \{(a,b) \in A \times A : a \leq b \} - e.g., a=2, b=2a=2, \ b=2
  • R3={(a,b)A×A:a>b}R_3 = \{(a,b) \in A \times A : a > b \} - cannot find any pair that satisfies the condition. So \implies will always return True.

Not anti-symmetric:

  • R4={(a,b)A×A:a+b3}R_4 = \{(a,b) \in A \times A : a + b \leq 3 \}

a=1, b=2a=1, \ b=2

(1,2)R(2,1)R    a=b(1,2) \in R \land (2,1) \in R \implies a = b This returns False, so R4R_4 is not anti-symmetric.

Examples
  • <,><, >
  • ,\leq, \geq
  • ,\subseteq, \sub

Reflexive

A binary relation is reflexive iff (a,a)R(a,a) \in R for every aAa \in A

Examples
  • ,\leq, \geq
  • ==
  • \subseteq
  • ab (mod n)a \equiv b \ (\text{mod}\ n)

Irreflexive

A binary relation R=A×AR = A \times A is irreflexive if

aA (a,a)∉R\forall a \in A \ (a,a) \not \in R
Examples
  • <,><, >
  • \sub
  • \not =

Transitive

A relation RR on a set AA is transitive if a,b,cA\forall a,b,c \in A

(a,b)R(b,c)R    (a,c)R(a,b) \in R \land (b,c) \in R \implies (a,c) \in R
Examples
  • R1={(a,b):a=b}R_1 = \{(a,b) : a=b \}
    • let a=2, b=2, c=2a=2,\ b=2, \ c=2
    • (2,2)(2,2)    (2,2)R(2,2)(2,2) \implies (2,2) \in R
  • R2={(a,b):ab}R_2 = \{(a,b) : a \leq b \}
    • let a=2, b=5, c=8a=2,\ b=5, \ c=8
    • (2,5)(5,8)    (2,8)R(2,5)(5,8) \implies (2,8) \in R
  • R3={(a,b):a>b}R_3 = \{(a,b) : a > b \}
    • let a=3, b=2, c=1a=3,\ b=2, \ c=1
    • (3,2)(2,1)    (3,1)R(3,2)(2,1) \implies (3,1) \in R
  • R4={(a,b):a+b3}R_4 = \{(a,b) : a + b \leq 3\}
    • let a=3, b=0, c=2a=3,\ b=0, \ c=2
    • (3,0)(0,2)    (3,2)(3,0)(0,2) \implies (3,2)
tip

Find a counter example where it is not true.

Examples
  • ,\leq, \geq
  • <,><, >
  • ==
  • ,\subseteq, \sub
  • ab (mod n)a \equiv b \ (\text{mod}\ n)

Example

Find whether the following relation is reflexive, symmetric, anti-symmetric or transitive on S={1,2,3}S = \{1,2,3\}

R={(1,1),(1,2),(2,1),(2,2),(3,3)}R = \{(1,1), (1,2), (2,1),(2,2),(3,3)\}
  • ✅reflexive. aS (a,a)R\forall a \in S \ (a,a) \in R
    • (1,1),(2,2),(3,3)R(1,1), (2,2), (3,3) \in R
  • ✅symmetric. (a,b)R,(b,a)R\forall (a,b) \in R, (b,a) \in R
  • ❌anti-symmetric. (a,b)R(b,a)R    a=b(a,b) \in R \land (b,a) \in R \implies a=b
    • (1,2)(2,1)(1,2)(2,1) but 121 \not = 2
  • ✅transitive. (a,b)(b,c)R\forall (a,b)(b,c) \in R, (a,c)R(a,c) \in R
    • (1,1)(1,2)R(1,1)(1,2) \in R, (1,2)R(1,2) \in R
    • (1,2)(2,1)R(1,2)(2,1) \in R, (1,1)R(1,1) \in R

Equivalence Relation

An equivalence relation is a binary relation that is:

  • symmetric
  • reflexive
  • transitive
Examples
  • ==
  • ab (mod n)a \equiv b \ (\text{mod}\ n)
  • A×AA \times A
Example

Let RR be the relation on the set of real numbers such that a R ba \ R\ b iff aba-b is an integer. Is this an equivalence relation?

R={(a,b):abZ}R = \{(a,b) : a - b \in \mathbb{Z}\}

  • symmetric? - aRb    bRaaRb \implies bRa
    • abZ    baZa-b \in \mathbb{Z} \implies b-a \in \mathbb{Z}
  • reflexive? - aRa    aaZaRa \implies a - a \in \mathbb{Z}
  • transitive? - aRbbRc    aRcaRb \land bRc \implies aRc
    • abZbcZ    acZa - b \in \mathbb{Z} \land b - c \in \mathbb{Z} \implies a - c \in \mathbb{Z}

Equivalence Classes

Equivalence relation & classes

Partial Ordering

A partial ordering on a set AA is a binary relation over AA which is:

  • reflexive
  • transitive
  • anti-symmetric
Examples
  • ,\leq, \geq
  • \subseteq
info

If the relation is irreflexive instead of reflexive, it is called a strict partial ordering. (without the equal sign)

Total Ordering

A total ordering is a partial ordering RR over AA that also has the property:

x,yA(xRyyRx)\forall x,y \in A (xRy \lor yRx)

This means that we can always compare any two elements of AA.

Example
  • ,\leq, \geq
  • lexicographical ordering
info

If the relation is irreflexive instead of reflexive, it is called a strict total ordering. (without the equal sign)

References