───✱*.。:。✱*.:。✧*.。✰*.:。✧*.。:。*.。✱ ───

A relation is a subset of the cartesian product of two or more sets based on a rule or definition. It is typically denoted with 𝑅(𝑥,𝑦), 𝑅𝑥𝑦, 𝑥𝑅𝑦, or 𝑅𝑥𝑦.

A relationship 𝑅 between two sets 𝐴 and 𝐵 is a subset of 𝐴×𝐵, meaning it contains some ordered pairs from the cartesian product.

Examples

  • Given 𝐻={Lyla,Alex,Connie} and 𝐴={pig,dog,snake}
    • A relation, 𝑅, on 𝐻×𝐴 is defined as to whether a human owns the Animal.
    • 𝑅={(Lyla,pig),(Alex,dog),(Connie,snake)}
  • Relations can also be across a single set
    • Given 𝐴={1,2}, 𝑅=𝐴×𝐴={(1,1),(1,2),(2,1),(2,2)}

Domain

  • The domain of a relation is written as Dom(𝑅).
  • If 𝑅 is a relation on 𝐴×𝐵, then Dom(𝑅) is the subset of all 𝑥 in 𝐴 where (𝑥,𝑦)𝑅 and 𝑥𝐴.
    • Dom({(1,2),(3,4),(5,6)})={1,3,5}

Range

  • The range of a relation is written as Ran(𝑅).
  • If 𝑅 is a relation on 𝐴×𝐵, then Ran(𝑅) is the subset of all 𝑦 in 𝐴 where (𝑥,𝑦)𝑅 and 𝑥𝐴.
    • Ran({(1,2),(3,4),(5,6)})={2,4,6}

Matrix Representation

  • Place a 1 where the relation is included in the cartesian product, otherwise place a 0.
  • Given 𝐴={𝑎,𝑏,𝑐} and 𝐵={1,2,3} and the relation 𝑅={(𝑎,1),(𝑏,2),(𝑐,3)} [[[123𝑎100𝑏010𝑐001]]]

Directed Graph Representation

  • A way to represent a relation visually
  • Left nodes represent elements of 𝐴 and right nodes represent elements 𝐵
  • A directed edge (→) from 𝑎𝐵 to 𝑏𝐵 if and only if (𝑎,𝑏)𝑅

In-Degree

  • The number of times an element is the second element in an ordered pair
  • Visually, the number of arrows pointing inwards

Out-Degree

  • The number of times an element is the first element in an ordered pair
  • Visually, the number of arrows pointing outwards

Properties of Relations

Reflexive

  • 𝑥𝐴,(𝑥,𝑥)𝑅 [[[123112131]]]

Symmetric

  • (𝑥,𝑦)𝑅(𝑦,𝑥)𝑅 [[[1231121131]]]

Transitive

  • (𝑥,𝑦)𝑅(𝑦,𝑧)𝑅(𝑥,𝑧)𝑅

Equivalence

  • A relationship is equivalent if the reflective, symmetric, and transitive properties are all true.

───✱*.。:。✱*.:。✧*.。✰*.:。✧*.。:。*.。✱ ───