Part 1 of 10 · FunctionsSee the whole course
What is a function in math?
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:
- Imagine a vertical line at some x, and slide it across the whole graph.
- If it touches the graph once everywhere it can, the graph is a function.
- 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.
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 five mistakes to avoid
- Thinking every curve is a function. A circle, and a parabola lying on its side, are not.
- Thinking two inputs sharing an output breaks the rule. It does not: f(2) and f(−2) can both be 4.
- Thinking a function has to be a formula. A table or a graph can be a function too.
- Swapping input and output. The input is what you put in (x). The output is what comes out.
- Testing with horizontal lines. The test uses vertical lines, because the input runs across.
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.