Lesson 2: Relations and Functions
Entry conditions
Use relations and functions only when you can:
- List or decide all relevant pairs of elements.
- Decide whether a specific ordered pair is included.
- For functions, assign exactly one output to each input.
Definitions
- A relation on a set is a subset of .
- A function assigns exactly one output in to each input in .
Vocabulary (plain language)
- Ordered pair: a two-item list where order matters, written .
- Relation: a list of ordered pairs saying which items are related.
- Function: a rule that gives one output for each input.
- Domain: the set of allowed inputs.
- Codomain: the set of possible outputs.
Symbols used
- : all ordered pairs of elements of .
- : the pair is in the relation.
- : a function from to .
Intuition
A relation is a declared list of which items go with which. A function is a stricter relation: each input must have one, and only one, output.
Worked examples
Example 1: A relation
Let . Define
Then is related to , but is not related to unless is also listed.
Example 2: A function
Let and . Define
Every input in has exactly one output in , so this is a function.
Example 3: Not a function
Let map to both and . Then is not a function because one input has two outputs.
How to recognize the structure
- Relation: you can answer “is in ?” for any pair.
- Function: you can answer “what is ?” for any and the answer is unique.
Common mistakes
- Treating “similarity” as a function when one item can be similar to many.
- Treating “can influence” as a function when it can target many outputs.
- Failing to define the domain or codomain.
Minimal data
- A set .
- A list of ordered pairs for .
- For a function, a total mapping from to .