Part 1 of 10 · FunctionsSee the whole course

What is a function in math?

Short answer

A function is a rule that gives exactly one output for every input. Put a number in, follow the rule, and you get one answer. Put the same number in again and you get the same answer.

A function is a rule: in, then out

Think of a machine with a slot on the left and a tray on the right. You drop a number in, the machine does the same thing to it every time, and one number comes out.

Here is a machine called f that doubles the number and adds 1. We write the rule as f(x) = 2x + 1. The letter x stands for whatever you put in.

In: 3 → 2 × 3 + 1 → Out: 7
In: 0 → 2 × 0 + 1 → Out: 1
In: −2 → 2 × (−2) + 1 → Out: −3

The numbers that go in are the inputs. The numbers that come out are the outputs. Whatever input you pick, the machine hands back one output, and always the same one for that input.

One function, three ways to see it

A rule is only one view. The same function can be a table, a list of ins and outs:

x: 1, 2, 3
f(x): 3, 5, 7

It can also be a graph: every input and its output become a point, and the points make a trail. The rule, the table and the graph all describe the same function.

How to tell if a graph is a function: the vertical line test

On a graph, the input is how far across you go (x) and the output is how high the graph is (y). A function gives one height for each x. So:

  1. Imagine a vertical line at some x, and slide it across the whole graph.
  2. If it touches the graph once everywhere it can, the graph is a function.
  3. If it ever touches the graph twice or more, that one input has two outputs, so it is not a function.

Try it. Pick a graph, then slide the orange line.

x = 2: 1 point, (2, 4)
Once. One input, one output. So far this is a function.

Example 1: y = x² is a function

The rule y = x² squares the input. Every input gives exactly one output:

In: 2 → Out: 4
In: −2 → Out: 4

Two different inputs (2 and −2) share the output 4, and that is allowed. A function only cares that each input has one output. A vertical line touches this curve once at every x.

Example 2: a circle is not a function

On the circle x² + y² = 25, take the input x = 3. Two heights fit: y = 4 and y = −4, because 3² + 4² = 25 and 3² + (−4)² = 25. One input, two outputs. A vertical line at x = 3 touches the circle twice, so a circle is not a function.

The same happens in a table. If the input 2 is listed with the output 5 in one row and the output 9 in another, the table is not a function.

Watch it explained in under a minute

The same idea, narrated step by step. Square version for sharing: download the 1:1 video.

The five mistakes to avoid

Try it yourself

Is each one a function? Tap a question to see the answer.

1. The pairs (1, 4), (2, 7), (3, 4)

Yes. Each input (1, 2, 3) appears once. The output 4 shows up twice, and that is allowed. A function.

2. The pairs (1, 4), (2, 7), (2, 9)

No. The input 2 has two outputs, 7 and 9. Not a function.

3. f(x) = 3x − 1. What is the output when the input is 5?

3 × 5 − 1 = 15 − 1 = 14.

Where functions fit in

Functions are the starting point of algebra, and everything later is a kind of function: lines, curves, waves, even calculus. Our guide Graphing functions, the game lets you play with the idea. Next in this course: what f(x) means and how to use it.

Quick answers

Questions about this topic

What is a function in simple words?

A function is a rule that takes an input and gives exactly one output. If you put in the same input again, you get the same output again.

What is the difference between a function and an equation?

A function is a rule that turns inputs into outputs. An equation says that two things are equal. An equation like y = 2x + 1 can describe a function, and solving an equation asks which input gives a particular output.

Can two different inputs give the same output?

Yes. For f(x) = x², both 2 and −2 give 4. A function only needs each input to have one output. What it cannot do is give one input two different outputs.

Is a vertical line a function?

No. A vertical line such as x = 3 has one input, 3, but every height goes with it, so that one input has many outputs. It fails the vertical line test.

Keep going

Learn it by playing

Pip: Math Adventure is a math game for iPhone where functions, lines, equations and calculus are puzzles you solve by playing. It is coming soon to the App Store.

Join the list and we will tell you the day Pip is out.