xaktly | Calculus

Curve sketching

Part 2: Second derivative

This is part 2 of two pages (part 1 here) on curve sketching using derivatives. Curve sketching also relies heavily on all of your pre-calculus (advanced algebra) skills in graphing polynomial, rational and other functions.

Using the 2nd derivative to learn even more about the shapes of functions

In this section we'll learn how to use the second derivative of a function (if it has one) to learn about how the derivative changes as the independent variable changes. Any change in the slope of a function (the derivative of the derivative) manifests itself as curvature of the graph of the function

The second derivative may be:

  • zero if the function graph is a line or if the slope is changing from increasing to decreasing, or the opposite;

  • positive: the slope is increasing and the graph of the function is growing steeper as the independent variable increases; or

  • negative: the slope of the function is decreasing and its graph is growing less steep as the independent variable increases.

Old school!

There is no substitute for your basic pre-calculus skills when it comes to understanding the shape of the graph of a function. These skills include awareness of roots, asymptotes, holes, end behavior and symmetry. Don't forget them!

The second derivative

The second derivative of a function is the derivative of its derivative.

$$f''(x) = \frac{d}{dx} \left(\frac{df}{dx} \right) = \frac{d^2}{dx^2} f(x) = D_x^2 f(x)$$

Notation: There is a bit of extra notation there ( ↑ ). It's easiest, and very common, to use the compact notation f''(x) for the second derivative. The third notation is a little illogical (we're not taking a derivative with respect to "x2", but it's very commonly used, so you should get used to it. The third is due to Euler; it's compact and descriptive, but only used sometimes.

The second derivative and the shape of a graph

When the second derivative of a function is positive, the rate of change of the slope (the first derivative) of that function is positive. That is, the slope is increasing. As the graph below shows, that leads to increasing steepness. The magenta arrows are roughly tangent to the curve at several points. Notice that each is becoming increasingly more positive as we move from left to right. That includes slopes that were already negative; these are becoming less negative as we move across the graph. The shape of the graph is concave upward.

The graph below shows a function that is concave-downward. The slope of such a function, indicated by the tangent rays, decreases as we move from left to right.

You can remember the difference between concave and convex by noting that the concave side forms a "cave." We often speak of the concavity of a function.

  • concave upward → slope increasing
  • concave downward → slope decreasing

Concave-up and concave-down graphs may have positive or negative slopes:

This graph shows a curve that has adjacent sections that are concave-upward (left) and concave downward. Because the second derivative is negative in the first case, and positive in the second, it must at some point pass through zero if our function is continuous and well-behaved. The point at which f''(x) = 0 is called an inflection point.

Below we'll look at some functions and identify inflection points, and regions where the curve is concave upward or downward.

Inflection point

Inflection point — a point in a graph at which the curvature changes between concave-upward and concave-downward.

At an inflection point of f(x), $f''(x) = 0.$ But not all points at which $f''(x) = 0$ are inflection points; we must administer a test to determine whether the curvature of the function changes at that point, similar to the first-derivative test of critical points.

Example 1

Find the inflection point(s) of the function $f(x) = x^3 + x^2 - 9x - 9,$ and show that the curvature changes from positive to negative across that point. Sketch a graph of the function.

Solution: First, let's find the first and second derivatives:

$$ \begin{align} f(x) &= x^3 + x^2 - 9x - 9 \\[5pt] f'(x) &= 3x^2 + 2x - 9 \\[5pt] f''(x) &= 6x + 2 \end{align}$$

Now setting the second derivative equal to zero gives us the potential inflection point(s): $6x + 2 = 0 \: \rightarrow \: x = \frac{1}{3}.$ Now we need to check the curvature of the function using convenient points on either side of $x = -\frac{1}{3}:$

It's simple to calculate the $f''(-1) = -5$ and $f''(1) = 7,$ so the curvature does indeed change, and we've found an inflection point.

Now consider the graph of the function. It's cubic, so we know that at most it can have three real roots and two turning points (maxima and minima). The roots are easy because this function can be grouped:

