Binary Relations
San Skulrattanakulchai
October 12, 2021
Definitions
- A binary relation is a generalization of functions. Its significance in computer science stems from the fact that it is the mathematical foundation of relational database management systems.
- A relation between \(A\) and \(B\) (or “from \(A\) to \(B\)”) consists of
- the domain set \(A\)
- the codomain set \(B\)
- a graph of the relation which is a subset of \(A\times B\).
- Like functions, we write \(R: A\to B\) to denote the relation \(R\) with domain \(A\) and codomain \(B\). If \(A=B\), we say that \(R\) is a relation on \(A\).
- To indicate that a pair \((a,b)\) is in the graph of \(R\), we write \(a R b\) or \(R(a,b)\).
- Examples of relations:
- relations on the reals like \(=\), \(\ne\), \(<\), \(>\), \(\le\), \(\ge\)
- set-theoretic relations like \(\in\), \(\notin\), \(\subset\), \(\supset\), \(\subseteq\), \(\supseteq\)
- relations on people like “is a brother of”, “is a sister of”, “is a father of”, “is an advisor of”, “teaches”
Relation Diagrams & Properties
- We can depict a relation diagrammatically in the same way we depict a function through its mapping diagram. The domain (and also the codomain) is an oval surrounding points representing its elements. Each element \((a, b)\) of the graph of the relation is depicted as an arrow from \(a\) to \(b\).
- We describe relations in terms of the arrows touching elements of the domain and the codomain in the relation diagram. We write
- [r \(1\) out] to describe the domain
- [r \(1\) in] to describe the codomain
where r can be \(=\), \(\le\), or \(\ge\).
- A relation is
- a function if it has [\(\le 1\) out] property
- surjective if it has [\(\ge 1\) in] property
- total if it has [\(\ge 1\) out] property
- injective if it has [\(\le 1\) in] property
- bijective if it has [\(= 1\) out] and [\(= 1\) in] property
Inverse Relation
- To every relation \(R: A\to B\) is defined its inverse relation \(R^{-1}: B\to A\) such that for any \(b\in B\), \(a\in A\), \(b R^{-1} a\) iff \(a R b\).
- The concepts of support, range, image, and preimage of the relations are exactly like described in the lecture notes on functions.