The Central Idea
Suppose the cost of apples is \$3 per pound.
If \(w\) is the number of pounds and \(C\) is the cost, then
\[ C=3w. \]Once \(w\) is chosen, the cost \(C\) is determined.
For example,
\[ w=2\Rightarrow C=6, \] \[ w=5\Rightarrow C=15. \]The cost depends on the weight.
This dependable input–output relationship is a function.
Functions Describe Dependence
A function connects one quantity or object to another.
We often think of:
- an input;
- a rule or relationship;
- an output.
Symbolically:
\[ \text{input} \longrightarrow \text{function} \longrightarrow \text{output}. \]The important condition is that each allowed input produces exactly one output.
A Function Is a Special Kind of Relation
A relation is any mathematical association between objects.
A function is a relation with an additional requirement:
Every input in the domain must be associated with exactly one output.
So every function is a relation, but not every relation is a function.
Exactly One Output
Consider the input \(x=4\).
A function may assign
\[ 4\longmapsto9. \]It may not assign the same input simultaneously to two different outputs such as
\[ 4\longmapsto9 \]and
\[ 4\longmapsto12. \]That would violate the function rule.
Different Inputs May Share an Output
The restriction applies to inputs, not outputs.
A function may have
\[ 2\longmapsto4 \]and
\[ -2\longmapsto4. \]Both inputs may share the same output.
This happens, for example, with
\[ f(x)=x^2. \]Input and Output
If
\[ f(x)=2x+1, \]then \(x\) is the input variable.
The expression
\[ 2x+1 \]determines the output.
If
\[ x=3, \]then
\[ f(3)=2(3)+1=7. \]Function Notation
The notation
\[ f(x) \]means “the output of the function \(f\) when the input is \(x\).”
It does not mean
\[ f\cdot x. \]The parentheses show function evaluation, not multiplication.
Naming Functions
Functions are often named with letters such as
\[ f,\quad g,\quad h. \]For example:
\[ f(x)=x^2, \] \[ g(t)=5t-3, \] \[ h(r)=\pi r^2. \]The function name and input symbol are chosen for convenience and context.
The Input Variable Is Not Always \(x\)
In a time model, we might write
\[ d(t)=60t. \]Here \(t\) represents time and \(d(t)\) represents distance as a function of time.
In geometry, we might write
\[ A(r)=\pi r^2. \]Here area depends on radius.
Independent and Dependent Variables
In many applications, the input is called the independent variable.
The output is called the dependent variable because its value depends on the input.
For
\[ C=3w, \]weight \(w\) is the input and cost \(C\) depends on it.
Dependence Does Not Always Mean Cause
A function describes a mathematical dependence.
It does not automatically establish real-world causation.
For example, a formula may model one measured quantity as a function of another without claiming that one physically causes the other.
Mathematical dependence and causal explanation are different ideas.
The Domain
The domain is the set of allowed inputs.
For
\[ f(x)=\frac{1}{x}, \]the input
\[ x=0 \]is not allowed because division by zero is undefined.
So over the real numbers, the domain is
\[ \mathbb{R}\setminus\{0\}. \]Domain Comes from Mathematics and Context
Sometimes the formula itself restricts the domain.
For example,
\[ f(x)=\sqrt{x} \]requires
\[ x\ge0 \]for real-valued outputs.
Other times the context imposes restrictions.
If \(n\) counts people, we may require
\[ n\in\mathbb{Z}_{\ge0}. \]The Range
The range is the set of outputs actually produced by the function.
For
\[ f(x)=x^2 \]with real inputs,
\[ f(x)\ge0. \]So the range is
\[ [0,\infty). \]Codomain and Range
A function may also be described with a codomain, the set in which outputs are declared to live.
The range is the subset of the codomain that the function actually reaches.
For example,
\[ f:\mathbb{R}\to\mathbb{R}, \qquad f(x)=x^2. \]The codomain is
\[ \mathbb{R}, \]but the range is
\[ [0,\infty). \]Function Arrow Notation
The notation
\[ f:A\to B \]means that \(f\) is a function from domain \(A\) to codomain \(B\).
If
\[ x\in A, \]then the function assigns an output
\[ f(x)\in B. \]Mapping Notation
We may also describe a rule by writing
\[ x\mapsto x^2. \]This reads:
“\(x\) maps to \(x^2\).”
It emphasizes the transformation from input to output.
Functions Can Be Represented in Many Ways
A function may be represented by:
- a formula;
- a table;
- a graph;
- a mapping diagram;
- a verbal rule;
- an algorithm;
- a piecewise definition;
- or a collection of ordered pairs.
No single representation is the function itself. Each is a way of describing the same relationship.
Function as a Table
Consider:
| Input \(x\) | Output \(y\) |
|---|---|
| 1 | 3 |
| 2 | 5 |
| 3 | 7 |
| 4 | 9 |
Every input appears with exactly one output.
The table therefore represents a function.
A Table That Is Not a Function
| Input \(x\) | Output \(y\) |
|---|---|
| 1 | 4 |
| 2 | 5 |
| 2 | 8 |
The input \(2\) has two different outputs.
Therefore, this relation is not a function of \(x\).
Ordered Pairs
A function can be represented as a set of ordered pairs:
\[ \{(1,3),(2,5),(3,7)\}. \]The first coordinate is the input.
The second coordinate is the output.
This is a function because no first coordinate is paired with more than one second coordinate.
Repeated Outputs Are Allowed
The relation
\[ \{(-2,4),(2,4),(3,9)\} \]is a function.
The output \(4\) appears twice, but each input appears only once.
Graphs of Functions
A graph represents a function when each allowed horizontal input value corresponds to at most one plotted output value.
This leads to the vertical line test.
The Vertical Line Test
If any vertical line intersects a graph more than once, then some input \(x\) has more than one output \(y\).
Therefore, the graph does not represent \(y\) as a function of \(x\).
If every vertical line intersects the graph at most once, then the graph represents a function of \(x\).
Why a Circle Fails the Vertical Line Test
Consider the circle
\[ x^2+y^2=25. \]At
\[ x=0, \]the equation gives
\[ y=5 \]and
\[ y=-5. \]The same \(x\)-input has two \(y\)-outputs.
So the entire circle is not a function \(y=f(x)\).
A Relation May Be a Function in Another Direction
The question “Is this a function?” is incomplete unless we know which variable is the input.
A relation might define \(y\) as a function of \(x\), \(x\) as a function of \(y\), both, or neither.
Function status depends on the chosen direction of dependence.
Functions Need Not Be Formulas
Consider a rule:
Input a U.S. state and output its capital.
Each state has exactly one state capital.
This is a function even though it is not naturally given by an algebraic formula.
Functions Can Act on More Than Numbers
A function can map:
- numbers to numbers;
- points to points;
- sets to numbers;
- matrices to matrices;
- words to lengths;
- objects to classifications;
- or mathematical structures to other structures.
The input–output idea is much broader than ordinary algebraic formulas.
Example: A Function on Words
Define \(L(w)\) to be the number of letters in word \(w\).
Then
\[ L(\text{cat})=3, \] \[ L(\text{algebra})=7. \]Every input word has exactly one letter count, so this is a function.
Example: A Function on Sets
Let
\[ N(S) \]be the number of elements in a finite set \(S\).
If
\[ S=\{a,b,c,d\}, \]then
\[ N(S)=4. \]This is another valid function whose inputs are not numbers.
Rules Must Be Unambiguous
Suppose someone says:
“Given a number, output one of its square roots.”
For the input
\[ 9, \]the rule could output
\[ 3 \]or
\[ -3. \]Without an additional convention, the rule does not assign exactly one output.
So it is not yet a well-defined function.
The Principal Square Root Creates a Function
The principal square-root function is defined by
\[ f(x)=\sqrt{x}, \qquad x\ge0, \]where \(\sqrt{x}\) means the nonnegative square root.
Now each allowed input has exactly one output.
The convention turns an ambiguous relation into a well-defined function.
A Formula Can Fail to Define a Function on a Chosen Domain
Consider
\[ f(x)=\frac{1}{x-2}. \]If someone claims the domain is all real numbers, the definition fails at
\[ x=2. \]A function must be defined for every input in its stated domain.
Piecewise Functions
A function may use different rules for different parts of its domain.
For example,
\[ f(x)= \begin{cases} x+2, & x<0,\\ x^2, & x\ge0. \end{cases} \]Each input still receives exactly one output because the conditions determine which rule applies.
Overlapping Conditions Can Cause Trouble
Suppose a piecewise rule says:
\[ f(x)= \begin{cases} x+1, & x\le2,\\ x^2, & x\ge2. \end{cases} \]At \(x=2\), both rules apply.
They give
\[ 3 \]and
\[ 4. \]So this definition is not a function unless the overlap is resolved.
Functions as Machines
A common intuition is to imagine a function as a machine:
\[ x \longrightarrow f \longrightarrow f(x). \]The machine accepts an allowed input, applies its rule, and returns exactly one output.
This picture is useful, but a function is more general than a physical process or formula.
Functions as Assignments
A more precise viewpoint is:
A function assigns each element of its domain exactly one element of its codomain.
This definition works for numerical, geometric, discrete, and abstract settings alike.
Functions and Equations
An equation such as
\[ y=2x+3 \]describes a relationship between \(x\) and \(y\).
Because each \(x\) produces exactly one \(y\), the equation defines \(y\) as a function of \(x\).
We may write
\[ f(x)=2x+3. \]Not Every Equation Defines a Function of \(x\)
Consider
\[ y^2=x. \]Solving for \(y\):
\[ y=\pm\sqrt{x}. \]For most positive \(x\), there are two possible \(y\)-values.
So this equation does not define \(y\) as a single-valued function of \(x\) unless we choose one branch.
Restricting a Relation Can Create a Function
The relation
\[ y^2=x \]can be restricted to
\[ y\ge0. \]Then
\[ y=\sqrt{x}, \]which is a function.
Domain or range restrictions can turn a multivalued relation into a function.
Functions and Proportional Relationships
A direct proportion
\[ y=kx \]is a function whenever the domain is specified appropriately.
For each input \(x\), there is exactly one output \(y\).
So proportional relationships are one important family of functions.
Inverse Proportion as a Function
The inverse proportional relationship
\[ y=\frac{k}{x}, \qquad x\ne0, \]is also a function.
Each allowed nonzero input produces exactly one output.
Functions Need Not Be Proportional
The function
\[ f(x)=x^2+3 \]is not proportional.
The function
\[ g(x)=\sin x \]is not proportional.
The function
\[ h(x)=\frac{1}{x-2} \]is not a direct proportion in \(x\).
Function is a broad category; proportional functions are only one special class.
Functions Need Not Be Continuous
A function can jump, have gaps in its domain, or be defined only at isolated points.
For example,
\[ f(n)=(-1)^n, \qquad n\in\mathbb{Z}, \]is a function defined only on integers.
Its values alternate between
\[ 1 \]and
\[ -1. \]Functions Need Not Be One-to-One
A function may send different inputs to the same output.
For
\[ f(x)=x^2, \]we have
\[ f(2)=4 \]and
\[ f(-2)=4. \]This is still a function.
The stronger property that different inputs produce different outputs will be studied separately.
Functions Need Not Reach Every Possible Output
Consider
\[ f:\mathbb{R}\to\mathbb{R}, \qquad f(x)=x^2. \]No real input produces
\[ -1. \]The function is still perfectly valid.
Reaching every element of the codomain is a stronger property than merely being a function.
Functions Can Have Several Inputs
A function may depend on more than one input.
For example, the area of a rectangle can be written
\[ A(l,w)=lw. \]The ordered pair
\[ (l,w) \]acts as the input.
The function returns one area value.
Multivariable Functions
Similarly, the volume of a rectangular prism is
\[ V(l,w,h)=lwh. \]The function has three input variables.
For each allowed triple
\[ (l,w,h), \]there is exactly one output volume.
The Input Can Be an Ordered Tuple
A function of several variables can still be viewed as having one input: an ordered tuple.
For example,
\[ A:\mathbb{R}^2\to\mathbb{R} \]may take the input
\[ (l,w) \]and return
\[ lw. \]This viewpoint becomes useful in higher-dimensional mathematics.
Functions as Models
Functions are central to modeling because they describe how one set of quantities determines another.
Examples include:
\[ C(n)=2.50n \]for cost,
\[ d(t)=60t \]for constant-speed distance, and
\[ A(r)=\pi r^2 \]for circle area.
A Model Is Not the Same as Reality
A function may model a real system under stated assumptions.
For example,
\[ d(t)=60t \]assumes a constant average speed of 60 miles per hour.
If the speed changes, the function may no longer describe the trip accurately.
Functions are mathematical relationships; models are applications of those relationships to situations.
Functions and Algorithms
A function may be specified by a sequence of steps.
For example:
- take the input number;
- square it;
- add \(5\).
This algorithm defines
\[ f(x)=x^2+5. \]The rule can be procedural even when no formula is initially given.
Composition Preview
Functions can be chained.
If
\[ f(x)=x+2 \]and
\[ g(x)=x^2, \]then we may feed the output of \(f\) into \(g\):
\[ x \longrightarrow f(x) \longrightarrow g(f(x)). \]This creates a new function from existing functions.
Identity Function Preview
The simplest function may be
\[ I(x)=x. \]It returns every input unchanged.
This is called an identity function.
It will later play a role similar to the number \(1\) in multiplication: doing nothing while preserving structure.
Function Equality
Two formulas can describe the same function when they have the same domain and produce the same output for every allowed input.
For example,
\[ f(x)=2(x+3) \]and
\[ g(x)=2x+6 \]define the same real-valued function if they use the same domain.
Same Formula, Different Domain, Different Function
Consider
\[ f(x)=x^2 \]with domain
\[ \mathbb{R} \]and
\[ g(x)=x^2 \]with domain
\[ [0,\infty). \]The formulas are identical, but the functions are not identical because their domains differ.
Why Domain Is Part of the Function
A function is not determined only by its output formula.
The domain tells us which inputs the function is actually supposed to accept.
Changing the domain can change properties such as:
- range;
- invertibility;
- one-to-one behavior;
- maximum and minimum values.
Worked Example: Evaluate a Function
Let
\[ f(x)=3x-4. \]Find
\[ f(5). \]Substitute \(5\):
\[ f(5)=3(5)-4=15-4=11. \]Therefore,
\[ \boxed{f(5)=11}. \]Worked Example: Find the Input
Let
\[ f(x)=2x+7. \]Find the input that produces output \(19\).
Set
\[ 2x+7=19. \]Then
\[ 2x=12, \] \[ \boxed{x=6}. \]Worked Example: Determine Whether a Relation Is a Function
Consider
\[ \{(1,4),(2,5),(3,4),(4,7)\}. \]The inputs are
\[ 1,2,3,4. \]Each input appears with exactly one output.
Therefore, the relation is a function.
Worked Example: Not a Function
Consider
\[ \{(1,4),(2,5),(2,8),(3,9)\}. \]The input \(2\) is associated with both \(5\) and \(8\).
Therefore, the relation is not a function.
Worked Example: Domain Restriction
Find the real domain of
\[ f(x)=\frac{x+1}{x-4}. \]The denominator cannot equal zero:
\[ x-4\ne0. \]So
\[ x\ne4. \]The domain is
\[ \boxed{\mathbb{R}\setminus\{4\}}. \]Worked Example: Contextual Domain
Suppose
\[ C(n)=12n \]models the cost of \(n\) tickets.
As an algebraic formula, many real inputs could be substituted.
But if tickets cannot be purchased fractionally or negatively, the practical domain may be
\[ n\in\mathbb{Z}_{\ge0}. \]The context determines the useful domain.
A Reliable Function-Recognition Workflow
- Identify the proposed inputs.
- Identify the proposed outputs.
- Check whether every allowed input receives an output.
- Check whether any input receives more than one output.
- Identify the domain and any restrictions.
- Determine how the relationship is represented: formula, table, graph, rule, or mapping.
- Interpret the dependence in context.
A Reliable Function-Evaluation Workflow
- Identify the function rule.
- Check that the requested input belongs to the domain.
- Substitute the input wherever the function variable appears.
- Preserve grouping with parentheses.
- Evaluate using ordinary order of operations.
- Interpret the output and units if the function represents a real quantity.
Common Errors
Thinking \(f(x)\) Means \(f\cdot x\)
Function notation represents evaluation, not multiplication.
Believing Different Inputs Must Have Different Outputs
That is a stronger one-to-one condition, not a requirement for every function.
Ignoring the Domain
A rule must be defined for every input claimed to belong to its domain.
Assuming Every Equation Defines \(y\) as a Function of \(x\)
Some equations assign multiple \(y\)-values to one \(x\)-value.
Thinking Functions Must Be Algebraic Formulas
Functions can be tables, algorithms, mappings, classifications, and many other well-defined assignments.
Confusing Mathematical Dependence with Causation
A function specifies an association; it does not automatically explain why the relationship exists.
Forgetting That Context Can Restrict Inputs
A formula may accept real numbers algebraically while the application permits only positive or integer values.
Practice
1. Evaluate a Function
Let
\[ f(x)=4x+1. \]Find
\[ f(3). \]Check Answer
\[ f(3)=4(3)+1=13. \]Answer:
\[ \boxed{13}. \]2. Function or Not?
Does
\[ \{(1,2),(2,4),(3,6),(4,8)\} \]represent a function?
Check Answer
Yes. Every input has exactly one output.
3. Function or Not?
Does
\[ \{(1,2),(1,5),(3,7)\} \]represent a function?
Check Answer
No. The input \(1\) has two outputs.
4. Repeated Outputs
Does
\[ \{(-2,4),(2,4),(3,9)\} \]represent a function?
Check Answer
Yes. Repeated outputs are allowed because each input still has exactly one output.
5. Domain
Find the real domain of
\[ f(x)=\frac{5}{x+2}. \]Check Answer
\[ x+2\ne0, \]so
\[ \boxed{x\ne-2}. \]6. Range
What is the range of
\[ f(x)=x^2 \]over the real numbers?
Check Answer
\[ \boxed{[0,\infty)}. \]7. Contextual Domain
The function
\[ C(n)=7n \]gives the cost of \(n\) identical tickets. What is a reasonable domain if only whole tickets may be purchased?
Check Answer
\[ \boxed{n\in\mathbb{Z}_{\ge0}}. \]8. Several Inputs
Evaluate
\[ A(l,w)=lw \]at
\[ (l,w)=(5,8). \]Check Answer
\[ A(5,8)=5(8)=40. \]Answer:
\[ \boxed{40}. \]Key Ideas
- A function assigns each allowed input exactly one output.
- Every function is a relation, but not every relation is a function.
- Different inputs may share the same output.
- Function notation \(f(x)\) means the output of \(f\) at input \(x\).
- The domain is the set of allowed inputs.
- The range is the set of outputs actually produced.
- The codomain is the declared output set and may be larger than the range.
- Functions can be represented by formulas, tables, graphs, mappings, verbal rules, algorithms, or ordered pairs.
- The vertical line test identifies whether a graph represents \(y\) as a function of \(x\).
- Functions can act on numbers, sets, words, points, matrices, and many other kinds of objects.
- A function may depend on several input variables.
- The domain is part of the definition of a function, not an optional afterthought.
- Functions describe dependence, but mathematical dependence does not automatically imply causation.
- Proportional relationships are important examples of functions, but functions are far more general than proportional relationships.
Where This Leads
Seeing functions as relationships prepares the way for a much deeper study of mathematical dependence.
From here, function notation, domain and range, graphs, transformations, composition, inverse functions, one-to-one behavior, piecewise functions, polynomial and rational functions, exponential and logarithmic functions, sequences, multivariable functions, and eventually calculus all grow from the same central idea: inputs are assigned outputs according to a well-defined rule.