Tutorials › AP Calculus › Checking Derivative Rules Numerically

Calculator Strategy and Error Control · Tutorial 985 of 999

Checking Derivative Rules Numerically

Use carefully chosen difference quotients to check a derivative rule numerically, while recognizing when a mismatch is evidence rather than proof.

Intermediate 10 min read

What You'll Learn

  • Compute symmetric difference-quotient estimates at selected domain points.
  • Choose test points that can reveal errors and include one near a suspected problem.
  • Compare calculator estimates with proposed derivative values at a consistent precision.
  • Understand why a finite-step estimate can differ from the exact derivative.
  • Use smaller step sizes to investigate suspicious results.
  • Distinguish numerical evidence from a mathematical proof.

Why Check a Derivative Numerically?

A derivative rule can look plausible and still contain a sign, coefficient, or algebra error. A calculator can provide a useful independent check: estimate the derivative of the original function at selected inputs, then compare those estimates with the proposed derivative formula.

This check is especially useful when a rule has several terms or when a suspected error appears only in part of the domain. Testing more than one input can help locate a problem. But numerical checking has a limit: a calculator estimates the derivative using a finite change in the input, so its result is not automatically the exact derivative.

Key takeaway: A close match at several points supports a proposed derivative rule, but does not prove it. A substantial mismatch is evidence of a possible error and calls for further checking. A mismatch is decisive only when the exact derivative is known or the numerical error is controlled well enough to rule out the proposed value.

The Symmetric Difference-Quotient Estimate

Suppose \(f\) is defined near an input \(x\). For a nonzero step \(h\) such that both \(x-h\) and \(x+h\) are in the domain, the symmetric difference quotient is

$$ D_h f(x)=\frac{f(x+h)-f(x-h)}{2h}. $$

