What Is a Function?

Learning goals

  • Require exactly one output for each allowed input
  • Read and evaluate function notation such as f(3)f(3) and f(a)f(a)
  • Apply the vertical line test to a graph
  • State the domain and range of a simple rule
  • Show one function as a rule, table, graph or words

A function is a rule with one output for each allowed input

A function is a rule that takes an input, does something definite to it, and hands back exactly one output for every input it allows. 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, since every person has one height at this moment, but “assign to each height the person who is that tall” is not, since many different people can share a height.

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 function notation?

You already have a way to write outputs, the letter yy. Function notation adds two things a bare yy leaves out: which rule produced the output, and which input was used.

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 an equation cannot say which yy it means. Function notation fixes this by naming the rule. Write y=f(x)y = f(x) to say ”ff is the name of the rule, and yy is the output it produces.” For the rule y=2x+1y = 2x + 1, this becomes

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

read aloud as ”ff of xx equals 2x+12x + 1.” Different letters name different rules, so ff, gg, and hh can sit on the same page as three distinct machines.

Function notation also keeps the input attached to its output. Compute the output of ff at x=3x = 3 and at x=5x = 5:

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

Each statement carries its own input, so the output 77 is never separated from the input 33 that made it. That is the payoff: ff names the rule, so several rules can appear on the same page without confusion, and f(3)f(3) pins an 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.

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.

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.

Worked example 1 Evaluating f(x)=3x−4f(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=15−4=11.f(5) = 3(5) - 4 = 15 - 4 = 11.

At x=0x = 0:

f(0)=3(0)−4=0−4=−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=−6−4=−10.f(-2) = 3(-2) - 4 = -6 - 4 = -10.

The same substitution works even when the input is a letter instead of a number. At x=ax = a, replace every xx with aa and simplify only what can be simplified:

f(a)=3a−4.f(a) = 3a - 4.

Nothing combines further, because aa stands for a number that has not been chosen yet, but the steps are identical to the three above: replace xx, then simplify.

Four inputs, four 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)=4x−5g(x) = 4x - 5, what is g(2)g(2)?

Answer choices

Check your understanding

If g(x)=4x−5g(x) = 4x - 5, what is g(a)g(a)?

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.

Every point on a graph is an input paired with its output: the input is the point’s horizontal position, the output its vertical position. A vertical line fixes one horizontal position, so it fixes one input, and every point where that line touches the graph is an output for that input. If the line touches the graph twice, that one input has two different outputs, exactly what a function forbids. If it touches once, the input has exactly one output, and if it misses the graph entirely, that input simply is not in the domain.

Graph A and Graph B, each crossed by a dashed vertical lineGraph A is a rising straight line crossed by a dashed vertical line. Graph B is a sideways curve that opens to the right, crossed by a dashed vertical line.Graph AGraph B
Two graphs, Graph A and Graph B, each crossed by a dashed vertical line. Count how many points the dashed line touches on each graph, then use the vertical line test to decide whether that graph is a function.

Check your understanding

Look at Graph B above, on the right. Find where its dashed vertical line meets the curve. Based on the vertical line test, is Graph B a function, and why?

Answer choices

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:

2↦6and2↦9.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. In this lesson, “number” means a real number, the kind you already plot on a number line.

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 no output can be below 00. Every nonnegative number is reached too: to land exactly on some target r≥0r \ge 0, use the input x=rx = \sqrt{r}, since (r)2=r(\sqrt{r})^2 = r. So the range is “all numbers greater than or equal to 00,” the lower bound and every value above it, both accounted for.

Worked example 3 Finding a domain and a range

Find the domain of f(x)=1x−3f(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:

x−3=0⟹x=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 x2≥0x^2 \ge 0 for every input, adding 11 pushes every output up by one:

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

A table of sample values shows the pattern; the smallest entry is 11, at x=0x = 0:

xx−2-2−1-1001122
g(x)g(x)5522112255

No output can fall below 11. And every number r≥1r \ge 1 is actually reached: solve x2+1=rx^2 + 1 = r for xx, which gives x=r−1x = \sqrt{r - 1}, a real number precisely because r−1≥0r - 1 \ge 0. So the range of gg is “all numbers greater than or equal to 11,” with a reason for both halves of that claim.

Check your understanding

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

Answer choices

Check your understanding

What is the range of k(x)=x2+4k(x) = x^2 + 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 xx−1-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; the table shows a handful of sample pairs, while the graph pictures every pair the function has, over whatever stretch of inputs is drawn.

Check your understanding

A rule sends 1↦31 \mapsto 3, 2↦52 \mapsto 5, and 3↦73 \mapsto 7. Which equation matches this rule?

Answer choices

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)=x2−2.f(x) = x^2 - 2.

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

f(−3)=(−3)2−2=9−2=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.

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems 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.

Go deeper (optional)

You can skip this and keep going. Read it if you want to know more.

A closer look at why the vertical line test works

A closer look at 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.

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.