Skip to content
Calcapedia
Math

Derivative Calculator

Find the derivative of a function written in x, with the rule used at every step, then get the slope and the tangent line at any point.

Level: Grade 12 to college

Printable worksheet

Derivative Calculator

Inputs

Use x as the variable, ^ for powers and * or a space for multiplication. Functions: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, ln, log, sqrt, cbrt, abs, exp; constants pi and e. Angles are in radians.

Derivative

Optional. Gives the slope there and, for the first derivative, the tangent line.

Result

Derivative f′(x)

2x·sin(3x) + 3x^2·cos(3x)

f′(x) = 2x·sin(3x) + 3x^2·cos(3x). At x = 1 it equals −2.687737.

f′(1), the slope at that point
-2.687737
Check using nearby values (finite differences)
Agrees: about −2.687737
f(1)
0.14112
Tangent line at that point
y = −2.687737x + 2.828857

See the step-by-step solution ↓

Step-by-step solution

  1. First, read the function in the usual order of operations. x is the variable, and angles are in radians

    f(x) = x^2·sin(3x)
  2. Product rule, for two parts multiplied together: (uv)′ = u′v + uv′

    d/dx [x^2·sin(3x)] = 2x·sin(3x) + 3x^2·cos(3x)
  3. Power rule: bring the power down in front and lower it by 1, (x^n)′ = n·x^(n − 1)

    d/dx [x^2] = 2x
  4. Chain rule with d/du sin(u) = cos(u): multiply by the derivative of the inside

    d/dx [sin(3x)] = 3cos(3x)
  5. Constant multiple rule: keep the constant factor and differentiate the rest

    d/dx [3x] = 3
  6. Tidy up: combine like terms and simplify

    f′(x) = 2x·sin(3x) + 3x^2·cos(3x)
  7. Put x = 1 into f′(x) to get its value at that point

    f′(1)=−2.6877374737
  8. The point on the curve: f(1)

    f(1)=0.1411200081
  9. The tangent line has the same slope at that point: y = f′(a)(x − a) + f(a), written as y = slope × x + intercept

    y = −2.687737x + 2.828857

Test yourself

20 quick questions built from this calculator's formula: work out results, predict what happens when an input changes, and work backward from an answer. Every answer comes with the working.

What this calculator does

Find out how fast a function is changing, with every rule shown step by step. That rate of change is called the derivative. On a graph, the derivative at a point is the slope (steepness) of the tangent line there. The tangent line is the straight line that just touches the curve at that point. The slope is positive where the curve climbs, negative where it falls and zero at a peak or a valley. To find it by hand, you apply a small set of rules over and over. You work from the outside of the expression inward.

Type a function that uses x, and the calculator finds its derivative the way you would on paper. It lists which rule it used on each piece. These include the sum and constant multiple rules, and the power, product and quotient rules. They also include the chain rule, and the rules for exponentials, logarithms and trig functions. The answer is tidied up by combining like terms. Choose the first, second or third derivative. Add a value of x to get the slope there, the point on the curve and the equation of the tangent line. Every answer is also double-checked with numbers.

Where it's used

Why this math matters outside the classroom:

  • Velocity from position. A ball with height h(t) = 20t − 4.9t² m has velocity h′(t) = 20 − 9.8t, so it stops rising at about t = 2.04 s.
  • Marginal cost. A factory with cost C(q) = 0.02q² + 3q + 400 dollars has marginal cost C′(q) = 0.04q + 3, or $7 per unit at q = 100.
  • Best fence layout. A farmer fencing three sides of a plot with 100 m maximizes A = x(100 − 2x) where A′ = 100 − 4x = 0, at x = 25 m.
  • Growth rates. A culture following P(t) = 500e^(0.2t) grows at P′(t) = 100e^(0.2t), about 272 cells per hour at t = 5.
  • Tangent lines. Students find the tangent to y = x³ at x = 2 from the slope 3 × 2² = 12, which gives the line y = 12x − 16.

How to use it

  1. Type the function using x as the variable, for example x^3 − 2x + 1, sin(x^2) or e^(2x)/(x + 1). A space or * means multiply, and angles are in radians.
  2. Choose whether you want the first, second or third derivative.
  3. If you like, enter a value of x to find the derivative's value there. For the first derivative you also get f(x) and the tangent line at that point.
  4. Open the working to see each rule applied, from the whole expression down to its smallest pieces, and the simplified result.

What the inputs mean

Function f(x)
Write powers with ^, as in x^2. Write 3x or 3*x to multiply. Multiplying without a sign is read left to right along with × and ÷, so 1/2x means (1/2)·x. Use brackets for anything inside a function: sin(3x), sqrt(x^2 + 1). Supported: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, ln, log (base 10), sqrt, cbrt, abs, exp, and the constants pi and e.
Evaluate at x =
Leave it blank to get only the derivative formula. If the derivative has no value at that x, for example 1/x at 0, the calculator tells you instead of giving a number.

