Evaluating a function at a number
A rule turns every input into one output. How do you write “the output for this input” in a few symbols, and how do you run the rule forwards and backwards?
Where you are 3 in Function notation
When you reach for it
A function is a rule that gives every allowed input exactly one output (Functions as input-output rules). Once the rule is written as a formula, two questions come up again and again. Forwards: here is an input, what output does the rule give? Backwards: here is an output, which input or inputs give it?
Both questions need a way to say “the output for this input” without a sentence. That is what function notation does: f(5) is the output of the function f when the input is 5. Working it out is called evaluating the function at 5, and it is substituting a number into a formula with a name attached. Running the rule backwards, solving f(x) = 21, turns into an equation of the kind you already solve (Linear equations).
The lesson takes two days. Part 1 (Examples 1 to 4) reads the notation and evaluates at whole numbers, negatives, fractions and simple expressions. Part 2 (Examples 5 to 7) runs the rule backwards and reads the notation in real situations.
The procedure
Reading the notation (Part 1)
Write
and read it “f of x equals 4x minus 7”. It says three things at once: the function is called f; its input is called x; and the output for the input x is 4x - 7, so the rule is “multiply the input by 4, then subtract 7”.
The brackets in f(x) do not mean multiplication. f is not a number; it is the name of a rule, and f(x) is one symbol meaning “the output of f at x”. So f(5), read “f of 5”, is the output when the input is 5. The brackets hold the input, the way an address holds a house number.
The letter x in the rule is only a placeholder for whatever input arrives. f(t) = 4t - 7 is the same function, because it does the same thing to every input. What matters is the rule, not the letter.
Naming functions. Any letter can name a function, and a problem with two rules needs two names, say f and g, so that f(2) and g(2) can be told apart. In a real situation the name is often the first letter of the quantity it gives: C(n) for the cost of n items, h(t) for a height after t seconds. The input letter can be chosen the same way. Within one problem, one name always means one rule.
When the outputs are plotted or listed, they are often written y, as in y = f(x). The notation f(x) keeps more information: f(5) = 13 names the function, the input and the output in one line, where y = 13 has lost the 5.
Evaluating (Part 1)
To find f(5), replace every x in the rule by 5, in brackets, and then work out the value with the Order of operations:
The statement f(5) = 13 says that the input 5 produces the output 13. It is a fact about two numbers, and it is the same fact as the pair (5, 13) in a table of the function.
Why the brackets. Take g(x) = x^2 + 3 and the input -3. With brackets,
because (-3)^2 = (-3)(-3) = 9. Without them, -3^2 + 3 means -(3^2) + 3 = -6, since the order of operations squares before it applies the minus sign. The brackets keep the whole input together as one number, so the rule acts on the input you were given and nothing else. A fraction gets the same protection: \displaystyle g\left(\frac{1}{2}\right) = \left(\frac{1}{2}\right)^2 + 3 = \frac{13}{4}.
An expression as the input. The input can be a short expression, and the move is the same: the whole expression goes in, in brackets, so f(a + 1) = 4(a + 1) - 7 = 4a - 3. Example 4 shows why the position of the +1 matters; the full treatment is evaluating a function at an expression.
Evaluation always gives exactly one answer, as long as the input is one the function accepts. That is the definition of a function at work: one input, one output.
Running the rule backwards (Part 2)
The question “which input gives the output 21?” is written f(x) = 21. Replace f(x) by its rule and the question becomes an equation:
Add 7 to both sides, giving 4x = 28, then divide both sides by 4, giving x = 7. Both moves keep the equation true and can be undone, so 7 is the only input that works. Check by running forwards: f(7) = 4(7) - 7 = 21.
A linear rule f(x) = mx + b with m \neq 0 always gives exactly one input for each output k: the equation mx + b = k has the single solution \displaystyle x = \frac{k - b}{m}, the same rearrangement as in Literal equations: solving for one variable.
A squared rule behaves differently. With g(x) = x^2 + 3, the question g(x) = 28 becomes
and two numbers square to 25, namely 5 and -5 (taking square roots). Both are answers: g(5) = 28 and g(-5) = 28. Each input still has one output; it is the output 28 that is shared by two inputs, which a function allows.
The same rule can also give one answer or none. g(x) = 3 gives x^2 = 0, so only x = 0. g(x) = 0 gives x^2 = -3, and no number squares to a negative, so no input gives the output 0. Since x^2 is never negative, g(x) is never less than 3.
So the two directions are not mirror images. Forwards gives one output. Backwards can give one input, several, or none, and “none” is a full answer, not a failure.
Reading the notation in a real situation (Part 2)
A bakery sells cupcakes at 2.50 dollars each and charges 1.50 dollars for the box they go in. The cost in dollars of a box of n cupcakes is
The statement C(4) = 11.5 reads “a box of four cupcakes costs 11.50 dollars”: the input is a number of cupcakes and the output is a cost, and each keeps its unit. Checking it is an evaluation: 2.5(4) + 1.5 = 10 + 1.5 = 11.5.
Running it backwards answers “how many cupcakes for this cost?” For C(n) = 26.5: 2.5n = 25, so n = 10. For C(n) = 10: 2.5n = 8.5, so \displaystyle n = \frac{17}{5} = 3.4. That is not a whole number, and a number of cupcakes has to be, so no box costs exactly 10 dollars. The situation decides which inputs are allowed, and the algebra has to be read against it. Saying in words what such statements mean is the subject of function notation in a real situation.
Worked examples
Examples 1 to 4 go with Part 1. Examples 5 to 7 go with Part 2.
Whole numbers, a negative and a fraction
Let f(x) = 5x - 8. Find f(4), f(0), f(-3) and \displaystyle f\left(\frac{2}{5}\right).
SolutionEach time, the input replaces x in brackets, and multiplication comes before subtraction.
For f(-3), a positive times a negative is negative, and subtracting 8 moves a further 8 below zero. For the fraction, \displaystyle 5 \cdot \frac{2}{5} = 2:
Notice that f(0) = -8 is just the constant in the rule, since the 5x part is 0 there.
A squared input
Let g(x) = x^2 - 4x. Find g(3), g(-2) and \displaystyle g\left(\frac{1}{2}\right).
SolutionThe input goes into both places where x appears, in brackets each time.
For -2 the brackets matter twice. (-2)^2 = 4, and -4(-2) = 8 because a negative times a negative is positive:
For the fraction, square it and write 2 as \displaystyle \frac{8}{4} to subtract:
Two functions with other names
Let p(t) = 2t^2 + 1 and q(t) = 10 - 4t. Find (a) p(-1), (b) q(4) and (c) p(-1) - q(4). (d) Which is larger, p(2) or q(2), and by how much?
SolutionHere the functions are named p and q and the input is called t. Nothing changes: the input replaces t.
(a) Square first, then multiply by 2, as the order of operations says: p(-1) = 2(-1)^2 + 1 = 2(1) + 1 = 3.
(b) q(4) = 10 - 4(4) = 10 - 16 = -6.
(c) Each name is evaluated at its own input, then the outputs are combined. Subtracting a negative adds:
(d) Both rules get the same input, 2, and the two outputs are compared: p(2) = 2(2)^2 + 1 = 9 and q(2) = 10 - 4(2) = 2. So p(2) is larger, by 7. One input, two different rules, two different outputs: the name in front of the bracket decides which rule runs.
An expression as the input
Let k(x) = 2x + 9. Find and simplify k(a + 1), k(a) + 1, k(2a) and 2k(a).
SolutionWhen the bracket holds an expression, the whole expression is the input.
The first and last use the distributive property to clear the bracket. Where the 1 or the 2 is written matters: inside the bracket it changes the input, outside it changes the output, and the results differ.
A linear rule run backwards
Let f(x) = 5x - 8, the function from Example 1. Solve (a) f(x) = 17 and (b) f(x) = -10.
Solution(a) f(x) = 17 asks which input gives the output 17. Put the rule in place of f(x):
adding 8 to both sides, then dividing both sides by 5. Check: f(5) = 25 - 8 = 17.
(b) The same moves:
The input need not be a whole number. Check: \displaystyle f\left(-\frac{2}{5}\right) = 5\left(-\frac{2}{5}\right) - 8 = -2 - 8 = -10. Since the rule is linear with a non-zero coefficient of x, each output has exactly one input, and there is nothing more to find.
A squared rule: two answers, one, or none
Let r(x) = 2x^2 - 5. Solve (a) r(x) = 45, (b) r(x) = -5 and (c) r(x) = -13.
SolutionIn each part, put the rule in place of r(x), get x^2 on its own, then ask which numbers square to what is left.
(a) 2x^2 - 5 = 45, so 2x^2 = 50 and x^2 = 25. Both 5 and -5 square to 25:
Check the negative one, where the brackets matter: r(-5) = 2(-5)^2 - 5 = 2(25) - 5 = 45.
(b) 2x^2 - 5 = -5, so 2x^2 = 0 and x^2 = 0. Only 0 squares to 0, so x = 0 is the one input.
(c) 2x^2 - 5 = -13, so 2x^2 = -8 and x^2 = -4. No number squares to a negative, so no input gives the output -13.
The three parts fit together: x^2 is never negative, so 2x^2 - 5 is never less than -5, and -5 is exactly where the count of inputs drops from two to one to none.
A dropped sandbag
A sandbag is dropped from a hot-air balloon hovering 125 meters above a field. Ignoring the air, and rounding the pull of gravity to 10 meters per second each second (it is nearer 9.8), its height above the field t seconds after it is let go is about h(t) = 125 - 5t^2 meters. The rule is a model, so its answers are close rather than exact.
(a) Find h(2) and say what it means. (b) When does the sandbag reach the ground? (c) What does h(6) say about the sandbag?
Solution(a) h(2) = 125 - 5(2)^2 = 125 - 20 = 105. Two seconds after it is let go, the sandbag is about 105 meters above the field.
(b) The sandbag is on the ground when its height is 0, so solve h(t) = 0:
So t = 5 or t = -5. The algebra gives both, and the situation picks one: t counts seconds after the sandbag is let go, and the rule says nothing about it before then. The sandbag lands after about 5 seconds.
(c) h(6) = 125 - 5(36) = -55, but that is not a height of the sandbag. It has been lying in the field since t = 5, and the rule only describes the fall. The inputs this function really accepts are the times from 0 to 5 seconds, 0 \le t \le 5, and 6 is not one of them.
Boundaries
The input must be one the function accepts. A formula may give a number for an input the situation rules out, as h(6) did in Example 7, or give nothing at all: \displaystyle \frac{1}{x} has no value at x = 0. Which inputs are allowed is the function’s domain (Domain and range), and it is part of the function, not an afterthought.
f(x) is not f times x. The letter before the bracket names a rule. In particular a function does not, in general, split over a sum: for f(x) = 4x - 7, f(1 + 2) = f(3) = 5 but f(1) + f(2) = -3 + 1 = -2.
One output forwards, any number of inputs backwards. Evaluating gives exactly one output. Solving f(x) = k can give one input, two, many, or none. A linear rule mx + b gives exactly one when m \neq 0. When m = 0 the rule is a constant, such as f(x) = 5: then f(x) = 5 is true for every input and f(x) = 3 for none.
A squared rule: an output below its lowest value never appears. For x^2 + c the outputs are exactly the numbers from c upwards. Every output above c comes from two inputs, c itself from one, and anything below c from none.
Brackets go on every substituted value. A negative or a fraction put into a rule with a power must be bracketed, because (-3)^2 = 9 while -3^2 = -9.
Where this goes next
Evaluating at many inputs fills a table of values, and plotting the pairs draws the function (Graphing a function from a table). Going the other way, the same two questions can be answered from a picture alone, without a formula: reading values off a graph finds f(2) by going up from 2, and solves f(x) = 4 by going across from 4.
Putting whole expressions in for the input, as in Example 4, is its own lesson, and it is the step that later compares outputs at nearby inputs. Saying in words what a statement such as C(12) = 40 claims is function notation in a real situation.
Solving f(x) = 0 is the special case that finds where a graph meets the horizontal axis, the zeros of the function. And when every output comes from exactly one input, running the rule backwards for every output at once gives a new function, the inverse, which undoes the first.
Exercises
Part 1: evaluating
Let f(x) = 7 - 3x and g(x) = x^2 + 2x. Find each value.
- f(2)
- f(-4)
- \displaystyle f\left(\frac{1}{3}\right)
- g(3)
- g(-5)
- \displaystyle g\left(-\frac{1}{2}\right)
- f(0) + g(0)
- Which is larger, f(-2) or g(-2), and by how much?
Part 1: expressions as inputs
With the same f, find and simplify each.
- f(a + 1)
- f(a) + 1
- f(2a)
Part 2: finding the input
With f(x) = 7 - 3x and s(x) = x^2 - 7, solve each equation. If no input works, say so.
- f(x) = 25
- f(x) = 0
- \displaystyle f(x) = -\frac{1}{2}
- s(x) = 29
- s(x) = -7
- s(x) = -11
- s(x) = -2
Part 2: in context
- A plumber charges a call-out fee of 80 dollars plus 55 dollars for each hour of work, so a job of t hours costs P(t) = 55t + 80 dollars. (a) Find P(3) and say what it means. (b) A bill comes to 355 dollars. Solve P(t) = 355 to find how long the job took.
- A seagull drops a shell from 80 meters above the sea. With the same rounding as Example 7, the shell’s height after t seconds is about h(t) = 80 - 5t^2 meters. (a) Find h(1). (b) When is the shell 35 meters above the sea? (c) When does it reach the sea?
- The bakery above has C(n) = 2.5n + 1.5. (a) Say what C(2) = 6.5 claims, and check that it is true. (b) Someone has 20 dollars. Can a box cost exactly 20 dollars? What is the largest number of cupcakes they can buy?
Reasoning
- For f(x) = 7 - 3x, compare f(1 + 2) with f(1) + f(2). Then show that for any numbers a and b, f(a) + f(b) is always 7 more than f(a + b), and explain where the extra 7 comes from.
- Explain why evaluating a function at an allowed input always gives exactly one answer, while solving f(x) = k can give two answers, one, or none. Use s(x) = x^2 - 7 to illustrate all three.
Answers
- f(2) = 1. 7 - 3(2) = 7 - 6 = 1.
- f(-4) = 19. 7 - 3(-4) = 7 + 12 = 19.
- \displaystyle f\left(\frac{1}{3}\right) = 6. \displaystyle 7 - 3\left(\frac{1}{3}\right) = 7 - 1 = 6.
- g(3) = 15. (3)^2 + 2(3) = 9 + 6 = 15.
- g(-5) = 15. (-5)^2 + 2(-5) = 25 - 10 = 15. The same output as g(3), from a different input.
- \displaystyle g\left(-\frac{1}{2}\right) = -\frac{3}{4}. \displaystyle \left(-\frac{1}{2}\right)^2 + 2\left(-\frac{1}{2}\right) = \frac{1}{4} - 1 = -\frac{3}{4}.
- f(0) + g(0) = 7. f(0) = 7 and g(0) = 0.
- f(-2) is larger, by 13. f(-2) = 7 - 3(-2) = 13 and g(-2) = (-2)^2 + 2(-2) = 4 - 4 = 0.
- f(a + 1) = 4 - 3a. 7 - 3(a + 1) = 7 - 3a - 3 = 4 - 3a.
- f(a) + 1 = 8 - 3a. (7 - 3a) + 1 = 8 - 3a, which differs from Exercise 9.
- f(2a) = 7 - 6a. 7 - 3(2a) = 7 - 6a; the whole of 2a is the input.
- x = -6. 7 - 3x = 25, so -3x = 18 and x = -6. Check: f(-6) = 7 + 18 = 25.
- \displaystyle x = \frac{7}{3}. 7 - 3x = 0, so 3x = 7.
- \displaystyle x = \frac{5}{2}. \displaystyle 7 - 3x = -\frac{1}{2}, so \displaystyle 3x = \frac{15}{2} and \displaystyle x = \frac{5}{2}. Check: \displaystyle 7 - \frac{15}{2} = -\frac{1}{2}.
- x = 6 or x = -6. x^2 - 7 = 29, so x^2 = 36.
- x = 0. x^2 - 7 = -7, so x^2 = 0, and only 0 squares to 0.
- No input works. x^2 - 7 = -11 gives x^2 = -4, and no number squares to a negative.
- \displaystyle x = \sqrt{5} or \displaystyle x = -\sqrt{5}. x^2 - 7 = -2, so x^2 = 5.
- (a) P(3) = 245: a 3-hour job costs 245 dollars, since 55(3) + 80 = 165 + 80 = 245. (b) t = 5 hours. 55t + 80 = 355, so 55t = 275 and t = 5.
- (a) h(1) = 75 meters, since 80 - 5(1)^2 = 75. (b) At t = 3 seconds: 80 - 5t^2 = 35 gives 5t^2 = 45, t^2 = 9, and t = -3 is before the drop. (c) At t = 4 seconds: 80 - 5t^2 = 0 gives t^2 = 16, and again only the positive time counts.
- (a) It claims that a box of two cupcakes costs 6.50 dollars. True: 2.5(2) + 1.5 = 5 + 1.5 = 6.5. (b) No: 2.5n + 1.5 = 20 gives \displaystyle n = \frac{37}{5} = 7.4, not a whole number. Each extra cupcake raises the cost, and C(7) = 19 while C(8) = 21.5, so they can buy at most 7 cupcakes.
- f(1 + 2) = f(3) = -2, but f(1) + f(2) = 4 + 1 = 5. In general f(a) + f(b) is (7 - 3a) + (7 - 3b), which is 14 - 3a - 3b, while f(a + b) = 7 - 3(a + b) = 7 - 3a - 3b. The sum of two outputs counts the constant 7 once for each output, and f(a + b) counts it only once, so the difference is always 7.
- A function gives each allowed input exactly one output, so substituting a number and working it out has only one possible result. Solving runs the other way, and nothing stops several inputs from sharing an output, or an output from never appearing. For s(x) = x^2 - 7: s(x) = 9 gives x^2 = 16, two inputs 4 and -4; s(x) = -7 gives only x = 0; and s(x) = -8 gives x^2 = -1, no input at all, because x^2 \ge 0 makes every output at least -7.