Curve sketching¶
Change and motion · level 8, lesson 3 of 7
A question to start¶
Here is a table of values for \(f(x) = x^4 - 4x^3 + 10\):
| \(x\) | \(-1\) | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|---|
| \(f(x)\) | 15 | 10 | 7 | \(-6\) | \(-17\) | 10 |
Join the dots and you get a curve that slides steadily downhill to a lowest point near \(x = 3\), then shoots up. Is that the whole story?
No. At \(x = 0\) the graph goes perfectly flat for an instant, like a step on a staircase, and then carries on down. And the way it bends changes twice, at \(x = 0\) and at \(x = 2\). Not one of these features can be seen in the table. Plotting points shows you where the graph is; derivatives tell you what it does between the points. This lesson puts everything together into a method for sketching a graph with every important feature in the right place.
The idea¶
Going up and going down¶
A function is increasing on an interval if its values go up as \(x\) goes right, and decreasing if they go down. The first derivative tells you which:
- if \(f'(x) > 0\) on an interval, \(f\) is increasing there;
- if \(f'(x) < 0\) on an interval, \(f\) is decreasing there.
This is very believable (positive slope means going up), and it can be proved from a fact called the mean value theorem: between any two points, the secant's slope equals the tangent's slope at some point in between. So if every tangent slope is positive, every secant slope is positive, and the function goes up. The theorem itself is on the U of T shelf.
Critical points and the first derivative test¶
A local maximum is a point higher than all its near neighbours (a hilltop); a local minimum is lower than its neighbours (a valley bottom). At a smooth hilltop or valley the tangent must be flat. So the candidates are the critical points: the values of \(x\) where \(f'(x) = 0\) or \(f'(x)\) does not exist.
Not every critical point is a hill or valley (think of \(x^3\) at 0). To decide, check the sign of \(f'\) on each side. This is the first derivative test:
| Sign of \(f'\): left, then right | What \(f\) has at \(c\) |
|---|---|
| \(+\) then \(-\) | a local maximum |
| \(-\) then \(+\) | a local minimum |
| same sign on both sides | neither: a flat moment on the way up or down |
Concavity: which way the graph bends¶
The second derivative \(f''\) tells you how the slope is changing.
- If \(f''(x) > 0\), the slope is increasing: the graph bends upwards, like a cup. This is called concave up. Every tangent lies below the curve.
- If \(f''(x) < 0\), the slope is decreasing: the graph bends downwards, like a cap: concave down. Every tangent lies above the curve.
A point where the concavity changes (from cup to cap or back) is an inflection point. There \(f'' = 0\) or does not exist, and the sign of \(f''\) changes. At an inflection point the graph crosses its own tangent line.
Concavity gives a quicker test for a critical point, the second derivative test: if \(f'(c) = 0\) and \(f''(c) > 0\), the graph is a cup at \(c\), so \(c\) is a local minimum; if \(f''(c) < 0\), a cap, so a local maximum. If \(f''(c) = 0\), the test says nothing, and you go back to the first derivative test.
Asymptotes¶
For rational functions (fractions of polynomials) look for lines the graph approaches:
- a vertical asymptote \(x = a\) where the bottom is 0 and the top is not: the function blows up there (level 7, lesson 1);
- a horizontal asymptote \(y = L\) if \(f(x) \to L\) as \(x \to \infty\) or \(x \to -\infty\). To find it, divide top and bottom by the highest power of \(x\) on the bottom.
The checklist¶
- Domain: where is \(f\) defined?
- Intercepts: \(f(0)\), and where \(f(x) = 0\) if you can solve it.
- Symmetry: is \(f(-x) = f(x)\) (mirror in the \(y\)-axis) or \(f(-x) = -f(x)\) (half-turn about the origin)?
- Asymptotes: vertical and horizontal.
- First derivative: critical points, a sign table, increasing and decreasing intervals, local maxima and minima.
- Second derivative: a sign table, concavity, inflection points.
- Plot the special points, draw the asymptotes, and join them with the right shapes.
Worked examples¶
1. A cubic. Sketch \(f(x) = x^3 - 3x^2 - 9x + 5\).
- Domain: all \(x\). \(y\)-intercept: \(f(0) = 5\). No simple symmetry, no asymptotes (a polynomial).
- \(f'(x) = 3x^2 - 6x - 9 = 3(x + 1)(x - 3)\). Critical points \(x = -1\) and \(x = 3\).
- Signs of \(f'\): positive for \(x < -1\), negative for \(-1 < x < 3\), positive for \(x > 3\). So a local maximum at \(x = -1\), with \(f(-1) = -1 - 3 + 9 + 5 = 10\), and a local minimum at \(x = 3\), with \(f(3) = 27 - 27 - 27 + 5 = -22\).
- \(f''(x) = 6x - 6\): negative for \(x < 1\) (cap), positive for \(x > 1\) (cup). Inflection point at \(x = 1\), with \(f(1) = 1 - 3 - 9 + 5 = -6\).
- Check with the second derivative test: \(f''(-1) = -12 < 0\), a maximum ✓; \(f''(3) = 12 > 0\), a minimum ✓.
Every cubic with two turning points looks like this, and its inflection point is always exactly halfway between them (here \(1\) is halfway between \(-1\) and \(3\)). The cubic is symmetric under a half-turn about that point.
2. A rational function. Sketch \(f(x) = \dfrac{x^2}{x^2 - 4}\).
- Domain: all \(x\) except \(\pm 2\). Intercept: \(f(0) = 0\), and \(f(x) = 0\) only at \(x = 0\).
- Symmetry: \(f(-x) = f(x)\), so the graph is a mirror image in the \(y\)-axis.
- Vertical asymptotes \(x = 2\) and \(x = -2\) (bottom 0, top 4). Horizontal: divide by \(x^2\): \(f(x) = \dfrac{1}{1 - 4/x^2} \to 1\) as \(x \to \pm\infty\). So \(y = 1\).
- Quotient rule: \(f'(x) = \dfrac{2x(x^2 - 4) - x^2 \cdot 2x}{(x^2 - 4)^2} = \dfrac{-8x}{(x^2 - 4)^2}\). The bottom is never negative, so \(f'\) has the sign of \(-8x\): increasing for \(x < 0\), decreasing for \(x > 0\) (apart from the breaks at \(\pm 2\)). Local maximum at \((0, 0)\).
- \(f''(x) = \dfrac{8(3x^2 + 4)}{(x^2 - 4)^3}\) (quotient rule again, then simplify). The top is always positive, so the sign is that of \((x^2 - 4)^3\): concave up for \(|x| > 2\), concave down for \(|x| < 2\). No inflection points (the concavity only changes across the asymptotes, where \(f\) is not defined).
- Behaviour near the asymptotes: just right of 2, the top is about 4 and the bottom a small positive number, so \(f \to +\infty\); just left of 2 the bottom is small and negative, so \(f \to -\infty\). Far out, \(f\) is slightly above 1 (the bottom is smaller than the top).
3. The opening question. For \(f(x) = x^4 - 4x^3 + 10\):
- \(f'(x) = 4x^3 - 12x^2 = 4x^2(x - 3)\). Critical points \(x = 0\) and \(x = 3\).
- Since \(4x^2 \ge 0\), \(f'\) has the sign of \(x - 3\): negative on both sides of 0 and positive after 3. So \(x = 0\) is not a turning point (a flat moment on the way down), and \(x = 3\) is a minimum, \(f(3) = -17\).
- \(f''(x) = 12x^2 - 24x = 12x(x - 2)\): positive for \(x < 0\), negative for \(0 < x < 2\), positive for \(x > 2\). Inflection points at \((0, 10)\) and \((2, -6)\).
- The second derivative test fails at \(x = 0\) (\(f''(0) = 0\)); the first derivative test settled it.
Try it¶
- For \(f(x) = x^2 - 6x + 5\), find where it is increasing and decreasing, and its minimum point.
- Sketch \(f(x) = x^3 - 12x\): critical points, maximum, minimum, inflection point.
- Use the second derivative test to classify the critical points of \(f(x) = 2x^3 - 3x^2 - 12x\).
- Where is \(f(x) = x^4 - 6x^2\) concave up, and where are its inflection points?
- Find the asymptotes of \(f(x) = \dfrac{3x + 1}{x - 2}\).
- For \(f(x) = xe^{-x}\), find the maximum point and the inflection point. What happens as \(x \to \infty\)?
- Sketch a graph that has \(f(0) = 2\), \(f'(x) > 0\) for \(x < 1\), \(f'(x) < 0\) for \(x > 1\), and \(f''(x) < 0\) everywhere.
- Show that \(f''(0) = 0\) for both \(x^3\) and \(x^4\). What does each graph have at \(x = 0\)? What does this say about the second derivative test?
Answers
- \(f'(x) = 2x - 6\): decreasing for \(x < 3\), increasing for \(x > 3\). Minimum at \((3, f(3)) = (3, -4)\).
- \(f'(x) = 3x^2 - 12 = 3(x - 2)(x + 2)\). Signs \(+, -, +\). Local maximum \((-2, 16)\), local minimum \((2, -16)\). \(f''(x) = 6x\): inflection at \((0, 0)\). It is odd: \(f(-x) = -f(x)\). It crosses the \(x\)-axis at 0 and \(\pm\sqrt{12} \approx \pm 3.46\).
- \(f'(x) = 6x^2 - 6x - 12 = 6(x - 2)(x + 1)\), critical points \(-1\) and 2. \(f''(x) = 12x - 6\). \(f''(-1) = -18 < 0\): local maximum at \((-1, 7)\). \(f''(2) = 18 > 0\): local minimum at \((2, -20)\).
- \(f''(x) = 12x^2 - 12 = 12(x - 1)(x + 1)\). Concave up for \(x < -1\) and \(x > 1\); concave down between. Inflection points \((-1, -5)\) and \((1, -5)\).
- Vertical: \(x = 2\) (the bottom is 0, the top is 7). Horizontal: divide by \(x\): \(\dfrac{3 + 1/x}{1 - 2/x} \to 3\), so \(y = 3\).
- \(f'(x) = e^{-x} - xe^{-x} = e^{-x}(1 - x)\): \(+\) then \(-\) at \(x = 1\), a maximum at \(\left(1, \frac1e\right)\), about \((1, 0.368)\). \(f''(x) = e^{-x}(x - 2)\): changes sign at 2, inflection at \(\left(2, \frac{2}{e^2}\right)\), about \((2, 0.271)\). As \(x \to \infty\), \(e^{-x}\) shrinks much faster than \(x\) grows, so \(f(x) \to 0\): the \(x\)-axis is a horizontal asymptote on the right.
- A cap-shaped hill: rising through \((0, 2)\), peaking at \(x = 1\), then falling, bending downwards the whole time (an upside-down U, like \(f(x) = 2 + 2x - x^2\), which has all these properties).
- \((x^3)'' = 6x\) and \((x^4)'' = 12x^2\), both 0 at \(x = 0\). \(x^3\) has an inflection point at 0 (no turn); \(x^4\) has a minimum at 0. So when \(f''(c) = 0\) the second derivative test cannot decide: anything can happen. Use the first derivative test.
Common mistake¶
Calling every critical point a maximum or minimum. \(f'(c) = 0\) only makes \(c\) a candidate. Check the signs of \(f'\) on both sides, as in worked example 3.
Calling every zero of \(f''\) an inflection point. \(x^4\) has \(f''(0) = 0\) but is a cup on both sides. An inflection point needs \(f''\) to change sign.
Where it leads¶
- Back: Derivatives of \(e^x\), \(\ln x\), \(\sin x\) and \(\cos x\) · Next: Optimization, where the largest and smallest values solve real problems.
- Level 8 page · Change and motion topic page
- Reading \(f'\) from \(f\): level 7, the derivative as a function.
- Polynomial and rational functions without calculus: Algebra: polynomial functions and Algebra: rational functions.
- On the U of T shelf: MAT137 Unit 5: the mean value theorem and Unit 6: applications of derivatives.