Relation


A relation on a set A.
A relation on a set A. Also...

A relation on a set is a condition that may or may not hold true between two elements of that set.

In particular, a binary relation \(R\) between two sets \(A\) and \(B\) is a subset of the Cartesian product \(A \times B.\) It contains all ordered pairs \((a, b)\), where \(a \in A\) and \(b \in B\), such that \(aRb\), which is read as "a is related to b." It's possible for the two sets \(A\) and \(B\) to be the same set. If that's the case, the relation is said to be "on" that set.

What we know as a function is really a special type of relation between two sets called the domain and target, where each element of the domain is related to exactly one element of the target.

Contents

Arrow diagram


For a relation \(R\) on a set \(A\), if \(xRy\), then an arrow will be drawn from \(x \in A\) to \(y \in A.\) If \(yRx\), another arrow will point in the opposite direction.

If an element is related to itself, you can visualize this by drawing an arrow that leaves the element but then loops back to point at it. This is called a self-loop.

Matrix representation


Relations between two sets can also be visualized as a matrix, where each row corresponds to one element of the first set, and each column corresponds to one element of the second set. If two elements are related, their overlapping cell will hold \(1\), otherwise, it'll hold \(0.\)

Let \(A = \set{2, 7, 5, 4}\) and \(B = \set{1, 4, 5}.\) Define a relation \(R\) between \(A\) and \(B\) where \(aRb\) if and only if \(a \in A\) and \(b \in B\) have the same parity. Here's the matrix representation of \(R\):

\(1\) \(4\) \(5\)
\(2\) 0 1 0
\(7\) 1 0 1
\(5\) 1 0 1
\(4\) 0 1 0

Properties


Properties of relations include reflexivity, anti-reflexivity, symmetry, anti-symmetry, and transitivity. Any of these properties can be disproven with a single counterexample.

Logic & Proofs
IntegerRational numberInequalityReal numberTheoremProofStatementProof by exhaustionUniversal generalizationCounterexampleExistence proofExistential instantiationAxiomLogicTruthPropositionCompound propositionLogical operationLogical equivalenceTautologyContradictionLogic lawPredicateDomainQuantifierArgumentRule of inferenceLogical proofDirect proofProof by contrapositiveIrrational numberProof by contradictionProof by casesSummationDisjunctive normal form
Set Theory
SetElementEmpty setUniversal setSubsetPower setCartesian productStringBinary stringEmpty stringSet operationSet identitySet proof
Functions
FunctionFloor functionCeiling functionInverse function
Algorithms
AlgorithmPseudocodeCommandAsymptotic notationTime complexityAtomic operationBrute-force algorithm
Relations
RelationReflexive relationSymmetric relationTransitive relationRelation compositionEquivalence relationEquivalence class
Number Theory
Integer divisionLinear combinationDivision algorithmModular arithmeticPrime factorizationGreatest common divisorLeast common multiplePrimality testFactoring algorithmEuclid's theoremPrime number theoremEuclidean algorithm
Induction
Proof by inductionFibonacci sequenceProof by strong inductionWell-ordering principleSequenceFactorialRecursive definition
Combinatorics
Rule of productRule of sumBijection rulePermutationCombinationComplement ruleExperimentOutcomeSample spaceEventProbabilityProbability distributionUniform distributionMultisetSixfold wayInclusion-exclusion principlePigeonhole principle
Graph Theory
GraphWalkSubgraphRegular graphComplete graphEmpty graphCycle graphHypercube graphBipartite graphComponentEulerian circuitEulerian trailHamiltonian cycleHamiltonian pathTreeHuffman treeSubstringForestPath graphStarSpanning treeWeighted graphMinimum spanning treeGreedy algorithmPrim's algorithm
Recursion
RecursionRecursive algorithmCorrectness proofDivide-and-conquer algorithmSorting algorithmMerge sort