Calculus

Derivative Calculator

This derivative calculator differentiates any function of x step by step and names the rule behind each step: power, product, quotient or chain rule.

Try

Use x as the variable, for example x^3 - 2x, e^(-x^2) or ln(x^2 + 1). Trigonometric functions use radians.

Derivative order

A number, fraction or expression such as -1/3 or pi/4. Leave blank for the formula only.

Result

f′(x), the first derivative: 2x·sin(x) + x²·cos(x)

f′(x), the first derivative

f′(x)=2xsin(x)+x2cos(x)f^{\prime}(x) = 2x\sin\left(x\right) + x^{2}\cos\left(x\right)

2x·sin(x) + x²·cos(x)

f′(π/2)Slope of the graph at this point
3.1415926543.141592654
f(π/2)
2.46740112.4674011
Tangent line at x = π/2
y=3.141592654x−2.4674011y = 3.141592654x - 2.4674011
Normal line (perpendicular)
y=−0.3183098862x+2.9674011y = -0.3183098862x + 2.9674011
Numerical check (central differences)Agrees with the exact formula
3.14159265
Rules used
Product rule, power rule, standard derivatives

The first derivative of f(x) = x²·sin(x) is f′(x) = 2x·sin(x) + x²·cos(x). At x = π/2 the slope of the graph is 3.141592654, so the tangent line there is y = 3.141592654x − 2.4674011.

Trigonometric functions use radians. For an angle in degrees, write sin(pi x/180) instead of sin(x).

f(x) and f′(x) near x = π/2
−20−10010−101234xyf(x)f′(x)Tangent at x = π/2
Step-by-step working (7 steps)
  1. Start with the function

    f(x)=x2sin(x)f(x) = x^{2}\sin\left(x\right)
  2. Product rule: (uv)′ = u′v + uv′

    ddx[x2sin(x)]=2xsin(x)+x2cos(x)\frac{d}{dx}\left[x^{2}\sin\left(x\right)\right] = 2x\sin\left(x\right) + x^{2}\cos\left(x\right)
  3. Power rule: d/dx uⁿ = n·uⁿ⁻¹·u′

    ddx[x2]=2x\frac{d}{dx}\left[x^{2}\right] = 2x
  4. d/dx sin x = cos x

    ddx[sin(x)]=cos(x)\frac{d}{dx}\left[\sin\left(x\right)\right] = \cos\left(x\right)
  5. Simplify

    f′(x)=2xsin(x)+x2cos(x)f^{\prime}(x) = 2x\sin\left(x\right) + x^{2}\cos\left(x\right)
  6. Evaluate at x = π/2

    Substitute the point into the derivative.

    f′(π2)=3.141592654f^{\prime}\left(\frac{\pi}{2}\right) = 3.141592654
  7. Write the tangent line

    Use the point-slope form with the point (a, f(a)) and slope f′(a).

    y=f(a)+f′(a)(x−a)⇒y=3.141592654x−2.4674011y = f(a) + f^{\prime}(a)(x - a) \;\Rightarrow\; y = 3.141592654x - 2.4674011

It finds the first to fifth derivative, the slope f′(a)f^{\prime}(a) at a point and the tangent line y=f(a)+f′(a)(x−a)y = f(a) + f^{\prime}(a)(x - a), with a graph.

By Hira Noor, mathematicianLast reviewed Free, no sign-up, runs in your browserReport a problem

How to use this calculator

  1. Type the function with x as the variable, for example x^3 - 2x^2 + 5, x^2 sin(x), e^(-x^2) or sqrt(x^2 + 1). Implicit multiplication such as 2x works; put function arguments in parentheses. The calculator differentiates explicit functions of x only, not implicit equations or partial derivatives.
  2. Choose the order, from the first derivative (the slope) to the fifth. The second derivative describes concavity, or acceleration when f is a position.
  3. Optionally enter a point a, such as 2, -1/3 or pi/4, to get the derivative at that point. For a first derivative you also get the tangent and normal lines.
  4. Angles are in radians. To work with an angle in degrees, convert inside the function: sine of x degrees is sin(pi x/180).
  5. Read the answer at the top, then open the steps. Each line names the differentiation rule applied to one part of the expression, outermost rule first.

Formulas

Limit definition of the derivative

f′(x)=limh→0f(x+h)−f(x)hf^{\prime}(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h}

Plain-text formula: f′(x) = lim_{h → 0} (f(x + h) − f(x))/h

The derivative is the limit of the slope of a secant line as its second point slides onto the first. Every differentiation rule below is proved from this limit.

Power rule

ddxxn=nxn−1\frac{d}{dx}x^n = n\,x^{n-1}

