What a function promises
Notation, domain and range, read from an equation, a table and a graph.
A vending machine takes a code and hands back one item. Press B4 today and you get a bag of crisps. Press B4 tomorrow and you get a bag of crisps. There is never a moment where B4 gives crisps to one person and chocolate to the next, and there is never a moment where it gives out two things at once.
That reliability is the whole idea behind the word function in mathematics. A function is a rule that takes an input and gives back exactly one output. Not two, not sometimes none. Exactly one, every time you ask.
Here is a rule written as code. Run it and watch six inputs come back paired with their outputs.
Change the rule to 3 * x - 4 and run it again. Which input now comes back as 2?
Six inputs went in and six outputs came out, one apiece. Nothing was skipped and nothing produced a pair of answers. That is what you were promised.
The notation
Mathematics writes that rule almost exactly as the code does.
The letter is the name of the function. The letter inside the brackets is a placeholder for whatever you put in, and it has no value of its own. To use the rule you replace every on the right by the input. So , and .
You will also see used for the output, as in . That is the same rule with the output named instead of the function. When a question says find and you have been given , it is asking for the that goes with .
The reverse question comes up as often. Given the output, which input produced it? Run this and watch the search.
Change 11 to 1, then to 12. One of those prints nothing at all. Why can whole numbers alone miss the answer?
Finding from is solving an equation: , so and . Finding is substituting. Exams ask for both and the words look similar, so read carefully: a value in the brackets means substitute, a value after the equals sign means solve.
Which inputs are allowed
Not every rule accepts every number. Run this one and look at what happens on the last line.
Change the 2 inside x - 2 to 5, and change the last two lines to use 5. A different input becomes the forbidden one.
Every input except 2 gave an ordinary number. The input 2 did not, because it asks the machine to divide by zero, and there is no number that answers that. The rule has nothing to say about 2.
So a function comes with a list of inputs it accepts. 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. For the domain is every real number except 2.
There are only two ways an ordinary formula throws an input out at this stage of the course. Dividing by zero is one. Taking the square root of a negative number is the other, because no real number squares to give something negative. Watch both refuse.
Change the test x < 0 to x < -100 and run it again. The program now tries the impossible one, and you can see exactly which inputs a rule with a square root has to refuse.
The range takes a little more looking at, because it is about what comes out rather than what goes in. Run this and read the smallest output.
Widen the sweep to run from -40 to 40. The largest output grows without limit, but the smallest one does not move. What number is it stuck on, and which input produces it?
Squaring can never give a negative result, so is at least 0 and is at least 3. The range of is every number from 3 upwards. The value 3 is reached, at , so it belongs in the range rather than being merely approached.
The same function, three ways
A function can arrive as a formula, as a table of pairs, or as a graph. All three say the same thing and an exam moves between them without warning.
| Form | What you are given | How to read f(3) |
|---|---|---|
| Equation | Substitute 3 for x and work it out | |
| Table | Rows of inputs beside outputs | Find the row with 3 in the input column |
| Graph | A curve on axes | Go to 3 on the horizontal axis, then read the height |
On a graph the input is the horizontal coordinate and the output is the height, so the point is exactly the statement . Reading a domain off a graph means asking how far left and right the curve goes. Reading a range means asking how far down and up it goes.
A pairing that gives one input two different outputs is not a function. You have already met the machine version of this promise: a dictionary or map keyed by the input cannot hold two values for one key. Run it.
Add table[5] = 12 a second time and run it again. Adding a repeat that agrees changes nothing; it was the disagreement at 3 that destroyed the promise.
The second instruction for 3 overwrote the first, because the structure refuses to hold both. On a graph the same refusal has a picture: if a vertical line ever crosses a curve twice, then one input has two outputs and the curve is not a function. That check is called the vertical line test.
A table lists the pairs (1, 4), (2, 9), (3, 4) and (2, 11). Is it a function?
No. The input 2 appears twice with different outputs, 9 and 11, so the promise is broken. The repeated output 4 for the inputs 1 and 3 is fine: two inputs sharing an output is allowed, and only one input having two outputs is not.