Relations & Functions
Types of relations, functions, domain and range, and the vertical line test.
Relations and functions describe how inputs are paired with outputs. Every function is a relation, but not every relation is a function, because a function gives each input exactly one output.
In CSEC, this topic often asks you to move between representations: ordered pairs, mapping diagrams, tables, equations, and graphs. Keep track of the domain, codomain, and range, because those words describe the input choices, possible targets, and actual outputs.
A Relation Is a Connection
A relation is simply a connection between two sets of things. It pairs up elements from one set with elements from another set.
Real-world examples:
- Each student paired with their test score
- Each city paired with its temperature
- Each book paired with its author
- Each date paired with the day's closing stock price
Sets and Notation
Before we formalize relations, understand the vocabulary:
-
Set: A collection of objects (written in curly braces)
- Example: (the set of single digits 1-5)
- Example: (vowels)
-
Ordered pair: Two elements in a specific order, written as
- is different from
- First element: input
- Second element: output
-
Cartesian product: All possible ordered pairs from two sets
- If and
- Then (4 pairs total)
Defining a Relation Formally
A relation from set to set is a subset of the Cartesian product .
In simpler terms: Pick some (but not necessarily all) ordered pairs from .
Let (ages) and (heights in inches)
The relation ": person of age has height " might be:
Or it could be any other subset, like (not all pairs need to be included).
Cartesian product has 9 possible pairs total. Our relation uses only 3 of them.
Key Properties of Relations
Domain — The Input Set
The domain is the set of all first elements (inputs).
For relation :
Domain: (list each once, even if it appears multiple times)
Note: 2 is in the domain only once, even though it appears twice in the relation.
Codomain — The Target Set
The codomain is the set we're pairing TO (the "target" set we might use, whether we actually use all elements or not).
Range (or Image) — The Output Set
The range is the set of all second elements (outputs) that actually appear.
For relation :
If codomain is :
- Codomain (target): (7 elements, some unused)
- Range (actually used): (4 elements, only the actual outputs)
Key difference: Codomain is "available to use," Range is "actually used."
Types of Relations
One-to-One (Injective)
Each input connects to exactly one output, and no two inputs connect to the same output.
Example: Student → Student ID (each student has one unique ID)
Many-to-One
Multiple inputs can connect to the same output.
Example: City → Country (many cities in one country)
One-to-Many
One input connects to multiple outputs.
Example: Person → Hobbies (one person has many hobbies)
Many-to-Many
Inputs and outputs can have multiple connections.
Example: Students → Subjects (many students in many subjects)
Domain: Set of all FIRST elements (inputs) Range: Set of all SECOND elements (outputs actually used) Codomain: Target set (all possible outputs available)
Domain and Range are determined by the actual relation. Codomain is usually stated separately.
Part 2: Functions — Special Relations
What Makes a Function Special?
A function is a special type of relation with ONE strict rule:
Each input must have EXACTLY ONE output.
This means:
- ✓ Input 3 connects to output 9 (good)
- ✓ Input 5 connects to output 25 (good)
- ✗ Input 3 connects to outputs 9 AND 10 (bad! not a function)
- ✗ Input 5 connects to outputs 25 AND 5 (bad! not a function)
However: It's okay if two different inputs map to the same output (many-to-one is fine for functions).
Function Notation
When we have a function, we use special notation to show the rule.
Standard Notation
Read as: "Function from set to set "
- = domain (the inputs)
- = codomain (the target outputs)
- The rule defines which output goes with each input
Function Rule Notation
This means:
- is the name of the function
- is the input variable
- is the output (what you get after applying the rule)
Examples:
- means: "Take the input , double it, and add 1"
- means: "Take the input and square it"
- means: "Take the input and multiply by 5"
Evaluating Functions — Finding Outputs
To evaluate a function at a specific value, substitute that value in for .
Given , find :
Step 1: Substitute 3 for every
Step 2: Calculate
Meaning: When input is 3, output is 7. The point is on the graph.
Given , find :
Step 1: Substitute -2 for every (use brackets!)
Step 2: Calculate carefully
Answer:
Functions vs. Relations — The Key Difference
The vertical line test distinguishes functions from non-functions:
Vertical line test rule: If you draw a vertical line at any -value on the graph, it crosses the graph at most ONCE, the relation is a function.
- Crosses once: function ✓
- Crosses twice or more: not a function ✗
- Doesn't cross: that -value isn't in the domain
Is a function?
Rearrange:
This means for each , there are TWO possible values (positive and negative square root).
Example: If , then OR (two outputs for one input).
Answer: NOT a function. Fails the vertical line test.