How to Check Your Derivative

Check a derivative by re-deriving it a second way, comparing equivalent forms, testing it numerically at a single point, and comparing its sign with the graph; an answer checker automates the comparison. A result that looks different from the textbook’s may still be right, and one that looks tidy may still be wrong.

Each method catches different errors, so use at least two on anything that matters.

Method 1: A second route

Differentiate the same function by a different method and compare. Most expressions allow at least one alternative:

If two routes agree, a slip is unlikely, because the routes use different steps. If they disagree, at least one contains an error, and finding which one is easier than staring at a single answer.

Method 2: Equivalent forms

Two derivatives that look different can be the same function. The derivative of \tan x has three common forms:

\frac{1}{\cos^2x}=\sec^2x=1+\tan^2x,\qquad \cos x\ne 0.

The first two are the same by definition of the secant, and the third follows from \sin^2x+\cos^2x=1 divided by \cos^2x. The derivation of \tan x itself is in the derivation of the tangent derivative.

Here is a case where two routes give different-looking answers. Differentiate f(x)=\dfrac{x+1}{x-1} for x\ne 1. The quotient route gives

f'(x)=\frac{(x-1)-(x+1)}{(x-1)^2}=-\frac{2}{(x-1)^2}.

Writing f(x)=(x+1)(x-1)^{-1} and using the product rule gives

f'(x)=\frac{1}{x-1}-\frac{x+1}{(x-1)^2}.

These look different. Put the second over the common denominator (x-1)^2:

\frac{(x-1)-(x+1)}{(x-1)^2}=-\frac{2}{(x-1)^2}.

They are the same. To compare two forms quickly, either simplify both to a common form or evaluate both at a test point. At x=3 the first gives -\dfrac24=-\dfrac12 and the second gives \dfrac12-1=-\dfrac12.

Method 3: A numeric check at one point

The derivative is the limit of a difference quotient, so a small h gives an approximation to test against. There are two versions:

\text{forward: }\frac{f(x+h)-f(x)}{h},\qquad \text{central: }\frac{f(x+h)-f(x-h)}{2h}.

Suppose you claim that the derivative of f(x)=x\ln x is f'(x)=\ln x+1. Test it at x=2 with h=0.001:

Quantity Value
Claimed f'(2)=\ln 2+1 1.693147\ldots
Forward difference 1.693397
Central difference 1.693147

The central difference agrees with the claimed value to all six decimals shown, so the formula passes.

The central version is better because its errors are symmetric around x and largely cancel. The error of the forward difference shrinks in proportion to h, while the error of the central difference shrinks in proportion to h^2. Here the forward error is about 0.00025, which matches \dfrac h2f''(2)=\dfrac{0.001}{2}\cdot\dfrac12.

Two cautions. Agreement at one point does not prove a formula, but a wrong formula rarely agrees at a generic point, so test at a second point as well. And avoid special points such as x=0 or x=1, where different wrong formulas can happen to coincide.

Method 4: Compare with the graph

The sign and size of f' must match what the graph does:

For x\ln x, the graph falls and then rises, with its lowest point at x=e^{-1}\approx 0.37. That is exactly where \ln x+1=0.

The graph also catches sign errors. The function \dfrac{x+1}{x-1}=1+\dfrac{2}{x-1} falls on each side of x=1, so its derivative must be negative everywhere on its domain. Any answer that is positive somewhere, such as +\dfrac{2}{(x-1)^2}, fails at once.

Method 5: The answer checker

An answer checker compares your derivative with the correct one and accepts any equivalent form, so a correct answer is not marked wrong because it is arranged differently. In the calculator, the box headed “Check your answer” sits under each derivative: type your result and press “Check”. It replies “Correct! Your answer matches the derivative.” or “Incorrect — your answer doesn’t match the derivative.” For \tan x it accepts 1/cos(x)^2, sec(x)^2 and 1+tan(x)^2 alike. The verdict does not say where a slip happened, so use it last, after the manual checks, to find out where your own went wrong.

Common mistakes: wrong to right

  1. (\sin 2x)'=\cos 2x → 2\cos 2x. The inside 2x has derivative 2, which the chain rule multiplies in.

  2. (e^x)'=xe^{x-1} → e^x. The power rule needs a constant exponent. In e^x the variable is in the exponent, and the function is its own derivative, as the table of derivatives shows.

  3. (x^x)'=x\cdot x^{x-1} → x^x(\ln x+1) for x>0. The variable appears in the base and in the exponent, so you need logarithmic differentiation.

  4. (\cos x)'=\sin x → -\sin x. The derivative of cosine carries a minus sign. The derivative of sine does not.

  5. (\ln 2x)'=\dfrac{1}{2x} → \dfrac1x for x>0. The inside contributes a factor 2, and \dfrac{1}{2x}\cdot 2=\dfrac1x. Rewriting \ln 2x=\ln 2+\ln x confirms it, because \ln 2 is a constant.

  6. (e^2)'=e^2 → 0. The number e^2 is a constant, not a function of x, and the derivative of a constant is 0.

  7. Treating \pi like a variable. The number \pi\approx 3.14159 is a constant. The three expressions below use three different rules, and the usual slip is to swap them.

    Expression Derivative Rule
    \pi x \pi constant multiple
    x^{\pi} \pi x^{\pi-1} power rule, constant exponent
    \pi^{x} \pi^{x}\ln\pi exponential rule, constant base

    Applying the power rule to \pi^x would give x\pi^{x-1}, which is wrong.

  8. Quotient numerator in the wrong order: \dfrac{uv'-u'v}{v^2} → \dfrac{u'v-uv'}{v^2}. The quotient rule starts with the derivative of the top. Reversing the order flips the sign of the entire answer. For \dfrac{x+1}{x-1} the reversed numerator gives +\dfrac{2}{(x-1)^2}, and the graph check above rejects it.

Try it: The function is ln(2*x). Test the correct answer 1/x, an equivalent form 2/(2*x), and the common wrong answer 1/(2*x). Each link fills the “Check your answer” box and presses “Check”: the first two get “Correct! Your answer matches the derivative.” and the third gets “Incorrect — your answer doesn’t match the derivative.”

Frequently asked questions

Why does my answer look different from the textbook’s?

It may be an equivalent form. Different routes, different algebra, and trig identities such as \sec^2x=1+\tan^2x all produce correct answers that look unlike each other. Simplify both to a common form, or evaluate both at a few test values. If the numbers agree at several generic points, the forms are almost certainly the same.

How small should h be in a numeric check?

Small enough to make the approximation error tiny, but not so small that rounding takes over. For a central difference, values around 10^{-3} to 10^{-5} work well on a calculator or in code. Smaller values lose digits because you subtract two nearly equal numbers. In the example above, h=0.001 already gave six correct decimals.

Should I always simplify my derivative?

No. A correct unsimplified derivative is still correct, and an answer checker accepts it. Simplify when the instructions ask for it, or when you need to solve f'(x)=0 or study the sign of f', since a factored form makes that easy. Simplify carefully, because a slip in the algebra can turn a correct derivative into a wrong one.

Where to go next

To test your own derivatives, use the “Check your answer” box in the derivative calculator, which accepts any equivalent form of your result.