A calculator evaluates the two function values and the quotient. If \(f\) is differentiable at \(x\), these estimates approach \(f'(x)\) as \(h\) approaches zero. The value for a particular nonzero \(h\), however, is generally only an estimate.

Condition: Use the symmetric estimate only when \(h\ne 0\) and both inputs \(x-h\) and \(x+h\) are in the domain of \(f\). For the estimate to converge to the derivative as \(h\to0\), \(f\) must be differentiable at \(x\).

Why the Estimate Approaches the Derivative

The reason follows directly from the definition of the derivative. When \(f\) is differentiable at \(x\), the forward difference quotient and the backward difference quotient each approach \(f'(x)\) as \(h\to0\). The symmetric quotient is their average:

$$ \frac{f(x+h)-f(x-h)}{2h} = \frac{1}{2} \left( \frac{f(x+h)-f(x)}{h} + \frac{f(x)-f(x-h)}{h} \right). $$

For the backward term, the usual derivative quotient with increment \(-h\) is

$$ \frac{f(x-h)-f(x)}{-h} = \frac{f(x)-f(x-h)}{h}. $$

Thus both terms inside the average approach \(f'(x)\). The limit of their average is therefore \(f'(x)\). This justifies using the symmetric quotient as a numerical check when \(h\) is small and the function behaves regularly near \(x\). It does not say that any one finite-step estimate equals the derivative exactly.

Why this matters: The estimate has a mathematical basis, but it still depends on the chosen step size. A result that changes noticeably when \(h\) changes should be treated cautiously.

A Practical Checking Process

1
Check the domain.
Choose \(x\) and \(h\) so that \(x-h\) and \(x+h\) are valid inputs to the original function.
2
Choose informative points.
Test several inputs, including one near a suspected error. Avoid relying on a point where different formulas happen to give the same value.
3
Compute the estimate from the original function.
Evaluate \(f(x+h)\) and \(f(x-h)\), then calculate their difference divided by \(2h\).
4
Evaluate the proposed derivative at the same input.
Compare the two values at a consistent precision. If they differ substantially, repeat the check with a smaller step and inspect the setup.

Using the original function for the estimate is important. If you use the proposed derivative formula to generate the estimate, you are not checking it independently.

Worked Example: A Finite Step Can Mislead

Worked Example: A Cubic Function at One Input

Let \(f(x)=x^3\). Its derivative is \(f'(x)=3x^2\), so \(f'(1)=3\). First test the symmetric estimate with the relatively large step \(h=1\):

$$ D_1 f(1) = \frac{f(2)-f(0)}{2} = \frac{2^3-0^3}{2} = \frac{8}{2} = 4. $$

The estimate is \(4\), not \(3\). That difference does not show that the derivative rule is wrong: \(h=1\) is not a small step here. Reduce the step to \(h=0.1\):

$$ D_{0.1} f(1) = \frac{f(1.1)-f(0.9)}{0.2} = \frac{1.331-0.729}{0.2} = \frac{0.602}{0.2} = 3.01. $$

With \(h=0.01\), the estimate is

$$ D_{0.01} f(1) = \frac{f(1.01)-f(0.99)}{0.02} = \frac{1.030301-0.970299}{0.02} = \frac{0.060002}{0.02} = 3.0001. $$

The estimates move closer to \(3\) as the step decreases. The exact derivative value \(3\) is the check at this input; the finite-step estimates illustrate why a mismatch from one choice of \(h\) is not by itself a disproof.

Check: Substituting \(x=1\) into \(f'(x)=3x^2\) gives \(3(1)^2=3\), consistent with the estimates for the smaller steps.

Worked Example: Checking a Rational Derivative

Worked Example: Compare at Three Domain Points

Consider \(f(x)=\frac{1}{x^2+1}\), and check the proposed derivative \(g(x)=-\frac{2x}{(x^2+1)^2}\). The function is defined for every real \(x\). Use \(h=0.01\), so the calculator estimate is \(\frac{f(x+0.01)-f(x-0.01)}{0.02}\).

At \(x=0.5\), evaluate both function values:

$$ f(0.51)=\frac{1}{1.2601}\approx0.7935878105, \qquad f(0.49)=\frac{1}{1.2401}\approx0.8063865817. $$

Therefore, the symmetric estimate is

$$ \frac{0.7935878105-0.8063865817}{0.02} \approx -0.63993856 \approx -0.63994. $$

The proposed formula gives

$$ g(0.5) = -\frac{1}{(1.25)^2} = -\frac{1}{1.5625} = -0.64. $$

These values are close. Repeat at \(x=1\):

$$ f(1.01)=\frac{1}{2.0201}\approx0.4950249988, \qquad f(0.99)=\frac{1}{1.9801}\approx0.5050249988, $$ $$ \frac{0.4950249988-0.5050249988}{0.02} \approx -0.50000, \qquad g(1)=-\frac{2}{(2)^2}=-0.50000. $$

Now include a point near \(x=1\), where a suspected error might occur, and use \(x=1.01\):

$$ f(1.02)=\frac{1}{2.0404}\approx0.4900999804, \qquad f(1)=\frac{1}{2}=0.5, $$ $$ \frac{0.4900999804-0.5}{0.02} \approx -0.495001, \qquad g(1.01) = -\frac{2.02}{(2.0201)^2} \approx -0.495000. $$

The last two values agree when rounded to five decimal places: both are \(-0.49500\). This comparison supports the proposed formula at these test points; it does not establish the rule for every input.

Check: Differentiating \((x^2+1)^{-1}\) gives \(-(x^2+1)^{-2}(2x)=-\frac{2x}{(x^2+1)^2}\), the proposed expression. Substitution at \(x=1.01\) gives \(-2.02/(2.0201)^2\), matching the numerical estimate to the displayed precision.

Worked Example: Testing Near a Suspected Typo

Worked Example: A Coefficient Error in a Candidate

Let \(f(x)=x^3-2x\). Suppose a proposed derivative is \(q(x)=3x^2-1\). The coefficient of the constant term is suspected, so test several inputs, including \(x=1.01\), near \(1\). Use \(h=0.01\).

At \(x=0.5\), the function values are

$$ f(0.51)=0.51^3-2(0.51)=0.132651-1.02=-0.887349, $$ $$ f(0.49)=0.49^3-2(0.49)=0.117649-0.98=-0.862351. $$

Thus

$$ \frac{-0.887349-(-0.862351)}{0.02} = \frac{-0.024998}{0.02} = -1.2499. $$

The proposed value is \(q(0.5)=3(0.5)^2-1=0.75-1=-0.25\), a substantial difference. At \(x=1\):

$$ f(1.01)=1.030301-2.02=-0.989699, \qquad f(0.99)=0.970299-1.98=-1.009701, $$ $$ \frac{-0.989699-(-1.009701)}{0.02} = \frac{0.020002}{0.02} = 1.0001. $$

But \(q(1)=3-1=2\), again substantially different. Finally, at \(x=1.01\), the two inputs are \(1.02\) and \(1\):

$$ f(1.02)=1.061208-2.04=-0.978792, \qquad f(1) = 1-2=-1, $$ $$ \frac{-0.978792-(-1)}{0.02} = \frac{0.021208}{0.02} = 1.0604. $$

The candidate gives \(q(1.01)=3(1.0201)-1=3.0603-1=2.0603\), again about \(1\) larger than the numerical estimate. The repeated substantial discrepancy, including at the nearby point, is strong evidence that the proposed rule is wrong. Here the exact derivative is \(3x^2-2\), which confirms that the candidate's constant term should be \(-2\), not \(-1\).

Check: At \(x=1.01\), the exact derivative is \(3(1.01)^2-2=3(1.0201)-2=3.0603-2=1.0603\). The estimate \(1.0604\) differs by \(0.0001\), as expected for a finite step, while the candidate value \(2.0603\) differs by approximately \(1\).

Common Pitfall: Treating an Estimate as Exact

A common error is to regard any numerical mismatch as proof that a derivative formula is false. The cubic example shows why this is unsafe: at \(x=1\), the exact derivative is \(3\), while the symmetric estimate with \(h=1\) is \(4\). The derivative rule is still correct. A large step can create a noticeable difference even when the proposed derivative is right.

The opposite mistake is also possible: treating a close match at a few points as proof. A finite set of test points cannot establish that two functions agree throughout a domain. Use numerical checks to find possible errors, then rely on mathematical justification to establish a rule.

Practical correction: If an estimate and proposed value differ, verify the function inputs, arithmetic, calculator mode, and step size. Repeat with a smaller step when appropriate. If a substantial mismatch persists, investigate the rule; do not claim it is disproved unless the exact derivative or a reliable error bound makes that conclusion valid.

Choosing Points and Interpreting Results

Good test points are valid inputs that probe different parts of the expression. If a suspected mistake involves a sign or constant, choose points where that term has a visible effect. Include an input near the suspected location, as well as other convenient domain points. Avoid choosing only special values where the disputed terms vanish or happen to agree.

Keep the step size and rounding in mind. A smaller \(h\) often makes the difference quotient more representative of local change, but calculator arithmetic can also become sensitive when subtracting nearly equal function values. Record enough digits during intermediate calculations, then round the final comparison consistently. If two results differ only in the last displayed digit, that is not the same as a substantial discrepancy.

Numerical checking is valuable because it can catch errors before they affect later work. It is most reliable as a diagnostic process: calculate independently from the original function, test several inputs, investigate mismatches, and distinguish evidence from proof.

Check Your Understanding

Answer the questions using the definitions and examples above.

  1. For \(f(x)=x^3\) at \(x=1\), why does the symmetric estimate with \(h=1\) fail to equal the exact derivative?
  2. What domain condition must hold for the symmetric difference quotient at \(x\) with step \(h\)?
  3. Why does a close numerical match at several points not prove a derivative rule on an entire interval?
  4. A proposed derivative differs substantially from an estimate at one point. What checks should you perform before deciding that the rule is wrong?
  5. Why is it useful to test near a location where a sign or coefficient error is suspected?

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon