HOME Mathematics Computer Science
Sets of Ordered Pairs
Show All
Hide All

  • A set is a collection of elements, such as:
    • A = {1, 2, 3, 4, 5}
  • A set does not have order:
    • {1, 2, 3, 4, 5} is the same as {5, 4, 3, 2, 1}
    • It is convenient to write the elements of a set in consecutive order, but this is only for convenience.
  • Every element in a set is unique, multiples of the same element are ignored:
    • The set {1, 2, 2} has a size of 2, and is the same as {1, 2}
  • It is common for sets to be denoted by a uppercase letter, and for its elements to be wrapped in curly braces:k

    LaTeX: \mathbf{A} = \{ 1, 2, 3, 4, 5 \}
  • Sets can also be defined using set builder notation:
    • A rule is used to show which elements are members of the set:
    • The set A defined above would contain all even integers between 0 and 2000.
    • The format of the rule is: (formula: conditions) or (formula| conditions).
    • If it is not specified as a condition, then it is assumed that a is a real number.
Elements in a set
  • Elements in a set are usually represented by a lowercase letter.
  • To demonstrate that an element is part of a set, we use the set membership symbol:

    LaTeX: \mathbf{a} \in \mathbf{A}
  • This can also be done with proper elements:

    LaTeX: \1 \in \{ 1, 2, 3, 4, 5 \}
  • To show that an element is not part of a set, we use the 'not member of' symbol:

    LaTeX: 6 \notin \{ 1, 2, 3, 4, 5 \}
The Empty Set

The Empty Set (or Null Set) is a set containing no items. It is represented by the empty set symbol:

LaTeX: \varnothing = \{\}
A = frozenset([1, 2, 3, 4, 5])

print(1 in A) # prints 'True'
print(6 not in A) # prints 'True'
Important Sets

  • Some sets are used so often in mathematics that they are given their own names.
  • This article will cover two of them:
    • Z: The set of all integers.
    • R: The set of all real numbers.
  • The set of all integers contains all the whole numbers, including negative numbers and 0.
  • It is represented by an uppercase bold (or blackboard bold) Z:

    LaTeX: \mathbb{Z} = \{ ..., -3, -2, -1, 0, 1, 2, 3, ... \}
i = 1
print(type(i))  # prints <class 'int'>
Real Numbers
  • The set of all real numbers contains every number that is not imaginary. This includes:
    • Integers: e.g. 0, 1, 2
    • Rational Numbers: Those which can be represented as a fraction, e.g. 0.5, 1.1
    • Irrational Numbers: Those which cannot be represented by a fraction, e.g.
  • It is represented by an uppercase bold (or blackboard bold) R:

    LaTeX: \mathbb{R} = \{ -1, 1.4, \pi \}
Unfortunately we cannot represent irrational numbers using code. Instead we can approximate them as floating point numbers:
r = 1.41421356237
print(type(r))  # prints <class 'float'>
Ordered Pairs

  • An ordered pair is simply a pair of objects, e.g. (a, b)
  • In an ordered pair, the order matters:
    (\mathbf{a}, \mathbf{b})\neq (\mathbf{b}, \mathbf{a}) 
    \text{ unless } 
    \mathbf{a} = \mathbf{b}
  • This contrasts with the unordered pair, in which (a, b) = (b, a) regardless of the values of a and b.
  • An ordered pair is not a type of set. An ordered pair may contain duplicate elements, and its order is important.
Ordered Pairs are represented by a comma separated pair of elements wrapped in brackets:
a = (1, 2)
LaTeX: \mathbf{a} = (1, 2)
a = (1, 2)

Sets of Ordered Pairs

  • We have special symbols denoting the set of all integers and the set of all real numbers: Z and R respectively.
  • These can be modified to denote the set of all ordered pairs:
    • Z2 denotes the set of all ordered pairs of integers.
    • R2 denotes the set of all ordered pairs of real numbers.
The set of all ordered pairs of integers
  • Z2 contains every possible pair of integers, e.g.
  • We can define Z2 in terms of Z using set builder notation:

    LaTeX: \mathbb{Z}^2 = \{ (z_1, z_2)\colon z_1, z_2 \in \mathbb{Z} \}
The set of all ordered pairs of real numbers
  • R2 contains every possible pair of real numbers, e.g.
  • We can define R2 in terms of R using set builder notation:

    LaTeX: \mathbb{R}^2 = \{ (r_1, r_2)\colon r_1, r_2 \in \mathbb{R} \}
Higher dimensions
  • R and Z can also be extended to higher dimensions:
  • To represent the set of all triplets of integers, you can use a superscript of 3: