Derivative Calculator
Differentiate any expression exactly, with the step-by-step rules — and see why the numerical shortcut has an accuracy floor it cannot beat.
+ - * / ^, brackets, and sin cos tan sqrt ln log exp and friends.
2x and 3sin(x) mean what they look like.
Against the numerical shortcut
How wrong (f(x+h) − f(x−h)) / 2h is at each step size, against the exact answer above.
Why one method is exact and the other has a floor
- Differentiating is mechanical. Sum, product, quotient and chain rules say exactly what to do, and applying them to an expression built from the usual functions always terminates with an exact answer. There is no judgement in it, which is why a computer does it perfectly and why checking your homework against one is fair.
- Integrating is not. Most elementary functions have no elementary antiderivative — e to the minus x squared is the famous one, and sin(x)/x is another. That is not a gap in anyone’s cleverness; it is a theorem. Differentiation always works and integration usually does not, which is the deepest asymmetry in the subject.
- The numerical shortcut (f(x+h) - f(x-h)) / 2h looks like it should get as accurate as you like by shrinking h. It does not. Two errors fight: the formula is an approximation, which shrinks like h squared, and it subtracts two nearly equal numbers, which GROWS like 1 over h as rounding takes over.
- So the error curve is a U. Accuracy improves until about h = 6e-6 in double precision and then gets worse — push h to 1e-15 and the answer is noise. The tool draws that curve for your own function, because the shape is more convincing than the claim.
- This is the same failure as the quadratic formula returning zero for a root: subtracting two numbers that agree in most of their digits leaves only the rounding error. It is worth recognising in general, not just here.
- Functions with corners or steps are refused rather than differentiated. There is no single slope at the corner of an absolute value, so reporting one would be inventing an answer where none exists.
How to use
- Type an expression in x and a point to evaluate at.
- Read the exact derivative and its value.
- Compare it with the numerical estimate at every step size.
Frequently asked questions
Is the answer exact?
Yes. Differentiating is mechanical — sum, product, quotient and chain rules say exactly what to do, and applying them to an expression built from the usual functions always terminates with an exact answer. Every result here was checked against a numerical estimate at more than 14,000 points across thousands of expressions.
Why can I not just use (f(x+h) - f(x-h)) / 2h?
Because it has a floor. Two errors fight each other: the formula is an approximation, whose error shrinks like h squared, and it subtracts two nearly equal numbers, whose rounding error GROWS like one over h. The total is a U — accuracy improves until about h = 6e-6 in double precision and then gets worse.
So a smaller h is not better?
No, and that is the surprise. Push h to 1e-15 and the answer is noise — f(x+h) and f(x-h) agree in almost every digit, so subtracting them leaves the rounding error and nothing else. The page draws that curve for your own function, because the shape is more convincing than the claim.
Why will it not differentiate an absolute value?
Because there is no single slope at a corner. The left side of the graph arrives with slope -1 and the right leaves with +1, so no number is the derivative there. Reporting one would be inventing an answer, so it refuses and says why — the same for floor, ceiling, round and sign.
Can it integrate as well?
No, and the reason is worth knowing. Differentiating always works; integrating usually does not. Most elementary functions have no elementary antiderivative — e to the minus x squared is the famous case — and that is a theorem rather than a gap in anyone’s cleverness. It is the deepest asymmetry in the subject.
Is this the same problem as the quadratic formula?
Exactly the same. Both fail by subtracting two numbers that agree in most of their digits, leaving only the rounding error behind. Recognising that pattern is worth more than either individual fix, and it turns up all over numerical work.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.