This site is a work in progress. New lessons are added regularly. Contact us

What Is a Function?

Learning goals

  • Require exactly one output for each input
  • Read f(3)f(3) as the output at three, not a product
  • Evaluate f(a)f(a) by substituting everywhere and simplifying
  • Apply the vertical line test to a graph
  • State the domain and range, excluding what a rule forbids
  • Show one function as a rule, table, graph or words

A function is a rule with one output for each input

A function is a rule that takes an input, does something definite to it, and hands back exactly one output. The doubling rule is a function: feed it 55 and it returns 1010, feed it 3-3 and it returns 6-6. The doubling rule never leaves any doubt about which number comes out. Everyday rules work the same way. “Assign to each person their exact height right now” is a function, because every person has one height at this moment. Turn that around, though, and consider “assign to each height the person who is that tall.” That rule is not a function, because plenty of different people share a height, so a single input would have many outputs.

That last requirement is the whole heart of the definition, so state it plainly: a function may never send one input to two different outputs. It is perfectly allowed for two different inputs to land on the same output. Squaring sends both 33 and 3-3 to 99, and that is fine, because each input still has a single, definite result. What is forbidden is the reverse, one input branching into two answers.

Here is a rule that breaks the requirement. Consider “send a number to a value whose square equals it.” Give it the input 99 and there are two numbers whose square is 99, namely 33 and 3-3:

32=9and(3)2=9.3^2 = 9 \qquad \text{and} \qquad (-3)^2 = 9.

The input 99 produces two outputs, so this rule is not a function. A function has to make up its mind, one input, one output.

Why a bare yy is not enough

You already have a way to write outputs, the letter yy, so why bother with anything new? Because yy quietly drops two pieces of information you often need.

The first is the name of the rule. Real problems rarely involve a single relationship. You might track a car’s distance, its speed, and its fuel all at once. If every output is just called yy, then three different rules are wearing the same label, and you cannot tell in an equation which yy you mean. Function notation gives each rule its own name. Call one rule ff, another gg, another hh, and now ff, gg, and hh are three distinct machines you can discuss without confusion.

The second is the input that was used. Start from y=2x+1y = 2x + 1 and compute the output when x=3x = 3:

y=2(3)+1=7.y = 2(3) + 1 = 7.

You get y=7y = 7, but the symbol "y=7y = 7" has already forgotten that the input was 33. Compute the output at x=5x = 5 as well and you get a second "y=11y = 11", and nothing in the notation ties either output back to the input that made it. Once a page has several of these, the bookkeeping falls apart.

Function notation fixes both problems in one stroke. Write the same rule as

y=2x+1f(x)=2x+1,y = 2x + 1 \qquad \Longleftrightarrow \qquad f(x) = 2x + 1,

read aloud as ”ff of xx equals 2x+12x + 1.” The letter ff names the rule, and whatever you put in the parentheses is the input. Now the output at 33 is written f(3)f(3), and you can record the whole fact on one line, input and output together:

f(3)=7,f(5)=11.f(3) = 7, \qquad f(5) = 11.

Each statement carries its own input, so no output is ever orphaned. That is the payoff: f(x)f(x) names the rule so several rules can coexist, and f(3)f(3) pins the output to the exact input that produced it.

Reading and evaluating f(x)f(x)

Take the notation apart once so it never trips you up. In f(x)f(x), the letter ff is the name of the function, and the quantity inside the parentheses is the input the rule acts on. The whole symbol f(x)f(x) stands for the output. The name can be any letter that is convenient: ff, gg, and hh are common. And a descriptive letter such as AA for an area or CC for a cost is even better when it reminds you what the rule does.

One warning up front, because it is the most common misread of all. The parentheses in f(x)f(x) do not mean multiplication. f(3)f(3) is not ”ff times 33”; it means “apply the rule ff to the input 33.” There is no hidden product here, only the instruction to run the machine.

To evaluate a function at a particular input, substitute that number for xx everywhere it appears, then simplify. This is exactly the substitution you have done since your first algebra lesson, now wearing a cleaner label.

A function machine turning the input 3 into the output 7The input x equals 3 enters a box labeled f with rule f of x equals 2x plus 1, and the box sends out one output, f of 3 equals 7.inputx = 3ff(x) = 2x + 1outputf(3) = 7
A function as a machine. You drop an input into the rule f, the machine applies it, and exactly one output comes out. Writing f(3) = 7 records both at once: the input 3 that went in, and the output 7 that came out.