Formula and method

(u + v)′ = u′ + v′,  (c·u)′ = c·u′
(xⁿ)′ = n·xⁿ⁻¹
(u·v)′ = u′·v + u·v′
(u ÷ v)′ = (u′·v − u·v′) ÷ v²
f(g(x))′ = f′(g(x))·g′(x)   (chain rule)
(eᵘ)′ = eᵘ·u′,  (ln u)′ = u′ ÷ u,  (sin u)′ = cos(u)·u′,  (cos u)′ = −sin(u)·u′

In these rules, u and v stand for any two pieces of the function, and c is a constant (a fixed number). n is a power, and the mark ′ ("prime") means "the derivative of". f(g(x)) is one function, f, with another function, g, inside it. e is the number about 2.718, and ln is the natural logarithm.

Derivatives split over sums: the derivative of a sum is the sum of the derivatives. Constant factors pass straight through. So any polynomial (a sum of powers of x) can be done one term at a time with the power rule.

Products and quotients need their own rules, because the derivative of a product isn't the product of the derivatives. The chain rule handles a function inside another function. Find the derivative of the outer function as if its inside were plain x. Then multiply by the derivative of the inside.

The calculator breaks the expression into a tree of pieces and applies these rules to each one in turn. It records the rule used at each piece. Then it tidies the result by working out plain numbers, combining like terms and merging powers of the same base. For powers that contain x, such as x^x, it takes logarithms first (logarithmic differentiation). Higher derivatives repeat the whole process on the previous result.

Worked example

Find the derivative of f(x) = x²·sin(3x) and the slope of its graph at x = 1.

  1. The function is a product, so use the product rule with u = x² and v = sin(3x): f′ = u′·v + u·v′.
  2. Power rule: u′ = 2x. Chain rule: v′ = cos(3x) × 3 = 3cos(3x), because the inside, 3x, has derivative 3.
  3. Combine: f′(x) = 2x·sin(3x) + 3x²·cos(3x).
  4. At x = 1 (in radians): f′(1) = 2 sin 3 + 3 cos 3 ≈ −2.687737.

Result: f′(x) = 2x·sin(3x) + 3x²·cos(3x), and the slope at x = 1 is about −2.687737. With f(1) = sin 3 ≈ 0.14112, the tangent line there is y = −2.687737x + 2.828857.

Understanding the result

A positive derivative means the function is going up at that point. A negative one means it's going down. Zero marks a possible high point, low point or flat spot where the bend changes direction (a flat inflection). The size of the derivative tells you how steep the graph is.

The second derivative describes how the graph bends. Positive means it bends upward like a cup, and negative means it bends downward. In motion problems, if f gives position over time, f′ is velocity and f″ is acceleration.

Assumptions and limitations

  • The variable is x, and all trig functions use radians, which the standard derivative rules need.
  • Simplifying cancels shared factors such as x/x. That can hide a point where the original expression had no value.
  • Results are simplified, but not always into the shortest possible form. A textbook's version may look different and still be correct.
  • Partial derivatives, implicit differentiation and functions of several variables aren't supported. Neither are factorials or percent signs.
  • abs(x) gives x/abs(x), which has no value at x = 0, where the graph has a corner.

Frequently asked questions

Why are the answers in radians?

The rule that the derivative of sin x is cos x only works when x is measured in radians. In degrees, every trig derivative would pick up an extra factor of π/180. That's why calculus is done in radians.

How do I know when to use the chain rule?

Use it whenever a function has something other than plain x inside it, such as sin(3x), e^(x²) or (2x + 1)^5. Find the derivative of the outer function and keep the inside unchanged. Then multiply by the derivative of the inside.

My textbook's answer looks different. Is one of them wrong?

Not necessarily. The same derivative can be written many ways. For example, 1/cos(x)^2 and sec²(x) are the same, and a fraction can be split into two terms. Enter a value of x and compare both forms as numbers. If they match at several points, they agree.

What is the tangent line?

It's the straight line that touches the curve at the chosen point and has the same slope there: y = f′(a)(x − a) + f(a). Here a is the chosen x. Near that point, it's the best straight-line match for the curve.

How is the result checked?

When you enter a value of x, the calculator also estimates the derivative from nearby values of the function. It uses a refined central difference, which compares points just to the left and right. Then it tells you whether that estimate agrees with the exact answer.

How this calculator is checked

Method: Standard differentiation rules (linearity, power, product, quotient, chain, exponential, logarithmic, trigonometric, inverse trigonometric and hyperbolic derivatives) applied to the safe expression parser's tree; results cross-checked by Richardson-extrapolated central differences. The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-18. Found a problem? Tell us.

Embed this calculator

Put this Derivative Calculator on your own website or blog for free. Paste this code where you want it to appear: