AI Math Solver

Derivative Calculator with Step-by-Step Solutions

Differentiate any function and see which rule is used at every step, from the power rule to the chain rule, with an exact simplified answer.

How to use the derivative calculator

  1. Type the function. Enter the expression to differentiate, such as x^2 sin x or (x^2 + 1)/(x - 1). Writing d/dx or y = in front is optional. For a second derivative, start with second derivative of.
  2. Press Solve Now. The engine looks at the structure of the function, decides which rules apply and differentiates each part symbolically.
  3. Follow the rules and the result. Every step names the rule it uses, shows the intermediate derivatives and ends with a simplified final answer you can copy or download as a PDF.

Free Derivative Calculator That Explains Every Rule

A derivative measures how fast a function changes. Geometrically, it is the slope of the tangent line to a curve at a point. Physically, it is a rate: velocity is the derivative of position, acceleration is the derivative of velocity, and marginal cost is the derivative of total cost. Differentiation is usually the first big topic in calculus, and it rewards practice, because the same handful of rules combine to handle almost every function you will meet.

This derivative calculator works the way a good tutor does. It identifies the outer structure of your function, picks the matching rule, writes down the pieces, differentiates each one and puts the result together. All calculations are done symbolically by a computer algebra engine in your browser, so the result is exact, and each step shows its working so you can follow the logic and compare it with your own.

What the derivative means

For a function f(x), the derivative f′(x) is defined as the limit of the difference quotient (f(x + h) − f(x)) / h as h approaches zero. In words, you take the slope of a secant line through two nearby points and let the points move together until the line becomes a tangent. The calculator uses the standard differentiation rules, which are all consequences of this definition, so you do not need to evaluate limits by hand for every function.

Derivative calculator illustration of a tangent line showing the slope of a curve
The derivative at a point equals the slope of the tangent line to the curve at that point.

A positive derivative means the function is increasing at that point, a negative derivative means it is decreasing, and a derivative of zero marks a flat point, which may be a maximum, a minimum or a point of inflection. These facts are the basis of curve sketching and optimisation problems.

The core differentiation rules

Every step of the calculator is labelled with one of these rules, so you can match the working to the formula you learned in class.

  • Constant rule: the derivative of a constant is 0.
  • Power rule: d/dx xⁿ = n·xⁿ⁻¹ for any real number n. This also covers roots and reciprocals, since √x = x^(1/2) and 1/x = x^(−1).
  • Constant multiple rule: a constant factor stays in front, so d/dx 5x³ = 5·3x² = 15x².
  • Sum rule: differentiate term by term, so the derivative of a polynomial is found one term at a time.
  • Product rule: (u·v)′ = u′·v + u·v′.
  • Quotient rule: (u/v)′ = (u′·v − u·v′) / v².
  • Chain rule: for a composite function f(g(x)), the derivative is f′(g(x))·g′(x).
  • Standard derivatives: d/dx sin x = cos x, d/dx cos x = −sin x, d/dx tan x = sec² x, d/dx eˣ = eˣ and d/dx ln x = 1/x.
Product, quotient, chain and power rules used by the derivative calculator
Four rules, power, product, quotient and chain, combine to differentiate almost any function.

The product rule in action

Use the product rule when two functions of x are multiplied together. For x^2 sin x, the calculator sets u = x² and v = sin x. It finds u′ = 2x and v′ = cos x, then substitutes into u′v + uv′ to get 2x·sin x + x²·cos x. A common shortcut in your head is "derivative of the first times the second, plus the first times the derivative of the second".

When there are three factors, the rule extends naturally: each term differentiates one factor and leaves the others unchanged. The calculator groups the factors so the working stays readable.

The quotient rule in action

For a fraction of two functions, such as (x^2 + 1)/(x - 1), the calculator identifies the numerator u = x² + 1 and the denominator v = x − 1. It applies (u′v − uv′)/v², giving (2x(x − 1) − (x² + 1)·1)/(x − 1)², and then simplifies the numerator to x² − 2x − 1. A helpful memory aid is "low d-high minus high d-low, over the square of what is below". Watch the order of the subtraction, because swapping it changes the sign of the whole answer.

Sometimes it is easier to avoid the quotient rule. A fraction with a constant denominator, such as (x³ + 2)/4, is just a constant multiple, and a fraction like 3/x² can be rewritten as 3x^(−2) and handled with the power rule.

The chain rule in action

The chain rule is for functions inside other functions. The idea is to differentiate the outer function while keeping the inner function unchanged, then multiply by the derivative of the inner function. For sin(3x^2), the outer function is sine and the inner function is 3x². The derivative of the outer part is cos(3x²), the derivative of the inner part is 6x, so the result is 6x·cos(3x²).

The chain rule often appears together with the other rules. For (2x + 1)⁵, the power rule gives 5(2x + 1)⁴ and the chain rule multiplies by 2, for a total of 10(2x + 1)⁴. For e^(x²), the result is 2x·e^(x²). The calculator always shows the inner derivative as a separate factor so you can see where it comes from.

Higher-order derivatives

The second derivative is the derivative of the derivative. It describes how the slope itself is changing, which tells you about concavity: a positive second derivative means the curve bends upwards, and a negative one means it bends downwards. In physics, the second derivative of position is acceleration.

To find a second or third derivative, type second derivative of x^5 or third derivative of sin x. The calculator differentiates once, simplifies, and then differentiates again, showing both rounds of working. For x⁵, the first derivative is 5x⁴ and the second is 20x³.

Choosing the variable

By default the calculator differentiates with respect to x. If your function uses another letter, it picks the variable automatically, preferring x, then y, then t. You can also state it explicitly, for example d/dt (t^3 - 4t) or derivative of a x^2 with respect to a. Every other letter is treated as a constant, which is exactly how partial derivatives work.

How to enter functions

  • Use ^ for powers: x^3, x^(1/2), (2x+1)^5.
  • Use brackets for function arguments: sin(2x), ln(x^2 + 1), e^(3x).
  • Implicit multiplication works: 3x^2, x sin x and 2(x+1) are all understood.
  • Put brackets around a whole numerator and denominator: (x^2 + 1)/(x - 1).
  • On this page, log means the natural logarithm, the same as ln.
  • Inverse trigonometric functions are written asin(x), acos(x) and atan(x).

Worked examples

Polynomial. d/dx (3x⁴ − 2x + 7). The sum rule splits the terms, the power rule gives 12x³ and −2, and the constant 7 differentiates to 0. Result: 12x³ − 2.

Root. d/dx √x. Rewrite as x^(1/2), apply the power rule to get (1/2)x^(−1/2), which simplifies to 1/(2√x).

Exponential with chain rule. d/dx e^(5x). The outer derivative is e^(5x) and the inner derivative is 5, so the result is 5e^(5x).

Logarithm. d/dx ln(x² + 1). The outer derivative is 1/(x² + 1) and the inner derivative is 2x, giving 2x/(x² + 1).

Product with trigonometry. d/dx x·cos x. Product rule: cos x + x·(−sin x) = cos x − x·sin x.

Using derivatives to find maxima and minima

Optimisation is one of the most practical uses of derivatives. To find the highest or lowest points of a function, set the derivative equal to zero and solve. Each solution is a critical point. The second derivative then classifies it: positive means a local minimum, negative means a local maximum. For f(x) = x³ − 3x, the derivative 3x² − 3 is zero at x = ±1. The second derivative 6x is negative at x = −1, a local maximum, and positive at x = 1, a local minimum. Use this calculator for the derivative and the Equation Solver to find where it equals zero.

Tangent lines from a derivative

Once you have the derivative, writing the equation of a tangent line takes three short steps. First evaluate the function at the point to get the y-coordinate. Then evaluate the derivative at the same point to get the slope m. Finally use the point-slope form y − y₁ = m(x − x₁). For f(x) = x² at x = 3, the point is (3, 9), the derivative 2x gives m = 6, and the tangent line is y = 6x − 9. The normal line, which is perpendicular to the tangent, has slope −1/m.

Implicit differentiation

Some curves are not written as y = f(x). The circle x² + y² = 25 is a classic example. To find dy/dx, you differentiate both sides with respect to x and treat y as a function of x, so every time you differentiate a term containing y you multiply by dy/dx. For the circle, 2x + 2y·dy/dx = 0, which gives dy/dx = −x/y. This calculator works with explicit functions, so for implicit problems you can use it to check each piece. For example, differentiate y² as a function of y and then multiply by dy/dx yourself.

Derivatives of exponential and logarithmic functions

The natural exponential eˣ is special because it is its own derivative. For any other base, d/dx aˣ = aˣ·ln a. The natural logarithm satisfies d/dx ln x = 1/x for x > 0, and a logarithm in base b has derivative 1/(x·ln b). These results combine with the chain rule constantly: d/dx 2^(3x) = 3·ln 2·2^(3x), and d/dx ln(sin x) = cos x / sin x = cot x. Logarithmic differentiation, taking ln of both sides before differentiating, is a useful trick for functions such as x^x, whose derivative is x^x(ln x + 1).

Common mistakes with derivatives

  • Forgetting the chain rule on functions like sin(3x) or (2x + 1)⁵, which loses the inner derivative.
  • Mixing up the quotient rule order. It is u′v − uv′, not uv′ − u′v.
  • Treating a product as a sum. The derivative of u·v is not u′·v′.
  • Sign errors with cosine. The derivative of cos x is −sin x.
  • Differentiating constants incorrectly. The derivative of π² or e³ is 0, because they are numbers.
  • Not simplifying. An unsimplified answer is correct but harder to use in the next step. The calculator always simplifies at the end.

Where derivatives are used

Derivatives describe change, so they appear across science and everyday life. Engineers use them to find maximum loads and minimum materials, economists to find the production level that maximises profit, and doctors and biologists to model how quickly a drug concentration or a population changes. Learning the rules with clear, labelled steps builds the fluency you need for these applications. For more on the history and theory, see the derivative article on Wikipedia.

Practice problems with answers

Try these on paper first, then type each one into the calculator to compare your steps with the full solution.

  1. d/dx (5x³ − 4x² + x − 9). Answer: 15x² − 8x + 1.
  2. d/dx (x·eˣ). Answer: eˣ + x·eˣ, using the product rule.
  3. d/dx (sin x / x). Answer: (x·cos x − sin x) / x², using the quotient rule.
  4. d/dx (3x² + 1)⁴. Answer: 24x(3x² + 1)³, using the chain rule.
  5. d/dx ln(5x). Answer: 1/x, because the constant 5 disappears after the chain rule.
  6. d/dx cos(x²). Answer: −2x·sin(x²).
  7. d/dx √(4x + 1). Answer: 2 / √(4x + 1).
  8. Second derivative of x⁴ − 2x³. Answer: 12x² − 12x.

Study tips for differentiation

Learn the basic derivatives until you can recall them without thinking, because every longer problem is built from them. Before you start a problem, describe the function in words: is it a sum, a product, a quotient or a function of a function? That single sentence tells you which rule to use first. Work from the outside in, and write the inner derivative as a separate factor so you never forget it. Finally, simplify only at the end. Trying to simplify in the middle of the product or quotient rule is where most algebra slips happen.

Related tools

Integration reverses differentiation, so use the Integral Calculator to go the other way and to check antiderivatives. For limits, algebra and mixed problems, try the main AI Math Solver. The Equation Solver finds critical points, and the Matrix Calculator and Statistics Calculator cover other parts of the course.

Frequently asked questions

Does the derivative calculator show which rule is used?

Yes. Every step is labelled with the rule it applies, such as the power rule, product rule, quotient rule or chain rule, together with the intermediate derivatives.

Can it find second and third derivatives?

Yes. Type second derivative of or third derivative of before your function, and the calculator differentiates repeatedly, showing each round of working.

How do I differentiate with respect to a variable other than x?

Write d/dt before the function or add with respect to t at the end. All other letters are treated as constants.

Is log treated as the natural logarithm?

Yes. On this page log(x) and ln(x) both mean the natural logarithm, so the derivative of log x is 1/x.

Why is my answer written differently from my textbook?

Derivatives can often be written in several equivalent forms. The calculator simplifies to a compact form, which may factor or expand terms differently from your book while being mathematically identical.

Is the derivative calculator free?

Yes. It is free, requires no account and runs entirely in your browser, so your functions are never stored.

Scroll to Top