30% off your first 3 months

Get the deal

What a function really is

by DuckyHelperNov 12, 20264 min read
Math

TL;DR:

  • A function gives exactly one output for each allowed input.

  • Domain is the set of allowed inputs, range is the set of outputs that actually occur.

  • f(3) means "put 3 in the machine", not "f times 3".

Type a number into a calculator and press the square root key. For each number you type, you get one answer back. That small behaviour is the whole idea of a function: an input goes in, one output comes out, every time.

The machine picture

Think of a machine with an input slot and an output tray. You feed in a number, the machine follows a fixed rule, and a number drops out. The rule might be "double it and add 1". Write it as f(x) = 2x + 1, where x is the input, and f(x) is the output.

The key promise is that the same input always gives the same output. Feed in 3 today or tomorrow and you get 7 both times. A machine that sometimes gave 7 and sometimes 8 for the same input would not be a function.

Worked example: f(x) = 2x + 1 as a machine

  1. Input 3: f(3) = 2(3) + 1 = 7.

  2. Input 0: f(0) = 2(0) + 1 = 1.

  3. Input −2: f(−2) = 2(−2) + 1 = −4 + 1 = −3.

  4. Input a + 1: f(a + 1) = 2(a + 1) + 1 = 2a + 2 + 1 = 2a + 3.

The notation f(3) is read "f of 3". It does not mean f × 3. The brackets hold the input. Replacing x with the input everywhere, using brackets, avoids sign errors, as in the third line.

You can also run the machine backwards. If the output is 9, solve 2x + 1 = 9: 2x = 8, x = 4. Check: f(4) = 2(4) + 1 = 9. Correct.

Input x

Rule

Output f(x)

−2

2(−2) + 1

−3

0

2(0) + 1

1

3

2(3) + 1

7

4

2(4) + 1

9

The machine f(x) = 2x + 1 on four inputs

One output per input, but not the other way round

A function may send two different inputs to the same output. Take g(x) = x². Both g(2) and g(−2) equal 4. That is fine, because each input still has only one output.

What a function cannot do is send one input to two outputs. The relation y² = x fails: for x = 4, both y = 2 and y = −2 fit. On a graph this shows up as the vertical line test. If any vertical line crosses the graph twice, the graph is not a function of x.

Domain and range

The domain is the set of inputs the rule can accept. The range is the set of outputs that actually occur. For f(x) = 2x + 1, any real number works, so the domain is all real numbers, and every real output occurs, so the range is all real numbers too.

Other rules have limits. For h(x) = 1/x, input 0 would mean dividing by zero, so the domain is every real number except 0. For k(x) = √(x − 3), the number under the root must not be negative, so x − 3 ≥ 0, and the domain is x ≥ 3. Its outputs are never negative, so the range is y ≥ 0.

How to check your answer

  • Substitute carefully. Put brackets around the input before computing, especially for negatives.

  • Reverse check. Run the output back through the equation to recover the input, as we did with 9 and 4.

  • Test the domain. Ask whether any input would cause division by zero or a root of a negative number.

  • Compare with the table. Each input should appear once with one output.

Machines in a row

You can feed one machine's output into another. Let g(x) = x² and keep f(x) = 2x + 1. Then f(g(3)) means: square 3 to get 9, then apply f to get 2(9) + 1 = 19. In the other order, g(f(3)) means: apply f to get 7, then square to get 49. The order changes the answer, which is why f(g(x)) and g(f(x)) are usually different.

Functions also describe real situations. Say a taxi charges a $3 fee plus $2 per kilometre (an invented tariff). Then F(d) = 3 + 2d, and F(5) = 13 dollars. The domain here is d ≥ 0, since a distance cannot be negative. Choosing the domain that makes sense for the story is part of the definition, not an extra.

Common mistakes

  • Reading f(x) as f multiplied by x.

  • Thinking f(x + 1) equals f(x) + 1. For our machine, f(x + 1) = 2x + 3, while f(x) + 1 = 2x + 2. They are different.

  • Confusing domain (inputs) with range (outputs).

  • Believing a function must have a formula. A table of inputs and outputs, or a graph, is also a function if each input appears once.

Where you will use it next

Functions are the objects of algebra, calculus and programming. Next come special families, such as the repeated multiplication in exponent rules and why they follow from counting factors, and pairs of functions that undo each other, such as logarithms and exponents. In programming, a function in code is the same machine, with the same promise about inputs and outputs.

Frequently asked questions

Is every equation a function?

No. y = 2x + 1 defines y as a function of x, but x² + y² = 25 does not, since a given x can have two y values.

Can a function have more than one input?

Yes. The area of a rectangle, A(l, w) = l × w, takes two inputs. This article covers the one-input case.

Get started

DuckyHelper can
do more

It sees your screen and works in any app you use. Try it for 10 minutes, no card.

Get it for Mac, Windows or Linux

Share

Questions and jobs

Do anything

Ask it a question or hand it a job, in any app.

Doing jobs for you is in early access on Mac. Asking works on Mac, Windows and Linux.