Lemonmath
Tiếng Việt

Functions

Lesson 6.1 · 20 min read · Updated

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−2f(x)=3x-2), by a table of values, by a graph, or by words ("the price of a trip of xx km"). A relation that gives two different outputs for one input is not a function: the circle x2+y2=1x^2+y^2=1 is not the graph of a function, because x=0x=0 gives both y=1y=1 and y=−1y=-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 xx 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

-3-2-112345-4-2246xyO(-1, 0)(3, 0)(0, -3)(1, -4)
The graph of f(x)=x2−2x−3f(x)=x^2-2x-3

From this picture we read, without any calculation:

  • f(0)=−3f(0)=-3, the point where the graph meets the yy-axis.
  • f(x)=0f(x)=0 for x=−1x=-1 and x=3x=3 (the zeros of ff).
  • The lowest point is (1,−4)(1, -4), so the range is [−4,+∞)[-4, +\infty).
  • Going from left to right, the graph goes down until x=1x=1, then up.

So f(x)=x2−2x−3f(x)=x^2-2x-3 is decreasing on (−∞,1)(-\infty, 1) and increasing on (1,+∞)(1, +\infty).

Piecewise functions

Sometimes one formula is not enough: the rule changes with the input. We then write the function in pieces.

-4-3-2-1123-2-1123456xyO(0, 2)O
A piecewise function

A real-life function: the taxi fare

A taxi charges 1515 thousand dong for the first kilometre (or less) and 1212 thousand dong for each further kilometre. If the trip is dd km long, the fare in thousand dong is T(d)={15if 0<d≤1,15+12(d−1)if d>1.T(d)=\begin{cases}15 & \text{if } 0<d\le 1,\\ 15+12(d-1) & \text{if } d>1.\end{cases}

1234561020304050607080xyO(1, 15)
Taxi fare T(d)T(d)

Key terms

Summary

  • A function assigns to each xx in its domain exactly one value f(x)f(x); it can be given by formula, table, graph or words.
  • Domain of a formula: all xx for which it makes sense (denominators ≠0\ne0, square roots of numbers ≥0\ge0).
  • ff is increasing on KK if x1<x2⇒f(x1)<f(x2)x_1<x_2\Rightarrow f(x_1)<f(x_2), decreasing if f(x1)>f(x2)f(x_1)>f(x_2).
  • A piecewise function uses different formulas on different parts of the domain; always choose the line by the condition.

Practice

Show solutions
  1. f(−1)=3⋅(−1)−2=−5f(-1)=3\cdot(-1)-2=-5; f(4)=12−2=10f(4)=12-2=10.
  2. We need 5−x≥05-x\ge0, so x≤5x\le5. D=(−∞,5]D=(-\infty, 5].
  3. We need x2−4≠0x^2-4\ne0, so x≠2x\ne2 and x≠−2x\ne-2. D=R∖{−2,2}D=\mathbb{R}\setminus\{-2, 2\}.
  4. No. The input x=2x=2 has two different outputs, 55 and 66.
  5. Take x1<x2x_1<x_2. Then h(x1)−h(x2)=−2x1+2x2=2(x2−x1)>0h(x_1)-h(x_2)=-2x_1+2x_2=2(x_2-x_1)>0, so h(x1)>h(x2)h(x_1)>h(x_2): decreasing on R\mathbb{R}.
  6. f(x)=9f(x)=9: if x<0x<0 then x+2=9x+2=9 gives x=7x=7, which is not <0<0, rejected. If x≥0x\ge0 then x2=9x^2=9 gives x=3x=3 (and x=−3x=-3 is rejected). So x=3x=3. f(x)=−1f(x)=-1: if x<0x<0, x+2=−1x+2=-1 gives x=−3x=-3, valid. If x≥0x\ge0, x2=−1x^2=-1 is impossible. So x=−3x=-3.
  7. B(x)=2xB(x)=2x for 0≤x≤500\le x\le50 and B(x)=100+2.5(x−50)B(x)=100+2.5(x-50) for x>50x>50. For 8080 kWh: 100+2.5⋅30=175100+2.5\cdot30=175 thousand dong. For a bill of 300>100300>100: 100+2.5(x−50)=300100+2.5(x-50)=300, so x−50=80x-50=80, x=130x=130 kWh.
  8. (x−2)2≥0(x-2)^2\ge0, so f(x)≥3f(x)\ge3, with equality at x=2x=2; every value ≥3\ge3 is reached. Range [3,+∞)[3, +\infty).
  9. We need x+3≥0x+3\ge0 and 2−x>02-x>0 (the root is in the denominator, so it cannot be 00). So x≥−3x\ge-3 and x<2x<2: D=[−3,2)D=[-3, 2).
  10. f(x)=(x−2)2+3f(x)=(x-2)^2+3. The vertex x=2x=2 is in [0,3][0, 3], so the minimum is f(2)=3f(2)=3. At the ends, f(0)=7f(0)=7 and f(3)=4f(3)=4, so the maximum is 77. The function is continuous, so the range is [3,7][3, 7].