Plain-text formula: (d/(dx))x^n = n x^(n − 1)

Works for any constant exponent n, including negative and fractional ones, so ddxx=12x\frac{d}{dx}\sqrt{x} = \frac{1}{2\sqrt{x}} and ddx1x=−1x2\frac{d}{dx}\frac{1}{x} = -\frac{1}{x^2}.

Product and quotient rules

(uv)′=u′v+uv′,(uv)′=u′v−uv′v2(uv)^{\prime} = u^{\prime}v + uv^{\prime}, \qquad \left(\frac{u}{v}\right)^{\prime} = \frac{u^{\prime}v - uv^{\prime}}{v^2}

Plain-text formula: (uv)′ = u′v + uv′, (u/v)′ = (u′v − uv′)/v^2

u,vu, v
functions of x
u′,v′u^{\prime}, v^{\prime}
their derivatives

Use these when two expressions that both depend on x are multiplied or divided. A constant factor can simply be kept in front.

Chain rule

ddxf(g(x))=f′(g(x))⋅g′(x)\frac{d}{dx}f\left(g(x)\right) = f^{\prime}\left(g(x)\right) \cdot g^{\prime}(x)

Plain-text formula: (d/(dx))f(g(x)) = f′(g(x)) · g′(x)

Differentiate the outer function at the inner expression, then multiply by the derivative of the inner expression. For example ddxe−x2=e−x2⋅(−2x)\frac{d}{dx}e^{-x^2} = e^{-x^2} \cdot (-2x).

Tangent line at x = a

y=f(a)+f′(a)(x−a)y = f(a) + f^{\prime}(a)\,(x - a)

Plain-text formula: y = f(a) + f′(a) (x − a)

The line through the point (a, f(a)) with slope f′(a). It is the best straight-line approximation of f close to a.

Reading the result

The derivative f′(x)f^{\prime}(x) is itself a function: its value at any x is the slope of the graph of f there, or the instantaneous rate of change of f. If f′(2)=4f^{\prime}(2) = 4, then near x = 2 the function rises about 4 units for each unit increase in x.

Answers can be written in many equivalent forms. The calculator combines like terms and powers but does not expand or factor everything, so 2(x2+1)−4x2(x2+1)2\frac{2(x^2+1) - 4x^2}{(x^2+1)^2} is the same as 2−2x2(x2+1)2\frac{2 - 2x^2}{(x^2+1)^2}. To compare with a textbook answer, evaluate both at a test point.

If the derivative is not defined at your point, look at the graph there: a corner (|x| at 0), a cusp, a vertical tangent (the cube root at 0) or a break in the function all prevent a single slope.

How to find a derivative step by step

Work from the outside of the expression inward. 1. Rewrite roots and fractions as powers where it helps: x=x1/2\sqrt{x} = x^{1/2} and 1x2=x−2\frac{1}{x^2} = x^{-2}. 2. Split sums and differentiate each term separately. 3. Find the outermost operation: a product needs the product rule, a quotient the quotient rule, and a function of an inner expression the chain rule. 4. Use the basic derivatives in the tables below for the innermost pieces. 5. Simplify the result.

The calculator follows the same order, so each line of its steps matches one of these moves. For example x2sin⁡xx^2 \sin x is a product, so ddx[x2sin⁡x]=2xsin⁡x+x2cos⁡x\frac{d}{dx}\left[x^2 \sin x\right] = 2x \sin x + x^2 \cos x.

Finding a derivative from the limit definition

Before the shortcut rules, the derivative is defined as a limit. For f(x)=x2f(x) = x^2 the difference quotient is (x+h)2−x2h=2xh+h2h=2x+h\frac{(x + h)^2 - x^2}{h} = \frac{2xh + h^2}{h} = 2x + h.

As h→0h \to 0 this tends to 2x2x, so f′(x)=2xf^{\prime}(x) = 2x, the same answer the power rule gives at once. The calculator applies the rules directly, which agrees with the limit definition for every differentiable function and keeps the steps short. To practise evaluating limits themselves, use the limit calculator.

Derivative rules

Every derivative the calculator finds is built from these rules and the basic derivatives in the next table.

