Read this lesson as text
Functions as Special Relations
Discrete Math · Axiom Academy
LESSON Functions as Special Relations Understanding how functions are special types of relations with the unique property that each input maps to exactly one output. 1. From Relations to Functions A relation from set A to set B is any subset of A × B. It can pair elements in any way imaginable. A function is a relation with a special property: When we graph a relation in the coordinate plane, there's a simple visual test to determine if it's a function: the vertical line test . 3. Total vs. Partial Functions Not all functions are defined for every possible input. This leads to an important distinction in discrete mathematics and computer science: In mathematics, when we write f: A → B without qualification, we typically mean a total function. But in programming and computational contexts, partial functions are everywhere! 4. Partial Functions in Programming Many common programming operations are actually partial functions because they're not defined for all possible inputs:
This is the written version of the interactive lesson above. See the full Discrete Math course.