$$ \begin{align} x^3 + x^2 - 9x - 9 &= 0 \\[5pt] x^2(x + 1) -9(x + 1) &= 0 \\[5pt] (x + 1)(x^2 - 9) &= 0 \\[5pt] x &= -1, \; -3, \; 3 \end{align}$$

The critical points can be found by setting the first derivative equal to zero and solving (completing the square, in this case):

$$ \begin{align} 3x^2 + 2x - 9 &= 0 \\[5pt] x^2 + \frac{2}{3} x &= 3 \\[5pt] x^2 + \frac{2}{3} x + \left( \frac{1}{3} \right)^2 &= 3 + \frac{1}{9} \\[5pt] \left( x^2 + \frac{1}{3} \right)^2 &= \frac{28}{9} \\[5px] x &= \frac{-1 ± \sqrt{28}}{3} \\[5px] x &\approx -2.1, \; 1.4 \end{align}$$

Knowing the end-behavior of such a function (down on left, up on right), the curvature and these key points allows us to sketch a nice graph of this function and know a lot of detail about it.

Comparing graphs of f(x) and f'(x)

Here are graphs of a function f(x) and its second derivative,

$$ \begin{align} f(x) &= x^6 - 3x^5 + 6x^3 - 3x^2 - 3x + 2\\[5pt] f''(x) &= 30x^4 - 60x^3 + 36x - 6 \end{align}$$

In this comparison, notice that every zero in the graph of the second derivative $[f''(x) = 0]$ matches an inflection point in the graph of $f(x),$ a point where the curvature changes between concave upward and concave downward.

The zeros in $f''(x)$ are all inflection points. In particular, the zero at $x = 1$ confirms an inflection point we might already have discerned from root finding. The root at x = 1 matches the binomial (x - 1), which appears three times, i.e. $(x - 1)^3,$ in the factorized function.

It is possible, however, that a zero in the 2nd derivative of a function does not indicate an inflection point. For example, the function $g(x) = x^4$ has a zero at $x = 0$ in its second derivative, $g''(x) = 12x^4,$ but that point (x = 0) is actually the global minimum of that function, with concave-up curvature on either side. We must be cautious when basing conclusions about inflection points on the second derivative.

Finally, the second derivative can supply more information about whether an extremum (singular of extrema) is a relative maximum or minimum:

For an extremum at a point c in the domain of $f(x),$

  • $f''(c) \gt 0$   for a relative minimum

  • $f''(c) \lt 0$   for a relative maximum.

This is often referred to as the second derivative test. It makes sense: At a minimum the function is curved upward and at a maximum it bends downward on both sides of the high point.

Click on the figure to download a .pdf copy.

The general approach to curve sketching

Now we have another tool in our toolbox for understanding the shape of a graph: Perform the usual algebraic analysis, then use the first and second derivatives to find extrema and inflection points.

  1. Use your pre-calculus skills: Determine whether function has any asymptotes or other discontinuities like holes, determine the behavior of the extreme ends of the function, and find any points that are easy to find - the y-intercept, for example; determine the roots (x-intercepts) if possible.

  2. Find the 1st the first derivative and solve f'(x) = 0 to find the critical points.

  3. Decide whether f'(x) is negative or positive on each interval between critical points. Make sure that this information is consistent with what you determined in steps 1 & 2.

  4. Find the 2nd derivative if possible (sometimes this can be a mess, so be sure you really need to!) If f''(x) > 0, the function is concave upward; if f''(x) < 0, it's concave downward. f''(x) = 0 at an inflection point (usually).

  5. Combine all of these steps and make sure that all of the information you have about the function is consistent. It has to be.

Some of the implications of the first and second derivatives on curve shape are summarized in the table below.

Click on the table to download a .pdf copy

Example 2 – Rational function

Sketch an accurate graph of f(x) including the locations of any asymptotes, maxima, minima and inflection points.

$$f(x) = \frac{x^2 - 2x + 4}{x - 2}$$