Worked example 1 Evaluating f(x)=3x4f(x) = 3x - 4 at several inputs

The rule is “triple the input, then subtract 44.” Substitute each input for xx and simplify.

At x=5x = 5, replace every xx with 55:

f(5)=3(5)4=154=11.f(5) = 3(5) - 4 = 15 - 4 = 11.

At x=0x = 0:

f(0)=3(0)4=04=4.f(0) = 3(0) - 4 = 0 - 4 = -4.

At x=2x = -2, keep the parentheses so the sign is handled correctly:

f(2)=3(2)4=64=10.f(-2) = 3(-2) - 4 = -6 - 4 = -10.

Three inputs, three outputs, and each line records which input produced which output. Notice that f(0)=4f(0) = -4 has nothing to do with the output being zero; the input is 00, and the machine still returns its own answer.

Check your understanding

If g(x)=4x5g(x) = 4x - 5, what is g(2)g(2)?

Answer choices

When a rule is not a function

The definition draws a sharp line: one input, one output. A rule sits on the wrong side of that line the instant a single input is tied to two different outputs. It is worth learning to spot this in the three ways relationships usually appear.

As a set of ordered pairs, a rule is a function when no input value is paired with two different output values. The set {(1,2),(2,4),(3,6)}\{(1, 2), (2, 4), (3, 6)\} is a function, and so is {(1,5),(2,5),(3,5)}\{(1, 5), (2, 5), (3, 5)\}, where every input lands on the same output 55 (repeated outputs are allowed). But {(1,2),(1,5)}\{(1, 2), (1, 5)\} is not a function, because the input 11 is paired with both 22 and 55.

As a table, the same test reads down the input column: if any input appears twice with different outputs beside it, the rule is not a function. As a graph, there is a quick visual version of the test, worth knowing because you have already plotted points and lines in the coordinate plane.

Why the vertical line test works#

Every point on the graph of a rule is an ordered pair (input, output). The input is plotted as the point’s horizontal coordinate, and the output as its vertical coordinate. Fix any single input, say x=ax = a. Every point that shares this input has the same horizontal coordinate aa, so all of them lie on one vertical line, the line x=ax = a. No point with a different input lies on that line. The points of the graph that this vertical line passes through are therefore exactly the outputs the rule assigns to the input aa.

Now apply the definition of a function. The rule is a function precisely when no input has two outputs. In the picture, that means the vertical line x=ax = a can contain at most one point of the graph, for every choice of aa. If some vertical line met the graph in two points, those two points would share the input aa but have different outputs. A single input with two outputs is exactly what a function forbids.

So a graph represents a function if and only if no vertical line crosses it more than once. The test is not a separate rule to memorize; it is the phrase “one output per input” translated into a picture. An input the rule leaves undefined simply has no point above it, which is why a vertical line is allowed to miss the graph entirely.

The vertical line test: one crossing is a function, two is notA rising line crossed once by a vertical line versus a sideways curve crossed twice by a vertical line.a functionnot a function
The vertical line test. On the left, every vertical line meets the graph just once, so each input has a single output and the graph is a function. On the right, a vertical line meets the curve twice, so one input has two outputs and the graph is not a function.

Worked example 2 Deciding whether a rule is a function

Test each relationship against the one rule: does any input have two different outputs?

The set {(2,4),(0,0),(2,4)}\{(-2, 4), (0, 0), (2, 4)\} is a function. The inputs are 2-2, 00, and 22, all different, and each has a single output. The output 44 appears twice, but that is allowed, since it comes from two different inputs.

The table below is not a function:

input xx11222255
output33669988

The input 22 shows up twice with two different outputs, 66 and 99. One input, two outputs, so the relationship fails to be a function:

26and29.2 \mapsto 6 \quad \text{and} \quad 2 \mapsto 9.

Finally, the equation x=y2x = y^2 is not a function of xx. Choose the input x=4x = 4 and solve for the output: y2=4y^2 = 4 gives y=2y = 2 or y=2y = -2, two outputs for one input. A vertical line at x=4x = 4 would cross its graph twice, confirming the same verdict.

Check your understanding

Which set of input-output pairs is NOT a function?

Answer choices

Domain and range

