A function is a rule that gives exactly one output for each input. If you put in one x-value, a function gives back one y-value. In f(x) = 2x + 1, the input 3 gives the output 7. Two inputs may share an output, but one input can never have two different outputs.
Check the inputs: in a function each one sends out exactly one arrow. Outputs may be shared (left), but an input with two arrows (right) breaks the rule.
Formal definition and notation
A function f from a set D (the domain) to a set R assigns to each element x of D exactly one element f(x) of R. The set of outputs actually produced is the range. A relation, any set of ordered pairs(x, y), is a function exactly when no two pairs have the same first coordinate and different second coordinates. The graph of f is the set of points (x, f(x)), the graph of the equation y = f(x).
Symbol
Read it as
Meaning
f(x)
f of x
the output of function f for the input x; it does not mean f times x
f(3) = 7
f of 3 equals 7
input 3 gives output 7, the point (3, 7) on the graph
A function can be shown four ways: an equation (y = 2x + 1), a table, a graph or words (“double it and add 1”).
The allowed inputs form the domain; the outputs form the range. See domain and range.
Every non-vertical line y = mx + b is a function. A vertical line such as x = 4 is not: the input 4 has infinitely many outputs.
A circle such as x2 + y2 = 25 is not a function: the input 3 gives both y = 4 and y = −4.
In a real situation, the output depends on the input: the cost of gas is a function of the number of gallons.
Function test
Function test
each input → exactly one output
Table
no x-value is repeated with a different y-value
Mapping
exactly one arrow leaves each input
Graph
every vertical line crosses the graph at most once (the vertical line test)
The test only looks at inputs. Repeated outputs are fine: f(x) = x2 gives f(−2) = f(2) = 4 and is still a function.
Try it: function machine
Interactive
Type an input and press Run (or Enter). The machine applies the rule “multiply by 2, then add 1” and logs each input-output pair in the table. Run the same input twice: a function always gives the same output.
This interactive needs JavaScript. The worked examples below show the same ideas step by step.
Function examples, step by step
Example 1: Evaluate a function
Warm-up
For f(x) = 3x − 4, find f(5).
f(5) means: use the input 5 in place of x.
f(5) = 3(5) − 4.
3 × 5 = 15, and 15 − 4 = 11.
Answer:f(5) = 11, so the point (5, 11) is on the graph.
Example 2: Is this relation a function?
Core
Is the relation {(1, 4), (2, 7), (1, 9), (3, 4)} a function?
List the inputs (first coordinates): 1, 2, 1, 3.
The input 1 appears twice, with outputs 4 and 9.
One input with two different outputs breaks the rule.
(The output 4 appearing twice, for inputs 1 and 3, would be fine on its own.)
Answer: No. The input 1 has two outputs, 4 and 9, so the relation is not a function.
Example 3: A function in context
Test-style
The cost in dollars of n concert tickets, including a booking fee, is C(n) = 15n + 40. Find C(6) and say what it means. How many tickets cost 160 dollars?
The domain and range are the sets of inputs and outputs. The function is the rule that pairs them. For f(x) = x2, the domain is all real numbers and the range is y ≥ 0.
Quick check: 3 questions
Question 1 of 3
If f(x) = 2x − 5, what is f(4)?
Show answer and explanation
Answer: C.f(4) = 2(4) − 5 = 8 − 5 = 3. 13 adds 5 instead of subtracting, 8 forgets the −5, and −1 skips the 2.
Question 2 of 3
Which set of ordered pairs is a function?
Show answer and explanation
Answer: B. In B every input (2, 3, 4) appears once; sharing the output 5 is allowed. A repeats input 1, C repeats input 0, and D repeats input 3, each with different outputs.
Question 3 of 3
Which equation does NOT define y as a function of x?
Show answer and explanation
Answer: D. In x = y2, the input 9 gives y = 3 and y = −3. The others give one y for each x; y = 5 is a horizontal line, a constant function.
Function: frequently asked questions
What is the vertical line test?
It is a quick way to check a graph. Imagine sliding a vertical line across the graph. If it ever crosses the graph more than once, some input has two outputs, so the graph is not a function. A parabola opening up passes; a circle or a sideways parabola fails. A vertical line itself, like x = 4, fails.
What does f(x) mean?
f(x), read f of x, is the output of the function f when the input is x. It replaces y and records the input at the same time. If f(x) = x2 + 1, then f(3) = 10 means input 3, output 10. Other letters work too: g(t), C(n), h(x).
Can two different inputs have the same output?
Yes. A function only forbids one input having two outputs. f(x) = x2 sends both 3 and −3 to 9, and it is a function. A constant function such as f(x) = 5 sends every input to the same output. Functions where no outputs repeat are called one-to-one.
DomainThe domain of a function is the set of all input values (usually x-values) the function can accept. Unless a problem says otherwise, it is every real number except values that would divide by zero or take an even root of a negative number. On a graph, the domain is how far the graph reaches left and right.Functions · Grade 8, Algebra 1, Algebra 2RelationA relation is any set of ordered pairs that links inputs to outputs, such as {(1, 4), (2, 5), (2, 7)}. It can be shown as a list, table, mapping diagram or graph. A relation in which every input has exactly one output is a function; this one is not, because 2 has two outputs.Functions · Grade 8, Algebra 1Ordered PairAn ordered pair is two numbers written to locate a point on the coordinate plane. It is written as (x, y): the x-value comes first, and the y-value comes second. From the origin, move x units across, then y units up or down. The order matters: (2, 5) and (5, 2) are different points.Geometry · Grade 5, Grade 6, Grade 7Independent VariableAn independent variable is an input value that can be chosen or changed. The dependent variable changes based on it. In y = 3x, x is the independent variable and y is the dependent one. On a graph the independent variable goes on the horizontal axis; in an experiment it is the factor you change on purpose.Functions · Grade 6, Grade 7, Grade 8Domain and RangeDomain and range describe a function: the domain is the set of all inputs it accepts, and the range is the set of all outputs it produces. For the points (1, 4) and (2, 5), the domain is {1, 2} and the range is {4, 5}. Restrictions usually come from division by zero or square roots of negatives.Functions · Grade 8, Algebra 1, Algebra 2CircleA circle is the set of all points in a flat plane that are the same distance from one fixed point, the center. That distance is the radius. A segment through the center from edge to edge is the diameter, twice the radius. The distance around is the circumference, 2π r, and the area inside is π r2.Geometry · Kindergarten, Grade 1, Grade 7NumberA number is an amount or value used to count, measure, order and compare. We write numbers with digits (7), words (seven) or other symbols, but the number itself is the amount: 7 dots, the word seven and the numeral 7 all show the same number. Numbers include whole numbers, fractions, decimals and negatives.Number System · Kindergarten, Grade 1, Grade 2Function NotationFunction notation is the way of writing a function as f(x), read “f of x”: f names the function, x is the input, and f(x) is the output. Writing f(x) = 2x + 5 means the same as y = 2x + 5, and f(3) = 11 says that the input 3 gives the output 11.Functions · Grade 8, Algebra 1, Algebra 2Vertical Line TestThe vertical line test is a way to tell from a graph whether it shows a function: if any vertical line crosses the graph more than once, it is not a function. If every vertical line crosses it at most once, each input x has only one output y, so the graph is a function.Functions · Grade 8, Algebra 1, Algebra 2EquationAn equation is a statement that two expressions are equal. It always has an equal sign, such as x + 5 = 12 or 3a = 18. Solving an equation means finding the value of the variable that makes it true: here x = 7 and a = 6. An expression like 4x + 7 has no equal sign, so it is not an equation.Algebra · Grade 6, Grade 7, Grade 8Equal SignThe equal sign (=) is the symbol that shows two expressions have the same value. In 3 + 5 = 2 + 6, both sides equal 8, so the statement is true. The equal sign does not mean “the answer comes next”; it works like a balanced scale, and a number sentence with = is called an equation.Symbols and Notation · Kindergarten, Grade 1, Grade 2Real NumberA real number is any number that can be placed on the number line. The real numbers are all the rational numbers (fractions, integers, terminating and repeating decimals) together with all the irrational numbers (such as √2 and π). Square roots of negative numbers, like √−4, are not real.Number System · Grade 8, Algebra 1ParabolaA parabola is the U-shaped curve that is the graph of a quadratic function such as y = x2. It is symmetric about a line called the axis of symmetry, and its turning point is the vertex. Geometrically, it is every point equally far from a fixed point (the focus) and a fixed line (the directrix).Functions · Algebra 1, Algebra 2, GeometryInputAn input is the value you put into a function or a rule. The rule acts on the input to produce the output: for f(x) = x + 2, the input 5 gives the output 7. For many functions, the input is the x-value. In an input-output table, the inputs fill the first column.Functions · Grade 6, Grade 7, Grade 8VariableA variable is a letter or symbol that represents a number or value, usually one that can change or is not yet known. In n + 5 = 12, the variable n is an unknown that equals 7. In A = lw, the variables l and w can take many values. Any letter can be a variable, not just x.Algebra · Grade 6, Grade 7, Grade 8Linear FunctionA linear function is a function whose graph is a straight line. You can write it as f(x) = mx + b, where m is the slope, or constant rate of change, and b is the y-intercept. Each time x increases by 1, the output changes by the same amount, m.Functions · Grade 8, Algebra 1SlopeSlope is a number that measures how steep a line is: the change in y divided by the change in x between any two points on the line, often called rise over run. A positive slope rises from left to right, a negative slope falls, and a horizontal line has slope 0.Algebra · Grade 8, Algebra 1OutputAn output is the value a function or rule produces from a given input. You put a number in, apply the rule, and the result that comes out is the output. For y = 2x, the input 3 gives the output 6. In an input-output table the output sits in the second column.Functions · Grade 6, Grade 7, Grade 8Dependent VariableA dependent variable is the output value that changes based on the input. It responds to changes in the independent variable: in y = 2x + 1, y is the dependent variable because its value depends on x. On a graph it goes on the vertical axis, because its value depends on what the input was.Functions · Grade 6, Grade 7, Grade 8