Differentiation rules with an example of each
RuleFormulaExample
Constantddxc=0\frac{d}{dx}c = 0ddx7=0\frac{d}{dx}7 = 0
Powerddxxn=nxn−1\frac{d}{dx}x^n = nx^{n-1}ddxx5=5x4\frac{d}{dx}x^5 = 5x^4
Constant multiple(cf)′=cf′(cf)^{\prime} = cf^{\prime}ddx4x3=12x2\frac{d}{dx}4x^3 = 12x^2
Sum and difference(f±g)′=f′±g′(f \pm g)^{\prime} = f^{\prime} \pm g^{\prime}ddx(x2−3x)=2x−3\frac{d}{dx}(x^2 - 3x) = 2x - 3
Product(uv)′=u′v+uv′(uv)^{\prime} = u^{\prime}v + uv^{\prime}ddxxex=ex+xex\frac{d}{dx}xe^x = e^x + xe^x
Quotient(uv)′=u′v−uv′v2\left(\frac{u}{v}\right)^{\prime} = \frac{u^{\prime}v - uv^{\prime}}{v^2}ddxxx+1=1(x+1)2\frac{d}{dx}\frac{x}{x + 1} = \frac{1}{(x + 1)^2}
Chainddxf(g(x))=f′(g(x))g′(x)\frac{d}{dx}f(g(x)) = f^{\prime}(g(x))\,g^{\prime}(x)ddxsin(3x)=3cos(3x)\frac{d}{dx}\sin(3x) = 3\cos(3x)
Exponentialddxax=axln⁡a\frac{d}{dx}a^x = a^x \ln addx2x=2xln⁡2\frac{d}{dx}2^x = 2^x \ln 2

Common derivatives

Use these with the chain rule when the input is an expression rather than x alone: ddxln(x2+1)=2xx2+1\frac{d}{dx}\ln(x^2 + 1) = \frac{2x}{x^2 + 1}.

Read from right to left, the table lists antiderivatives: cos⁡x\cos x integrates to sin⁡x+C\sin x + C. The integral calculator works in that direction, step by step.

Derivatives of common functions
Function f(x)f(x)Derivative f′(x)f^{\prime}(x)
sin⁡x\sin xcos⁡x\cos x
cos⁡x\cos x−sin⁡x-\sin x
tan⁡x\tan xsec2⁡x\sec^2 x
exe^xexe^x
ln⁡x\ln x1x\frac{1}{x}
logb⁡x\log_b x1xln⁡b\frac{1}{x \ln b}
x\sqrt{x}12x\frac{1}{2\sqrt{x}}
1x\frac{1}{x}−1x2-\frac{1}{x^2}
arcsin⁡x\arcsin x11−x2\frac{1}{\sqrt{1 - x^2}}
arctan⁡x\arctan x11+x2\frac{1}{1 + x^2}
|x||x|x|x|\frac{x}{|x|} for x≠0x \neq 0
xxx^xxx(ln⁡x+1)x^x(\ln x + 1)

Tangent and normal lines

Enter a point a with the first derivative selected to use the page as a tangent line calculator. The tangent line touches the graph at (a, f(a)) with slope f′(a). The normal line passes through the same point at a right angle to it, so its slope is −1f′(a)-\frac{1}{f^{\prime}(a)}.

For f(x)=xf(x) = \sqrt{x} at a = 4: f(4)=2f(4) = 2 and f′(4)=124=14f^{\prime}(4) = \frac{1}{2\sqrt{4}} = \frac{1}{4}, so the tangent line is y=14x+1y = \frac{1}{4}x + 1 and the normal line is y=−4x+18y = -4x + 18. For the slope of a straight line through two points, use the slope calculator.

Higher derivatives

The second derivative is the derivative of the derivative. Where f′′(x)>0f^{\prime\prime}(x) > 0 the graph is concave up (it bends like a cup) and where f′′(x)<0f^{\prime\prime}(x) < 0 it is concave down. Points where it changes sign are inflection points. In physics, if f is position, f′ is velocity and f″ is acceleration.

The calculator goes up to the fifth derivative, differentiating once per pass and showing the steps of each pass. For x5−3x4x^5 - 3x^4 the fourth derivative is 120x−72120x - 72. Higher derivatives appear in Taylor series: f(a+h)≈f(a)+f′(a)h+f′′(a)2h2+f′′′(a)6h3f(a + h) \approx f(a) + f^{\prime}(a)h + \frac{f^{\prime\prime}(a)}{2}h^2 + \frac{f^{\prime\prime\prime}(a)}{6}h^3.

Worked example

Differentiate f(x) = x³ − 2x² + 5 and find the tangent at x = 2

Find f′(x), the slope at x = 2 and the equation of the tangent line there.

  1. Sum rule: differentiate each term separately.
  2. Power rule: ddxx3=3x2\frac{d}{dx}x^3 = 3x^2 and ddx2x2=4x\frac{d}{dx}2x^2 = 4x; the constant 5 has derivative 0. So f′(x)=3x2−4xf^{\prime}(x) = 3x^2 - 4x.
  3. Slope at x = 2: f′(2)=3(4)−4(2)=12−8=4f^{\prime}(2) = 3(4) - 4(2) = 12 - 8 = 4.
  4. Point on the curve: f(2)=8−8+5=5f(2) = 8 - 8 + 5 = 5.
  5. Tangent line: y=5+4(x−2)=4x−3y = 5 + 4(x - 2) = 4x - 3.