Two more words complete the vocabulary, and both are just names for collections of numbers.

The domain of a function is the set of all inputs it is allowed to take. The range is the set of all outputs it actually produces. Input goes with domain, output goes with range, and you can describe each in plain words without any special symbols.

Most rules built from adding, subtracting, and multiplying accept every number, so their domain is simply “all numbers.” Two situations shrink the domain, and both come from operations you already know cannot be done. Division by zero is undefined, so any input that would make a denominator zero is thrown out. And in this course the square root of a negative number is not a real number, so a square root forces its inside to stay zero or positive. For example, g(x)=1xg(x) = \dfrac{1}{x} has domain “all numbers except 00,” because x=0x = 0 would divide by zero. The square root rule h(x)=xh(x) = \sqrt{x} has domain “all numbers greater than or equal to 00,” because a negative input has no real square root.

The range takes a little more thought, because it depends on what the rule can actually reach. For f(x)=x2f(x) = x^2, every output is a square, and a square is never negative, so the range is “all numbers greater than or equal to 00.” The input xx ranges over every number, but the outputs only ever fill the nonnegative side.

Worked example 3 Finding a domain and a range

Find the domain of f(x)=1x3f(x) = \dfrac{1}{x - 3}, and find the range of g(x)=x2+1g(x) = x^2 + 1.

For the domain of ff, the only danger is a zero denominator. Set the denominator equal to zero to find the forbidden input:

x3=0x=3.x - 3 = 0 \quad \Longrightarrow \quad x = 3.

Every other number is fine, so the domain of ff is “all numbers except 33.”

For the range of gg, start from what x2x^2 can do. Since x20x^2 \ge 0 for every input, adding 11 pushes every output up by one:

g(x)=x2+10+1=1.g(x) = x^2 + 1 \ge 0 + 1 = 1.

The smallest output is 11, reached at x=0x = 0, and the outputs climb without bound from there. So the range of gg is “all numbers greater than or equal to 11.”

Check your understanding

What is the domain of h(x)=1x4h(x) = \dfrac{1}{x - 4}?

Answer choices

Four ways to show the same function

A single function can be presented in four different outfits, and a fluent reader recognizes it in all of them. Take the rule “double the input and add one.” Here it is four ways at once.

As a rule (an equation), it is compact and ready to evaluate:

f(x)=2x+1.f(x) = 2x + 1.

As a table, it lists sample inputs beside their outputs:

input xx1-1001122
f(x)f(x)1-1113355

As a graph, it is the collection of points (x,f(x))(x, f(x)) in the coordinate plane, which for this rule is the straight line you would get from y=2x+1y = 2x + 1. As words, it is the sentence “double the input, then add one.” All four describe the very same pairing of inputs with outputs. The rule and the words tell you how to produce any output, while the table and the graph show you particular ones.

Worked example 4 Turning words into a rule, then reading it back

A rule says “square the input, then subtract 22.” Write it in function notation, then find f(3)f(-3).

Translate the sentence one operation at a time. “Square the input” is x2x^2, and “subtract 22” appends 2- 2:

f(x)=x22.f(x) = x^2 - 2.

Now evaluate at x=3x = -3, substituting carefully:

f(3)=(3)22=92=7.f(-3) = (-3)^2 - 2 = 9 - 2 = 7.

So the words, the rule, and the value f(3)=7f(-3) = 7 are three views of the same function. Going from words to notation is just naming the steps; going from notation to a value is just substitution.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

A function does not have to be a formula. Sometimes it is nothing but a very long list.

In 1938, with work hard to find, a public relief project in New York hired hundreds of people who had none. Their job was arithmetic. Between them they worked out tables of numbers by hand, page after page, for the engineers and scientists who needed them.

Most of the workers had never studied mathematics. Gertrude Blanch, the mathematician who planned the work, dealt with that by splitting each long sum into tiny steps. One group did nothing but add. Another did nothing but subtract. A worker could follow the steps to the letter without knowing what the finished table was for.

What came out of that human factory was a function in its plainest form. Each page carried a column of inputs, and beside every input sat exactly one output. No formula appeared anywhere.

That is the table you met in this lesson, and it lives under a single rule. Read down the input column. If any input turns up twice with two different outputs beside it, the table has stopped describing a function. The vertical line test asks a graph for the same promise, in a picture rather than a list.