Solving f(x) = g(x) with graphs and tables
Two rules each turn an input into an output. At which inputs do they give the same output, even when no algebra you know can find them?
Where you are 5 in Graphs of functions
When you reach for it
An equation f(x) = g(x) asks for every input at which two functions give the same output. Often algebra cannot answer that yet: in 2^x = x + 3 the variable sits in an exponent on one side and in a plain sum on the other, and no rearranging gets x on its own. Graphs and tables answer it anyway, exactly when the solutions are tidy numbers and to any accuracy you like when they are not.
Reach for it when the two sides are different kinds of expression, when you want to count the solutions before hunting for them, or when one quantity catches up with another. It extends solving a system by graphing from lines to curves, and asks only for the inputs.
The procedure
Why the meeting points hold the answer
The graph of f is the set of points (a, f(a)) and the graph of g is the set of points (a, g(a)). If a solves f(x) = g(x), those two points are the same point, so the graphs meet above x = a. Conversely, if the graphs meet at (a, b), the point is on the graph of f, so f(a) = b, and on the graph of g, so g(a) = b; then f(a) = g(a) and a is a solution.
The solutions of f(x) = g(x) are exactly the x-coordinates of the points where the graphs of y = f(x) and y = g(x) meet. The y-coordinate of a meeting point is the output the two functions share there. It is not a solution: the equation asks for inputs.
For x^2 = x + 2, the graphs of y = x^2 and y = x + 2 meet at (-1, 1) and (2, 4), so the solutions are x = -1 and x = 2. Substituting confirms them: (-1)^2 = 1 = -1 + 2 and 2^2 = 4 = 2 + 2.
A value read off a graph is only as good as the drawing, so it is a candidate until substituted. If both sides then agree, it is exact; if they nearly agree, the true solution is close by, and the next two ideas pin it down.
From a table
A table of f and g over the same inputs is the graph in numbers, and a row where the outputs agree is a meeting point. When none agrees, look at the difference
It is negative where the graph of f lies below the graph of g, positive where it lies above, and zero exactly at the solutions. If d is negative at one input and positive at the next, the graph of f starts below and ends above, and an unbroken graph cannot do that without meeting the other one in between. So a change of sign in d between two inputs traps a solution between them.
Narrowing by tenths
Once a solution is trapped between two integers, work out d at the tenths between them and find where the sign changes again; then do the same with hundredths. Each round makes the interval ten times shorter, the narrowing used for approximating an irrational number. To round to the nearest tenth, test the midpoint: if the solution lies between 2.4 and 2.5, the sign of d(2.45) says which half it is in.
Worked examples
Reading the solutions off a graph
The figure shows the graphs of f(x) = 6 + 2x - x^2 and g(x) = 2 - x. Solve f(x) = g(x).
The graphs appear to cross at (-1, 3) and (4, -2), so the candidates are x = -1 and x = 4; the y-values 3 and -2 are shared outputs, not answers. A reading could be slightly off, so substitute:
Both pairs agree, so x = -1 and x = 4 are exact solutions. There are no others: collecting everything on one side gives x^2 - 3x - 4 = 0, that is (x + 1)(x - 4) = 0, and by the zero product property only x = -1 and x = 4 make that product zero.
Finding solutions in a table
Make a table of f(x) = x^2 and g(x) = 2x + 5 for the integers from -2 to 4, and locate every solution of f(x) = g(x) in that range.
SolutionWork out both outputs and their difference d(x) = x^2 - (2x + 5).
| x | f(x) | g(x) | d(x) |
|---|---|---|---|
| -2 | 4 | 1 | 3 |
| -1 | 1 | 3 | -2 |
| 0 | 0 | 5 | -5 |
| 1 | 1 | 7 | -6 |
| 2 | 4 | 9 | -5 |
| 3 | 9 | 11 | -2 |
| 4 | 16 | 13 | 3 |
No row has equal outputs, so no solution is an integer. The sign of d changes between x = -2 and x = -1, and again between x = 3 and x = 4, so one solution lies between -2 and -1, and another between 3 and 4.
Could two more hide where d stays negative? No: d(x) = x^2 - 2x - 5 = (x - 1)^2 - 6 is smallest at x = 1 and grows steadily on each side, so it passes through zero once on each side. A table alone cannot show this; it takes the graph or an argument.
Narrowing to the nearest tenth
Find the positive solution of x^2 = 2x + 5 to the nearest tenth, then trap it between two hundredths.
SolutionExample 2 trapped it between 3 and 4. Work out d(x) = x^2 - 2x - 5 at tenths there until the sign changes:
| x | x^2 | 2x + 5 | d(x) |
|---|---|---|---|
| 3.3 | 10.89 | 11.6 | -0.71 |
| 3.4 | 11.56 | 11.8 | -0.24 |
| 3.5 | 12.25 | 12 | 0.25 |
The solution lies between 3.4 and 3.5. Test the midpoint: d(3.45) = 11.9025 - 11.9 = 0.0025, positive, so the parabola has already climbed above the line by 3.45 and the solution lies between 3.4 and 3.45. To the nearest tenth, x \approx 3.4.
One more round: d(3.44) = 11.8336 - 11.88 = -0.0464 is negative, so the solution lies between 3.44 and 3.45. The exact value comes from algebra later: the quadratic formula gives \displaystyle 1 + \sqrt{6} \approx 3.449, and squaring checks it now, since \displaystyle (1 + \sqrt{6})^2 = 7 + 2\sqrt{6} = 2(1 + \sqrt{6}) + 5.
An equation with no algebra method yet
Solve 2^x = x + 3, giving each solution to the nearest tenth.
The graph shows two meetings, one just right of x = -3 and one between x = 2 and x = 3. There are none outside the picture. Left of x = -3 the line is below the x-axis while 2^x is always positive. Right of x = 3, where 2^x = 8 already exceeds x + 3 = 6, each step of 1 doubles 2^x but adds only 1 to x + 3, so the curve stays above.
The difference d(x) = 2^x - (x + 3) at the integers confirms the two sign changes:
| x | 2^x | x + 3 | d(x) |
|---|---|---|---|
| -3 | 0.125 | 0 | 0.125 |
| -2 | 0.25 | 1 | -0.75 |
| -1 | 0.5 | 2 | -1.5 |
| 0 | 1 | 3 | -2 |
| 1 | 2 | 4 | -2 |
| 2 | 4 | 5 | -1 |
| 3 | 8 | 6 | 2 |
Now narrow each, with 2^x from a calculator to three decimal places.
On the right, d(2.4) = 5.278 - 5.4 = -0.122 and d(2.5) = 5.657 - 5.5 = 0.157. The midpoint gives d(2.45) = 5.464 - 5.45 = 0.014, positive, so the solution lies between 2.4 and 2.45.
On the left, d(-2.9) = 0.134 - 0.1 = 0.034 and d(-2.8) = 0.144 - 0.2 = -0.056. The midpoint gives d(-2.85) = 0.139 - 0.15 = -0.011, negative, so the solution lies between -2.9 and -2.85.
The solutions are x \approx -2.9 and x \approx 2.4. These only nearly balance the sides, as 2^{2.4} \approx 5.28 against 5.4 shows, and no method in school algebra gives them exactly.
Counting the meetings
How many solutions does each equation have: x^2 = x + 2, x^2 = 2x - 1 and x^2 = x - 2?
Each pits the parabola y = x^2 against a line, and the number of solutions is the number of meeting points.
The line y = x + 2 crosses the parabola at x = -1 and x = 2. Two solutions.
The line y = 2x - 1 touches the parabola at (1, 1) and lies below it elsewhere. One solution, x = 1. Algebra agrees: d(x) = x^2 - (2x - 1) = (x - 1)^2 is zero only at x = 1 and never negative, so its sign never changes; a table that skipped x = 1 would miss this solution.
The line y = x - 2 lies below the parabola everywhere. No solution. Algebra agrees: \displaystyle x^2 - (x - 2) = \left(x - \frac{1}{2}\right)^2 + \frac{7}{4} is at least \displaystyle \frac{7}{4}, so never zero. The discriminant later counts such solutions without a picture.
When one savings plan overtakes another
Sidonie puts 1000 dollars into an account that adds 6\% at the end of each year, so after t years she has S(t) = 1000(1.06)^t dollars. Torvald starts with 1200 dollars and adds 40 dollars at the end of each year, so he has T(t) = 1200 + 40t dollars. Between which two years does the solution of S(t) = T(t) lie, and at the end of which year does Sidonie first have more?
SolutionMultiplying by 1.06 is how a 6\% increase works (the multiplier for a percent change). Tabulate both, in dollars rounded to the cent:
| t | S(t) | T(t) | S(t) - T(t) |
|---|---|---|---|
| 5 | 1338.23 | 1400 | -61.77 |
| 6 | 1418.52 | 1440 | -21.48 |
| 7 | 1503.63 | 1480 | 23.63 |
The difference starts at -200 when t = 0, climbs but is still negative at t = 6, and changes sign between t = 6 and t = 7, so the solution of S(t) = T(t) lies between 6 and 7, and Sidonie is ahead at the end of year 7. She stays ahead: from then on 6\% of her balance is over 90 dollars a year, against Torvald’s 40.
The money changes only once a year, so the balances are never actually equal; the solution marks the year in which the lead changes hands.
Boundaries
- A value read from a graph is approximate. It is a solution only once substitution makes both sides equal.
- A change of sign traps a solution only when both graphs are unbroken between the two inputs. For \displaystyle f(x) = \frac{1}{x} and g(x) = 0, the difference is -1 at x = -1 and 1 at x = 1, yet \displaystyle \frac{1}{x} is never 0: its graph breaks at x = 0, where it has no value.
- No change of sign does not mean no solution. A graph that touches without crossing (Example 5) keeps d on one side of zero, and two crossings between neighboring table inputs cancel out in the signs.
- A table or graph covers only the inputs it shows. A claim about the whole number line needs an argument, as in Example 4.
- In a situation only sensible inputs count: whole years for yearly interest, distances between the throw and the landing for a ball.
- Narrowing gives as many decimal places as you will work for, but never an exact value such as \displaystyle 1 + \sqrt{6}.
Where this goes next
The difference d(x) turns every such equation into finding where one graph meets the x-axis, the subject of roots, zeros and x-intercepts. For a quadratic against a line, factoring and the quadratic formula give exact answers, and systems with a curve asks for both coordinates of each meeting point. The sign-change argument becomes the intermediate value theorem, and narrowing grows into the bisection method computers use. For equations like 2^x = x + 3 it stays the tool even after exponential functions.
Exercises
Reading meeting points
- The graphs of f(x) = x^2 + 3x - 4 and g(x) = x - 1 meet at (-3, -4) and (1, 0). Solve f(x) = g(x), and check both solutions by substitution.
- Which of x = -1, x = 1, x = 2 and x = 4 are solutions of x^2 = 3x - 2? Give the points where the graphs of y = x^2 and y = 3x - 2 meet.
- Make a table of p(x) = 2^x and q(x) = 2x for x = 0, 1, 2, 3, 4. Find the two points where the graphs meet, and the solutions of 2^x = 2x.
- The graphs of y = f(x) and y = g(x) meet at exactly two points, (-2, 3) and (4, 3). Vaughn says the solution of f(x) = g(x) is 3. Give the solutions and say what the 3 is.
Locating solutions in a table
- Make a table of f(x) = x^2 - 5x + 3 and g(x) = x - 2 for the integers from 0 to 6, and solve f(x) = g(x).
- Using a table of f(x) = x^2 and g(x) = x + 5 for the integers from -3 to 4, find each pair of consecutive integers between which a solution of f(x) = g(x) lies.
- Using a table of f(x) = 3^x and g(x) = x + 4 for the integers from -4 to 2, find each pair of consecutive integers between which a solution of 3^x = x + 4 lies. (Recall \displaystyle 3^{-4} = \frac{1}{81}.)
- For two unbroken graphs, d(x) = f(x) - g(x) takes the values 5, 2, -1, -1, 2, 6 at x = 0, 1, 2, 3, 4, 5. Between which inputs must solutions of f(x) = g(x) lie?
Narrowing by tenths
- Find the positive solution of x^2 = x + 5 to the nearest tenth.
- Find the positive solution of 3^x = x + 4 to the nearest tenth.
- Ulyana throws a ball from the foot of a straight ramp. At a horizontal distance of x meters the ball is h(x) = -0.1x^2 + 1.2x + 3 meters high and the ramp’s surface is r(x) = 0.4x meters high. To the nearest tenth of a meter, at what horizontal distance does the ball land on the ramp?
- In a lab, culture A has a mass of A(t) = 800(1.05)^t milligrams after t days, growing 5\% a day, while culture B has B(t) = 1000 + 20t milligrams, gaining 20 milligrams a day. Between which two whole days do the masses become equal, and on which whole day is culture A first the heavier?
How many solutions
- How many solutions does x^2 = 4x - 4 have? Find them, and describe how the line meets the parabola.
- How many solutions does x^2 = x - 1 have? Justify your answer.
- How many solutions does 2^x = -x have? Locate each between consecutive integers and explain why there are no more.
Reasoning
- Explain why the y-coordinate of a point where the graphs of f and g meet is not a solution of f(x) = g(x), and what it tells you instead.
- Ignatius works out d(x) = x^2 - (3x - 2.2) at x = 0, 1, 2, 3, finds every value positive, and concludes that x^2 = 3x - 2.2 has no solution. Show that he is wrong by working out d(1.5), and say how many solutions lie between 1 and 2.
- Marisol notices that \displaystyle f(x) = \frac{1}{x - 2} is -1 at x = 1 and 1 at x = 3, and claims that \displaystyle \frac{1}{x - 2} = 0 has a solution between 1 and 3. Explain what is wrong.
- Explain why the solutions of x^2 = x + 2 are the x-values where the graph of y = x^2 - x - 2 meets the x-axis, and say what changes in the picture and what does not.
Answers
- x = -3 and x = 1. Check: f(-3) = 9 - 9 - 4 = -4 = g(-3) and f(1) = 1 + 3 - 4 = 0 = g(1).
- x = 1 and x = 2. At x = -1 the sides are 1 and -5; at x = 4 they are 16 and 10. The graphs meet at (1, 1) and (2, 4).
- x = 1 and x = 2, with meeting points (1, 2) and (2, 4): the outputs 1, 2, 4, 8, 16 and 0, 2, 4, 6, 8 agree only there.
- x = -2 and x = 4. The 3 is the shared output, f(-2) = g(-2) = 3 and f(4) = g(4) = 3; nothing says f(3) = g(3).
- x = 1 and x = 5, the only rows where the outputs agree: both are -1, then both 3.
- d(x) = x^2 - x - 5 is 7, 1, -3, -5, -5, -3, 1, 7 at x = -3 to 4, so solutions lie between -2 and -1, and between 2 and 3.
- d(x) = 3^x - x - 4 has \displaystyle d(-4) = \frac{1}{81} > 0, \displaystyle d(-3) = \frac{1}{27} - 1 < 0, stays negative through d(1) = -2, and d(2) = 3. Solutions lie between -4 and -3, and between 1 and 2.
- Between 1 and 2 (from 2 to -1) and between 3 and 4 (from -1 to 2).
- x \approx 2.8. With d(x) = x^2 - x - 5: d(2.7) = -0.41, d(2.8) = 0.04, and d(2.75) = -0.1875, so the solution lies between 2.75 and 2.8.
- x \approx 1.6. With d(x) = 3^x - x - 4: d(1.5) = -0.304, d(1.6) = 0.200 and d(1.55) = -0.060, so the solution lies between 1.55 and 1.6.
- About 10.8 meters. With d(x) = h(x) - r(x) = -0.1x^2 + 0.8x + 3: d(10) = 1, d(11) = -0.3, d(10.7) = 0.111, d(10.8) = -0.024 and d(10.75) = 0.04375, so the landing is between 10.75 and 10.8. The other solution is negative, behind the throw.
- Between days 7 and 8; culture A is first heavier on day 8. A(7) = 1125.68 against B(7) = 1140, and A(8) = 1181.96 against B(8) = 1160. After that A gains over 59 milligrams a day against B’s 20.
- One solution, x = 2. x^2 - (4x - 4) = (x - 2)^2 is zero only at x = 2, so the line touches the parabola at (2, 4) and lies below it elsewhere.
- None. \displaystyle x^2 - (x - 1) = \left(x - \frac{1}{2}\right)^2 + \frac{3}{4} is at least \displaystyle \frac{3}{4}, so the line never reaches the parabola.
- One solution, between -1 and 0 (about -0.6). d(x) = 2^x + x gives d(-1) = 0.5 - 1 = -0.5 and d(0) = 1. Both 2^x and x grow as x increases, so d rises the whole way and passes zero once.
- The equation asks for inputs that make the outputs equal. A meeting point (a, b) says the input a gives both functions the output b, so a is the solution and b is the common value f(a) = g(a). Putting x = b in generally gives two different outputs.
- d(1.5) = 2.25 - 4.5 + 2.2 = -0.05, negative, while d(1) = 0.2 and d(2) = 0.2 are positive. The sign changes between 1 and 1.5 and again between 1.5 and 2, so two solutions lie between 1 and 2. His table stepped over the dip.
- The sign-change argument needs an unbroken graph, and \displaystyle y = \frac{1}{x - 2} breaks at x = 2, where it has no value; it jumps from negative to positive without passing 0. In fact \displaystyle \frac{1}{x - 2} = 0 has no solution, since multiplying by x - 2 would give 1 = 0.
- Subtracting x + 2 from both sides gives x^2 - x - 2 = 0 and keeps the same solutions. That asks where y = x^2 - x - 2 meets y = 0, the x-axis. The meeting points move from (-1, 1) and (2, 4) to (-1, 0) and (2, 0): the y-values change, the x-values, which are the solutions, do not.