Int 3 for Programmers

Functions, transformations, composition and inverses

11 / 396
Contents

Contents

Int 3 for Programmers

0 of 396 complete

10 min read

Comparing two functions given in different ways

One function as a table, one as an equation, one as a graph, and how to line them up fairly.

Two phone tariffs are rarely advertised the same way. One arrives as a table of monthly bills, the other as a formula printed on a leaflet. The question is still which one is cheaper, and answering it means getting both into a shape you can hold side by side.

The move is not to convert one form into the other, which is slow and often impossible. It is to pull the same short list of numbers out of each form: the starting value, the rate of change, the intercepts, and the highest or lowest output.

Start with two linear rules, one given as a table of pairs and one given as an equation, and get the two numbers that describe a line out of each.

Try CodePython

Change the equation for B to 3 * x + 2 and run it again. The two now climb at the same rate, and B never catches A.

The table climbs by the same 3 every step, so A is linear. It starts at 5 and climbs 3 per step. B starts at 2 and climbs 4 per step. B begins lower and climbs faster, so at some point it must overtake.

Finding where is a question from an earlier lesson. A is 5+3x5 + 3x, since it starts at 5 and adds 3 each step, and B is 4x+24x + 2. Setting them equal gives 5+3x=4x+25 + 3x = 4x + 2, so 5−2=4x−3x5 - 2 = 4x - 3x and x=3x = 3. Both then read 5+9=145 + 9 = 14, and the table confirms A(3)=14A(3) = 14.

What you wantFrom an equationFrom a tableFrom a graph
Starting value f(0)f(0)Put 0 in and work it outRead the row whose input is 0Read the height where the curve crosses the vertical axis
Rate of change from aa to bbWork out f(a)f(a) and f(b)f(b), then divide the change in output by the change in inputSubtract two outputs and divide by the gap between their inputsSlope of the line joining the two points
x-interceptsSolve f(x)=0f(x) = 0Look for a row whose output is 0Where the curve meets the horizontal axis
Largest or smallest outputRewrite as a(x−h)2+ka(x - h)^2 + k and read kkLook for the largest or smallest output in the listRead the height of the turning point
The same four questions, asked of each of the three forms.

A harder pair: an equation against a table

The same four questions work when neither function is a line. Here is a quadratic given by a rule against another given only by its values.

Try CodePython

Change the 8 in P to 3 and run it again. Q now has the greater maximum, and the answer to the comparison flips.

P reaches 8 and Q reaches 4, and both do it at x=1x = 1. So P has the greater maximum, by 4, even though they peak in the same place.

P also falls away faster. From x=1x = 1 to x=3x = 3, P goes from 8 to 0, an average rate of change of 0−83−1=−82=−4\frac{0 - 8}{3 - 1} = \frac{-8}{2} = -4. Over the same stretch Q goes from 4 to 0, a rate of 0−43−1=−42=−2\frac{0 - 4}{3 - 1} = \frac{-4}{2} = -2. P drops twice as fast.

The rule and the table, drawn together
P(x)=−2(x−1)2+8Q(x)=−(x−1)2+4P(x) = -2(x - 1)^2 + 8 \qquad Q(x) = -(x - 1)^2 + 4
-6-22610-2-0.512.54
Q, the one given by the table
PP at the marker
8
QQ at the marker
4
How much taller PP is
4

Slide the marker to x=3x = 3. Both functions hit 0 there, so the third output reads 0 as well, even though P arrived from a much greater height.

The rule −(x−1)2+4-(x-1)^2 + 4 is where Q's table came from. Checking one row is enough to believe it: at x=−2x = -2 the rule gives −(−3)2+4=−9+4=−5-(-3)^2 + 4 = -9 + 4 = -5, which is the value the table lists.

A full comparison, worked

One worked example in full. Function RR is given by the rule R(x)=3x+1R(x) = 3x + 1. Function SS is given by the table below. Which has the greater rate of change, and which is larger at x=10x = 10?

$x$$S(x)$
07
211
415
619
Function S, given only as pairs.
  1. Rate of change of RR. It is linear, so the rate is the coefficient of xx, which is 3. Checking anyway: R(0)=1R(0) = 1 and R(4)=13R(4) = 13, so 13−14−0=124=3\frac{13 - 1}{4 - 0} = \frac{12}{4} = 3.
  2. Rate of change of SS, from the table: S(4)−S(0)4−0=15−74=84=2\frac{S(4) - S(0)}{4 - 0} = \frac{15 - 7}{4} = \frac{8}{4} = 2.
  3. So RR changes faster, 3 per unit against 2 per unit.
  4. Value of RR at 10: R(10)=3×10+1=31R(10) = 3 \times 10 + 1 = 31.
  5. The table stops at 6, so S(10)S(10) has to be worked out from the pattern. The outputs rise by 4 for every step of 2 in the input, which is 2 per unit, and the row at x=0x = 0 gives the starting value 7. So S(x)=2x+7S(x) = 2x + 7.
  6. Checking that rule on another row: S(6)=2×6+7=19S(6) = 2 \times 6 + 7 = 19, which the table agrees with.
  7. Value of SS at 10: S(10)=2×10+7=27S(10) = 2 \times 10 + 7 = 27.
  8. RR is larger at x=10x = 10: 31 against 27.
Function uu has the rule u(x)=−(x−3)2+10u(x) = -(x - 3)^2 + 10. Function vv is drawn as a parabola opening downwards with its highest point at (1,12)(1, 12). Which has the greater maximum, and where does each reach it?

vv does. The rule for uu is already in the form a(x−h)2+ka(x - h)^2 + k with h=3h = 3 and k=10k = 10, and a=−1a = -1 is negative so the curve opens downwards, which makes k=10k = 10 its greatest output, reached at x=3x = 3. The drawing gives vv's greatest output directly as 12, reached at x=1x = 1. So vv peaks higher, by 12−10=212 - 10 = 2, and the two peaks are two units apart along the input axis.

Check yourself

ff is given by f(x)=5x+4f(x) = 5x + 4. gg is given by the table g(0)=9g(0) = 9, g(1)=12g(1) = 12, g(2)=15g(2) = 15. Which is true?

All lessons in Int 3 for Programmers