A Rule That Assigns Exactly One Output
Relations allow many kinds of pairings.
For example, the relation
\[ R=\{(1,a),(1,b),(2,c)\} \]is valid even though the input \(1\) is related to two different outputs.
A function is more restrictive.
For each allowed input, a function must assign exactly one output.
\[ \boxed{ \text{one allowed input} \longrightarrow \text{exactly one output} } \]The same output may be used more than once. The restriction is on each input, not on each output.
This distinction is the foundation of function notation, graphs, equations, transformations, inverse functions, and much of algebra.
What Is a Function?
Let \(A\) and \(B\) be sets.
A function from \(A\) to \(B\) is a relation that assigns every element of \(A\) to exactly one element of \(B\).
We write
\[ f:A\to B. \]The set \(A\) is the domain, and \(B\) is the codomain.
For a function, two requirements are built into the definition.
1. Every Domain Element Must Be Used
If \(a\in A\), then \(a\) must be assigned an output.
There cannot be a domain element that the function simply ignores.
2. Each Domain Element Gets Only One Output
If
\[ (a,b)\in f \]and
\[ (a,c)\in f, \]then we must have
\[ b=c. \]This is the uniqueness requirement.
Together, these conditions can be summarized as:
\[ \boxed{ \forall a\in A,\ \text{there exists exactly one }b\in B \text{ such that }(a,b)\in f } \]Mapping Notation
The notation
\[ f:A\to B \]is read
“\(f\) is a function from \(A\) to \(B\).”
We can also describe what happens to a particular input.
\[ a\mapsto b \]means that \(a\) is mapped to \(b\).
For example,
\[ 1\mapsto3, \qquad 2\mapsto5, \qquad 3\mapsto7. \]These assignments could be generated by the rule
\[ f(x)=2x+1. \]Arrow Notation Does Two Different Jobs
It helps to distinguish
\[ f:A\to B \]from
\[ a\mapsto f(a). \]The first names the entire function and its source and target sets.
The second describes what happens to an individual input.
Domain, Codomain, and Range
Suppose
\[ f:A\to B. \]Then:
- Domain: the set \(A\) of allowed inputs.
- Codomain: the declared target set \(B\).
- Range: the outputs that actually occur.
Therefore,
\[ \operatorname{Ran}(f)\subseteq B. \]Example
Let
\[ f:\mathbb{R}\to\mathbb{R} \]be defined by
\[ f(x)=x^2. \]The domain is
\[ \mathbb{R}. \]The codomain is also
\[ \mathbb{R}. \]But the actual outputs are nonnegative:
\[ \operatorname{Ran}(f)=[0,\infty). \]So the codomain and range are related but not identical concepts.
Function Notation
The expression
\[ f(x) \]means the output assigned by the function \(f\) to the input \(x\).
It does not mean multiplication of \(f\) and \(x\).
For example, if
\[ f(x)=3x-2, \]then
\[ f(5)=3(5)-2=13. \]The input \(5\) is mapped to the output \(13\):
\[ 5\mapsto13. \]Equivalently, the ordered pair
\[ (5,13) \]belongs to the function.
Evaluating a Function
To evaluate a function, substitute the requested input everywhere the input variable appears.
Suppose
\[ g(x)=x^2-4x+7. \]To find \(g(3)\), substitute \(3\) for \(x\):
\[ g(3) = 3^2-4(3)+7. \] \[ g(3)=9-12+7=4. \]Therefore,
\[ \boxed{g(3)=4}. \]Inputs Can Be Expressions
We may also evaluate
\[ g(t+1). \]Substitute \(t+1\) wherever \(x\) appears:
\[ g(t+1) = (t+1)^2-4(t+1)+7. \]Expanding,
\[ g(t+1) = t^2+2t+1-4t-4+7. \]So
\[ \boxed{g(t+1)=t^2-2t+4}. \]The function accepts whatever input expression is valid in its domain.
Mapping Diagrams
A mapping diagram shows domain elements on one side and codomain elements on the other, with arrows indicating assignments.
Sharing an Output Is Allowed
A function does not require different inputs to have different outputs.
For example,
\[ f(2)=b \]and
\[ f(3)=b \]can both be true.
The function rule only forbids one input from having two different outputs.
Relations versus Functions
Consider the relation
\[ R=\{(1,a),(1,b),(2,c)\}. \]The input \(1\) is paired with both \(a\) and \(b\).
Therefore \(R\) is not a function.
An Unused Domain Element Also Causes Failure
If a function is declared
\[ f:A\to B, \]then every element of \(A\) must receive an output.
A mapping that leaves some domain element without an arrow is not a function from all of \(A\).
Functions as Sets of Ordered Pairs
Because every function is a relation, a function can be represented as a set of ordered pairs.
For example,
\[ f=\{(1,3),(2,5),(3,7)\}. \]This function has domain
\[ \{1,2,3\} \]and range
\[ \{3,5,7\}. \]The function condition says that a first component cannot appear with two different second components.
So
\[ \{(1,a),(2,b),(3,b)\} \]can be a function, while
\[ \{(1,a),(1,b),(2,c)\} \]cannot.
Repeated Identical Pairs Do Not Matter
Because a function is a set, repeated copies of the same ordered pair do not create a new assignment.
\[ \{(1,a),(1,a),(2,b)\} = \{(1,a),(2,b)\}. \]The problem occurs only when the same first component is paired with different second components.
Tables and Graphs
Functions can also be represented with tables and graphs.
Table
| \(x\) | \(f(x)\) |
|---|---|
| \(-1\) | \(3\) |
| \(0\) | \(1\) |
| \(2\) | \(5\) |
Each row represents one ordered pair:
\[ (-1,3), \qquad (0,1), \qquad (2,5). \]Graph
A graph of a function is the set of all points
\[ (x,f(x)) \]in the coordinate plane.
So function graphs are not separate from the set-theoretic definition. They are visual representations of the ordered pairs belonging to the function.
The Vertical-Line Test
A graph represents a function of \(x\) only if each allowed \(x\)-value corresponds to at most one \(y\)-value.
Geometrically, that means no vertical line may intersect the graph more than once.
This is called the vertical-line test.
Why It Works
A vertical line fixes one value of \(x\).
If that line hits the graph twice, then the same input \(x\) has two different outputs.
That violates the function rule.
Example: A Circle
The relation
\[ x^2+y^2=25 \]is not a function of \(x\) over the full circle.
For example, when
\[ x=3, \]both
\[ y=4 \]and
\[ y=-4 \]occur.
So one input produces two outputs.
A Formula Is Not the Whole Function
In elementary algebra, functions are often introduced through formulas such as
\[ f(x)=x^2. \]The formula is important, but a function contains more structure than the formula alone.
A function includes at least a specified domain together with the assignment rule. When a codomain is explicitly declared, that is also part of the mapping.
Same Formula, Different Domains
Consider
\[ f(x)=x^2 \]with domain
\[ \mathbb{R}. \]Now consider
\[ g(x)=x^2 \]with domain
\[ [0,\infty). \]The formulas look identical, but the mappings are not the same because the allowed inputs differ.
This distinction becomes important when discussing inverse functions, restrictions, and transformations.
A Preview of Special Mappings
Once a relation qualifies as a function, we can ask additional structural questions.
Do Different Inputs Always Produce Different Outputs?
If yes, the function is called injective or one-to-one.
Does the Function Reach Every Element of the Codomain?
If yes, the function is called surjective or onto.
Does It Do Both?
A function that is both injective and surjective is bijective.
These ideas deserve their own careful treatment. For now, notice that they are additional properties of functions, not part of the basic definition.
A function may legitimately send several inputs to the same output and may legitimately leave some codomain elements unused.
Practical Applications
Employee Identification Numbers
Suppose every employee is assigned exactly one employee ID.
Then the assignment can be modeled as a function
\[ f:E\to I, \]where \(E\) is the set of employees and \(I\) is a set of possible IDs.
If the company requires unique IDs, the function would also be one-to-one.
Unit Conversion
Temperature conversion from Celsius to Fahrenheit can be modeled by
\[ F(C)=\frac{9}{5}C+32. \]Every Celsius temperature is mapped to exactly one Fahrenheit temperature.
Pricing Rules
If a parking garage charges
\[ C(h)=5+3h, \]then each permitted parking duration \(h\) maps to exactly one cost.
The practical domain may be restricted by the garage's operating rules.
Software
A deterministic program routine can often be viewed as a function from valid inputs to outputs:
\[ \text{input data} \longmapsto \text{result}. \]The mathematical model is simplest when the same input always produces the same output.
Databases
A lookup by a unique primary key behaves functionally when each key identifies exactly one record.
By contrast, searching by a nonunique attribute such as city may return many records and is better modeled as a general relation or set-valued query.
Worked Examples
Example 1: Is This Relation a Function?
Consider
\[ R=\{(1,a),(2,b),(3,b)\}. \]Each first component appears with exactly one second component.
Therefore, \(R\) is a function from
\[ \{1,2,3\} \]to any codomain containing \(a\) and \(b\).
Example 2: A Failed Function
Consider
\[ R=\{(1,a),(1,c),(2,b)\}. \]The input \(1\) is assigned to both \(a\) and \(c\).
Therefore, \(R\) is not a function.
Example 3: Evaluation
Let
\[ f(x)=4x-7. \]Find \(f(6)\).
\[ f(6)=4(6)-7=24-7=17. \]Therefore,
\[ \boxed{f(6)=17}. \]Example 4: Evaluating a Negative Input
Let
\[ g(x)=x^2+3x. \]Find \(g(-2)\).
\[ g(-2) = (-2)^2+3(-2). \] \[ g(-2)=4-6=-2. \]Therefore,
\[ \boxed{g(-2)=-2}. \]Example 5: Finding an Input
Let
\[ f(x)=2x+5. \]Find \(x\) if
\[ f(x)=19. \]Set
\[ 2x+5=19. \]Then
\[ 2x=14 \]and
\[ \boxed{x=7}. \]Example 6: Mapping with Shared Outputs
Suppose
\[ f= \{(1,0),(2,0),(3,1)\}. \]This is still a function.
Inputs \(1\) and \(2\) share the output \(0\), but each input individually has exactly one output.
Common Errors
1. Thinking Each Output Can Be Used Only Once
A function may send several inputs to the same output.
The rule is about each input receiving exactly one output.
2. Allowing One Input to Have Two Outputs
A relation containing
\[ (2,a) \]and
\[ (2,b) \]with \(a\neq b\) is not a function.
3. Leaving a Declared Domain Element Unassigned
If
\[ f:A\to B, \]every element of \(A\) must receive an output.
4. Treating \(f(x)\) as Multiplication
The notation
\[ f(x) \]means “the value of function \(f\) at input \(x\),” not \(f\cdot x\).
5. Confusing Range with Codomain
The codomain is the declared target set. The range is the subset actually reached.
6. Assuming a Formula Alone Completely Specifies a Function
The domain matters. Two mappings may use the same formula but have different domains and therefore be different functions.
7. Using the Horizontal-Line Test for the Basic Function Question
The vertical-line test determines whether a graph represents a function of \(x\).
The horizontal-line test answers a different question that will become useful when studying one-to-one functions and inverses.
Practice
Function or Not?
Determine whether each relation is a function.
- \[ \{(1,a),(2,b),(3,c)\} \]
- \[ \{(1,a),(1,b),(2,c)\} \]
- \[ \{(1,a),(2,a),(3,a)\} \]
Check Answers
- Yes. Each first component has exactly one output.
- No. The input \(1\) has two different outputs.
- Yes. Several inputs may share the same output.
Evaluation
Let
\[ f(x)=x^2-2x+4. \]Find:
- \(f(0)\)
- \(f(3)\)
- \(f(-1)\)
Check Answers
- \[ f(0)=4. \]
- \[ f(3)=9-6+4=7. \]
- \[ f(-1)=1+2+4=7. \]
Mapping Notation
Suppose
\[ g(x)=3x+1. \]Complete the mapping:
\[ 4\mapsto ? \]Check Answer
\[ g(4)=3(4)+1=13. \]Therefore,
\[ \boxed{4\mapsto13}. \]Codomain and Range
Suppose
\[ f:\mathbb{R}\to\mathbb{R} \]is defined by
\[ f(x)=x^2+1. \]State the codomain and range.
Check Answer
The codomain is
\[ \mathbb{R}. \]Because
\[ x^2+1\geq1, \]the range is
\[ \boxed{[1,\infty)}. \]The Deeper Idea
A function is not merely an equation with an \(x\) in it.
It is a structured mapping between sets:
\[ f:A\to B. \]The domain tells us which objects are allowed to enter. The rule tells us how each input is assigned. The codomain tells us where outputs are declared to live. The range records which outputs actually appear.
That gives us a reusable structure:
\[ \boxed{ \text{domain} \longrightarrow \text{mapping rule} \longrightarrow \text{range inside a codomain} } \]Once functions are understood this way, later ideas become much more natural: composition joins mappings together, inverse functions reverse suitable mappings, and injective or surjective behavior describes how completely the mapping connects its sets.
Summary
- A function is a special relation that assigns every allowed input exactly one output.
- The notation \[ f:A\to B \] means that \(f\) maps domain \(A\) into codomain \(B\).
- The notation \[ a\mapsto f(a) \] describes the assignment of an individual input.
- The range consists of outputs actually reached: \[ \operatorname{Ran}(f)\subseteq B. \]
- Function notation \[ f(x) \] means the output of \(f\) at input \(x\).
- A function can be represented by ordered pairs, a table, a mapping diagram, a graph, or a formula together with its domain.
- Several inputs may share one output.
- One input may not have two different outputs.
- Every element of the declared domain must receive an output.
- A graph represents a function of \(x\) only if it passes the vertical-line test.
- A formula alone does not necessarily specify the whole function; the domain and mapping context matter.
- Injective, surjective, and bijective functions are special kinds of mappings that add further structure beyond the basic function definition.
Thinking of functions as mappings ties together set theory, ordered pairs, relations, algebraic formulas, tables, and graphs. The central rule remains simple: every allowed input goes somewhere, and it goes to exactly one output.
Sets, Relations, and Functions
- Previous: Domain and Range
- Sets, Relations, and Functions — return to the lesson directory.