Derivative of tanh x
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.
How to find the derivative of tanh x
Method: quotient rule.
- 1Write tanh x as a fraction: tanh x = sinh x / cosh x.
- 2Apply the quotient rule: (cosh x · cosh x − sinh x · sinh x) / cosh²x.
- 3Use the identity cosh²x − sinh²x = 1: this is 1/cosh²x.
- 4That 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.
| x | tanh x | sech²x | Slope, measured |
|---|---|---|---|
| −2 | −0.964028 | 0.0706508 | 0.0706508 |
| −1 | −0.761594 | 0.419974 | 0.419974 |
| 0 | 0 | 1 | 1 |
| 1 | 0.761594 | 0.419974 | 0.419974 |
| 2 | 0.964028 | 0.0706508 | 0.0706508 |
Second derivative
Differentiating once more gives:
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?
What is the second derivative of tanh x?
Keep going
Type your own function into the derivative calculator and see every rule applied, step by step.