A taxi driver switches on the meter. The longer the trip, the more you pay, and for each distance there is exactly one price. This idea, "each input gives exactly one output", is the heart of the notion of a function. Almost every formula in science, economics and daily life is a function.
What is a function?
A function can be given in several ways: by a formula (f(x)=3x−2), by a table of values, by a graph, or by words ("the price of a trip of x km"). A relation that gives two different outputs for one input is not a function: the circle x2+y2=1 is not the graph of a function, because x=0 gives both y=1 and y=−1. On a graph, this is the vertical line test: no vertical line meets the graph twice.
When a function is given by a formula without any comment, its domain is the set of all real x for which the formula makes sense. Two things to watch: no division by zero, and no square root of a negative number.
Reading a graph
The graph of f(x)=x2−2x−3
From this picture we read, without any calculation:
f(0)=−3, the point where the graph meets the y-axis.
f(x)=0 for x=−1 and x=3 (the zeros of f).
The lowest point is (1,−4), so the range is [−4,+∞).
Going from left to right, the graph goes down until x=1, then up.
So f(x)=x2−2x−3 is decreasing on (−∞,1) and increasing on (1,+∞).
Piecewise functions
Sometimes one formula is not enough: the rule changes with the input. We then write the function in pieces.
A piecewise function
A real-life function: the taxi fare
A taxi charges 15 thousand dong for the first kilometre (or less) and 12 thousand dong for each further kilometre. If the trip is d km long, the fare in thousand dong is
T(d)={1515+12(d−1)if 0<d≤1,if d>1.
Taxi fare T(d)
Key terms
Summary
A function assigns to each x in its domain exactly one value f(x); it can be given by formula, table, graph or words.
Domain of a formula: all x for which it makes sense (denominators =0, square roots of numbers ≥0).
f is increasing on K if x1<x2⇒f(x1)<f(x2), decreasing if f(x1)>f(x2).
A piecewise function uses different formulas on different parts of the domain; always choose the line by the condition.
Practice
Show solutions
f(−1)=3⋅(−1)−2=−5; f(4)=12−2=10.
We need 5−x≥0, so x≤5. D=(−∞,5].
We need x2−4=0, so x=2 and x=−2. D=R∖{−2,2}.
No. The input x=2 has two different outputs, 5 and 6.
Take x1<x2. Then h(x1)−h(x2)=−2x1+2x2=2(x2−x1)>0, so h(x1)>h(x2): decreasing on R.
f(x)=9: if x<0 then x+2=9 gives x=7, which is not <0, rejected. If x≥0 then x2=9 gives x=3 (and x=−3 is rejected). So x=3. f(x)=−1: if x<0, x+2=−1 gives x=−3, valid. If x≥0, x2=−1 is impossible. So x=−3.
B(x)=2x for 0≤x≤50 and B(x)=100+2.5(x−50) for x>50. For 80 kWh: 100+2.5⋅30=175 thousand dong. For a bill of 300>100: 100+2.5(x−50)=300, so x−50=80, x=130 kWh.
(x−2)2≥0, so f(x)≥3, with equality at x=2; every value ≥3 is reached. Range [3,+∞).
We need x+3≥0 and 2−x>0 (the root is in the denominator, so it cannot be 0). So x≥−3 and x<2: D=[−3,2).
f(x)=(x−2)2+3. The vertex x=2 is in [0,3], so the minimum is f(2)=3. At the ends, f(0)=7 and f(3)=4, so the maximum is 7. The function is continuous, so the range is [3,7].