Solution: Our function is:

$$f(x) = \frac{x^2 - 2x + 4}{x - 2}$$

First, let's take a look at the numerator. The zeros of the numerator are the zeros of a rational function. In this case, the discriminant is less than zero, so this function has no real roots:

$$ \begin{align} b^2 - 4ac &= (-2)^2 - 4(1)(-2) \\ &= 4 - 8 = -4 \end{align}$$

When the degree of the denominator is one greater than the degree of the numerator, the function has a linear slanted asymptote, which we find by long division:

$$ \require{enclose} \begin{array}{rll} x\phantom{00000000} \\[-3pt] x - 2 \enclose{longdiv}{x^2 - 2x + 4}\kern-.2ex \\[-3pt] \underline{x^2 - 2x\phantom{000}} \\[-3pt] 4 \\[-3pt] \end{array}$$

The slanted asymptote is y = x. The denominator has a zero at x = 2, so there's a vertical asymptote there:

Now to find the critical point(s) by taking the first derivative. By the quotient rule, we start here:

$$f'(x) = \frac{(x - 2)(2x - 2) - (x^2 - 2x + 4)}{(x - 2)^2}$$

Expanding, we get:

$$f'(x) = \frac{2x^2 - 6x + 4 -x^2 + 2x - 4}{(x - 2)^2}$$

... which reduces to:

$$f'(x) = \frac{x(x - 4)}{(x - 2)^2}$$

Critical pts. at x = 0, x = 4

The zeros of f'(x) are the zeros of the numerator above, x = 0 and x = 4, so those are candidates for maxima or minima. Now we take the second derivative for two reasons: (1) to learn about the curvature and look for inflection points and (2) to test the critical points to see whether they're maxima or minima.

$$f''(x) = \frac{d}{dx} \frac{x^2 - 4x}{(x - 2)^2}$$

By the quotient rule the second derivative is:

$$f''(x) = \frac{(x - 2)^2(2x - 4) - (x^2 - 4x)(2)(x - 2)}{(x - 2)^4}$$

We can divide away one (x - 2) to get

$$f''(x) = \frac{(x - 2)(2x - 4) - 2(x^2 - 4x)}{(x - 2)^3}$$

Expanding the numerator and canceling where possible gives us a constant numerator

$$f''(x) = \frac{2x^2 - 8x + 8 - 2x^2 + 8x}{(x - 2)^3}$$

The constant numerator means that the function has no inflection points, because these have to be zeros of the 2nd derivative.

$$f''(x) = \frac{8}{(x - 2)^3}$$

The second derivative test on the critical point x = 0 shows that it's a maximum. The test on x = 4 says that it's a minimum.

