Skip to content
ihateDesmos

Derivative of tanh x

Updated 6 November 2026 · Checked numerically by the ihateDesmos engine
The derivative of tanh x
ddx(tanh(x))=sech(x)2

The derivative of tanh x is sech²x, which equals 1/cosh²x. It has the same form as the derivative of tan x, and looks like a bell-shaped bump.

−22−110
Open in calculator
y=tanh(x)
in blue and its derivative
y=sech(x)2
in red.

How to find the derivative of tanh x

Method: quotient rule.

  1. 1
    Write tanh x as a fraction: tanh x = sinh x / cosh x.
  2. 2
    Apply the quotient rule: (cosh x · cosh x − sinh x · sinh x) / cosh²x.
  3. 3
    Use the identity cosh²x − sinh²x = 1: this is 1/cosh²x.
  4. 4
    That is sech²x.

What it means on the graph

tanh x is an S-curve that runs from −1 to 1. Its slope peaks at 1 at x = 0, and fades to 0 either side as the curve levels off. Neural networks have used it as an activation function, which is why this derivative matters there.

Table of values

The derivative column uses the formula. The last column estimates the slope directly from the original function, as an independent check.

Values of tanh x and its derivative
xtanh xsech²xSlope, measured
−2−0.9640280.07065080.0706508
−1−0.7615940.4199740.419974
0011
10.7615940.4199740.419974
20.9640280.07065080.0706508

Second derivative

Differentiating once more gives:

d2dx2(tanh(x))=−2sech(x)2tanh(x)

The second derivative tells you which way the graph bends: positive means it curves upward, and negative means it curves downward.

Common mistakes

  • Writing sec²x, which belongs to tan x.

Frequently asked questions

What is the derivative of tanh x?
The derivative of tanh x is sech²x.
What is the second derivative of tanh x?
Differentiate sech²x again to get the second derivative. The result is shown on this page under “Second derivative”.

Keep going

Differentiate any function

Type your own function into the derivative calculator and see every rule applied, step by step.

Open the derivative calculator