Answer: f′(x)=3x2−4xf^{\prime}(x) = 3x^2 - 4x, the slope at x = 2 is exactly 4, and the tangent line is y = 4x − 3.

Frequently asked questions

Is this derivative calculator free, and does it show all the steps?

Yes. It is free with no sign-up and no daily limit, and the full step-by-step working is shown for every function, with the rule named on each line. It runs in your browser.

Can it find implicit or partial derivatives?

No. It differentiates explicit functions of one variable, x. Implicit differentiation (of an equation such as x2+y2=25x^2 + y^2 = 25) and partial derivatives of functions of several variables are not supported. For an implicit curve, solve for y where you can, or differentiate both sides by hand and use the calculator to check each piece.

How do you differentiate x^x?

Neither the power rule nor the exponential rule applies, because both the base and the exponent change. Take logs: ln⁡y=xln⁡x\ln y = x \ln x, so y′y=ln⁡x+1\frac{y^{\prime}}{y} = \ln x + 1 and y′=xx(ln⁡x+1)y^{\prime} = x^x(\ln x + 1). The calculator uses the general power rule ddxuv=uv(v′ln⁡u+vu′u)\frac{d}{dx}u^v = u^v\left(v^{\prime}\ln u + \frac{vu^{\prime}}{u}\right), which gives the same result.

Why does the calculator use radians?

Because the standard rules depend on it: ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x is true only when x is in radians. In degrees an extra factor appears, ddxsin(x∘)=π180cos(x∘)\frac{d}{dx}\sin(x^\circ) = \frac{\pi}{180}\cos(x^\circ). Enter sin(pi x/180) if your variable is in degrees.

Why does my answer look different from the one in my book?

Derivatives can be simplified in several equivalent ways, such as factored or expanded. Evaluate both forms at the same x (enter it as the point) and compare the numbers; equal values at a few points are a good sign the forms agree.

How is the tangent line calculated?

The calculator evaluates f(a) and f′(a) and substitutes them into y=f(a)+f′(a)(x−a)y = f(a) + f^{\prime}(a)(x - a), then rearranges to y = mx + b. When a and every operation are rational, the slope and intercept are exact fractions.

Can it differentiate floor, ceiling or rounding functions?

No. Step functions jump at their break points, so they have no derivative there, and their derivative is 0 everywhere else. The calculator says so instead of returning a misleading formula.

What is the numerical check?

An independent estimate of the derivative at your point from central differences refined by Richardson extrapolation, for first and second derivatives. It normally agrees with the formula to about 10 digits; a mismatch points to a function that is not smooth there.

What does the second derivative tell me?

It measures how the slope changes. A positive value means the graph is concave up, a negative value concave down. At a critical point (f′ = 0), a positive second derivative indicates a local minimum and a negative one a local maximum.

Integral Calculator

Antiderivatives with named steps, plus definite and improper integrals with an error estimate and area graph.

Calculus

Limit Calculator

Two-sided, one-sided and infinite limits with steps, a table of values and the indeterminate form named.

Calculus

Function Table Calculator

Tables of values for one or two functions with exact fractions, roots, turning points, a graph and CSV.

Calculus

Slope Calculator

Slope from two points, an equation or rise and run, as a fraction, angle and percent grade, with steps.

Algebra & Equations

Step-by-Step Math Solver

Free worked solutions for equations, systems, inequalities, factoring, derivatives, integrals, limits and matrices.

Tools

Graphing Calculator

Plot functions, equations, inequalities, parametric and polar curves; find roots and intersections.

Tools

Learn more: For derivatives, integrals and limits inside the full calculator, read the calculus functions manual. What steps and graphs add explains how to use the worked steps to check your own work.

Sources and further reading

  1. Calculus Volume 1, Chapter 3: Derivatives (opens in a new tab), OpenStax, Rice University
  2. 18.01SC Single Variable Calculus, Unit 1: Differentiation (opens in a new tab), MIT OpenCourseWare
  3. NIST Digital Library of Mathematical Functions, §1.4 Calculus of One Variable (opens in a new tab), National Institute of Standards and Technology

Results are calculated in your browser with methods checked by automated tests, and are intended for learning and general use. For engineering, medical, financial, legal or safety-critical decisions, verify important values independently and follow the rounding rules your work requires. How accurate are these results?