$$ \begin{align} f''(0) &= 1 \; \color{#e90f89}{\text{ x = 0 is a maximum}} \\ f''(4) &= 1 \; \color{#e90f89}{\text{ x = 4 is a minimum}} \end{align}$$

Here's the graph of our function. It has a slant asymptote (y = x) and a vertical asymptote at x = 2. The function is discontinuous and therefore not differentiable at x = 2. It has no holes. It has a relative maximum at x = 0 and a relative minimum at x = 4.

The calculus we did is completely consistent with what we discovered about this function using only our algebra toolkit, and it extends that technique by allowing us to find the exact location of the relative maximum and minimum.

Example 3 – Another rational function

Sketch an accurate graph of f(x) including the locations of any asymptotes, maxima, minima and inflection points.

$$f(x) = \frac{x^2 - x - 6}{x - 1}$$


First, use your precalculus skills to find root(s) (the zeros of the numerator) and vertical asymptote(s), if they exist:

$$f(x) = \frac{(x - 3)(x + 2)}{x - 1}$$

So our graph will cross the x-axis only at x = -2 and x = 3, and because those are single roots (the binomial appears only once, i.e. is not squared, cubed ...), the graph crosses right through the x-axis there. There will also be a vertical asymptote at x = 1.

Next, notice that the degree of the numerator is one larger than the degree of the denominator, which means the function has a slanted linear asymptote. We find its equation by polynomial long division, up to the remainder:

$$ \require{enclose} \begin{array}{rll} x\phantom{00000000} \\[-3pt] x - 1 \enclose{longdiv}{x^2 - x - 6}\kern-.2ex \\[-3pt] \underline{x^2 - x\phantom{000}} \\[-3pt] -6 \\[-3pt] \end{array}$$

Next, take the derivative of f(x) and set it equal to zero. This will require a bit of simplification:

$$ \begin{align} f'(x) &= \frac{(x - 1)(2x - 1) - (x^2 - x - 6)}{(x - 1)^2} \\[5pt] f'(x) &= \frac{2x^2 - 3x + 1 - x^2 + x + 6}{(x - 1)^2} \\[5pt] f'(x) &= \frac{x^2 - 2x + 7}{(x - 1)^2} \end{align}$$

Now the zeros of the derivative are the zeros of the numerator, and to find those, we complete the square (or equivalently, solve the quadratic equation.

$$ \begin{align} x^2 - 2x + 7 &= 0 \\[5pt] x^2 - 2x &= -7 \\[5pt] x^2 - 2x + 1^2 &= -7 + 1^2 \\[5pt] (x - 1)^2 &= -8 \\[5pt] x &= 1 ± i\sqrt{8} \end{align}$$

Note: I could have just noticed that the discriminant,   $b^2 - 4ac$ is less than zero, and thus the derivative has imaginary roots, but I enjoy completing the square!

The roots of the derivative are imaginary, so this function has no critical points, and therefore has no maxima or minima.

Because we already know everything there is to know about the curvature of this graph, we won't need the second derivative, by you might confirm for yourself that the only zero is at x = 1, the point at which the curvature changes, but this point is undefined in the function (vertical asymptote).

This example is another good reminder not to forget about those precalculus skills. We found the y-intercept, the equation of the slant asymptote and the roots using algebra, and the facts they revealed basically established the shape of the graph. It's also worth thinking about the relative simplicity of the function — it just cant have a tremendous number of "wiggles" because its highest power is 2.

We used the first derivative to establish that there were no maxima or minima, sealing the deal on the shape of the graph; without any turning points and the other constraints we've stacked up, we've got all of the important features needed to sketch the graph. Absence of maxima or minima allows us to conclude that this function does not cross the slant asymptote for x near zero. If it did, that would create a "bump".

Example 4 – Polynomial function

Sketch the graph of the function $f(x) = x^3 - 2x^2 - 5x + 6$

Solution: This cubic polynomial isn't directly factorable, so we'll have to resort to the rational root theorem and hope it has rational roots. It does, x = 1 is one. Using synthetic substitution, we get:

So the function can be rewritten as the binomial (x - 1) multiplied by the resulting quadratic, which is then factorable, and we get three roots:

$$ \begin{align} f(x) &= (x - 1)(x^2 - x - 6) \\[5pt] &= (x - 1)(x + 2)(x - 3) \end{align}$$

Now taking the derivative, and setting it equal to zero, we can find the critical points. For a cubic we expect, at most, a local minimum and a local maximum, two critical points:

$$ \begin{align} 3x^2 - 4x - 5 &= 0 \\[5pt] 3x^2 - 4x &= 5 \\[5pt] x^2 - \frac{4}{3} x = \frac{5}{3} \\[5pt] x^2 - \frac{4}{3} x + \left( \frac{2}{3} \right)^2 = \frac{15}{9} + \frac{4}{9} = \frac{19}{9} \\[5pt] x = \frac{2 ± \sqrt{19}}{3} \end{align}$$

Because (precalculus!) we know the end behavior, we know that the minus solution is a maximum and the plus solution is a minimum. Now the second derivative is:

$$f''(x) = 6x - 4$$

We can use f''(x) to test our two critical points, just to confirm our precalculus intuition:

$$f''\left( \frac{2 + \sqrt{19}}{3} \right) = 2 \sqrt{19} \\[5pt] \color{#e90f89}{\gt 0 \implies \text{ relative minimum}}$$

$$f''\left( \frac{2 + \sqrt{19}}{3} \right) = -2 \sqrt{19} \\[5pt] \color{#e90f89}{\lt 0 \implies \text{ relative maximum}}$$

Finally, setting the second derivative equal to zero, we find that x = 2/3 is a candidate to be an inflection point. There's no need checking that the curvature changes on either side, because we know that has to be true for a cubic function.

$$ \begin{align} f''(x) &= 6x - 4 = 0 \\[5pt] x &= \frac{2}{3} \end{align}$$

x = ⅔ is the location of a possible inflection point. We always need to confirm that by checking the curvature to the left and right.

Finally, here's the graph with all of the meaningful points sketched in:

Example 5 — An absolute-value function

Explore the graph of the absolute-value function $f(x) = |1 - x^2|$

Solution: The derivative of an absolute-value function is a little tricky because of the sharp points that usually exist in the graph. See the box below for how to calculate the derivative of an absolute-value function. The derivative is:

$$f'(x) = \frac{-2x(1 - x^2)}{|1 - x^2|}$$

Setting that equal to zero to find the critical points,

$$\frac{-2x(1 - x^2)}{|1 - x^2|} = 0$$

We get three critical points. At x = ±1, the derivative is not defined, but at zero, we have a maximum, which we need not check because of our knowledge of the symmetry of the underlying quadratic function g(x) = 1 - x2.

$$ \begin{align} -2x (1 - x^2) &= 0 \\[5pt] x &= ±1, 0 \end{align}$$

The derivative is undefined at x = ±1, and x = 0 is a maximum. The graph of both the function and its derivative are shown.

Derivative of an absolute-value function

Example 6 — Root function

Sketch the graph of the function f(x) = 3x

Solution: The function is a fairly simple root function so we have some idea of its shape. It's a cube-root, the inverse of a cubic function, so we expect it to be a reflection of a cubic function across the line y = x.

$$f(x) = 3x^{\frac{1}{3}}$$

The derivative, because of the x2 in the denominator, is greater than zero for all x, so there are no critical points, and therefore no maxima or minima:

$$f'(x) = x^{-\frac{2}{3}} = \frac{1}{(x^2)^{1/3}} \; \color{#E90F89}{\text{ > 0 for all x ≠ 0}}$$

The second derivative is found using the chain rule with negative exponents or the quotient rule, and it tells us what we need to know about the concavity of the function:

$$ \begin{align} f''(x) &= -\frac{2}{3} x^{-\frac{5}{3}} \\[5pt] &\gt 0 \text{ for } x \lt 0 \; \; \color{#e90f89}{\text{ Concave up}} \\[5pt] &\lt 0 \text{ for } x \gt 0 \; \; \color{#e90f89}{\text{ Concave down}} \\[5pt] &\text{undefined for x = 0} \end{align}$$

Everything is consistent with the graph below.

Practice problems

Determine whether these functions have an/any inflection point(s), and discuss the curvature of each.


$$f(x) = x^4 - 4x^3 - 3$$


$$f(x) = \frac{1}{3}x^3 + x^2 - 3x$$


$$f(x) = \frac{x}{tan(x)}$$


$$f(x) = x \sqrt{x - 2}$$


$$f(x) = ln(x^2 + 2)$$


$$f(x) = e^{x^2}$$



The discriminant of a quadratic function is the part of its solution by the quadratic formula that lies under the radical: b2 - 4ac. Because a square root is taken of this expression, it alone determines whether the roots of a quadratic function will be real or imaginary.

If b2 - 4ac > 0, the function has two real roots.

If b2 - 4ac < 0, the function has two imaginary roots which are complex conjugates of each other, e.g. 4 + 2i and 4 - 2i.

If b2 - 4ac = 0, then the function has one double root, and it is real.

Creative Commons License   optimized for firefox
xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.