Derivative of tanh x: Formula, Proof and Examples
The derivative of tanh x is sech² x, which equals 1 − tanh² x. See the quotient rule proof, chain rule examples, a graph and the arctanh derivative.
Hyperbolic derivatives Updated 2 min read
At a glance
- Derivative
- \operatorname{sech}^2 x = \dfrac{1}{\cosh^2 x}
- Equivalent form
- 1 - \tanh^2 x
- Definition
- \tanh x = \dfrac{\sinh x}{\cosh x}
- Range of tanh x
- (-1, 1)
- Inverse derivative
- \dfrac{d}{dx}\operatorname{artanh} x = \dfrac{1}{1 - x^2} for \lvert x\rvert < 1
On this page
The derivative of \tanh x is \operatorname{sech}^2 x, which you can also write as 1 - \tanh^2 x.
Here \operatorname{sech} x = \frac{1}{\cosh x}, so \operatorname{sech}^2 x = \frac{1}{\cosh^2 x}.
Proof with the quotient rule
Write \tanh x = \frac{\sinh x}{\cosh x} and use the quotient rule, with the derivative of sinh x being \cosh x and the derivative of cosh x being \sinh x:
The hyperbolic identity \cosh^2 x - \sinh^2 x = 1 simplifies the top:
Splitting the fraction instead gives the other form: \frac{\cosh^2 x}{\cosh^2 x} - \frac{\sinh^2 x}{\cosh^2 x} = 1 - \tanh^2 x.
Graph of tanh x and its derivative
The derivative is always positive, so \tanh x always increases. But it never reaches \pm 1; those are horizontal asymptotes. Compare the derivative of arctan x, another S-curve with slope 1 at the origin, though arctan approaches its asymptotes much more slowly.
Comparing tan and tanh
| Function | Derivative | In terms of itself |
|---|---|---|
| \tan x | \sec^2 x | 1 + \tan^2 x |
| \tanh x | \operatorname{sech}^2 x | 1 - \tanh^2 x |
The sign flip comes from the identities: \sec^2 x = 1 + \tan^2 x but \operatorname{sech}^2 x = 1 - \tanh^2 x.
Chain rule version and examples
Example 1. \frac{d}{dx}\tanh(2x) = 2\operatorname{sech}^2(2x).
Example 2. \frac{d}{dx}\tanh(x^2) = 2x\operatorname{sech}^2(x^2).
Example 3: a log. \frac{d}{dx}\ln(\cosh x) = \frac{\sinh x}{\cosh x} = \tanh x. So \int\tanh x\,dx = \ln(\cosh x) + C.
Example 4: a value. At x = 1, \tanh 1 \approx 0.7616, so the slope is 1 - 0.7616^2 \approx 0.420.
Where 1 − tanh² x shows up
In machine learning, \tanh is a common activation function. Training needs its derivative many times, and 1 - \tanh^2 x lets a program reuse the value of \tanh x it already computed instead of evaluating \cosh x.
Derivative of artanh x
For \lvert x\rvert < 1, set \tanh y = x. Then (1 - \tanh^2 y)\,y' = 1, so
Common mistakes
- Writing \sec^2 x. That is the derivative of the circular tangent.
- Writing 1 + \tanh^2 x. The hyperbolic version has a minus sign.
- Forgetting the inside derivative. \frac{d}{dx}\tanh(3x) = 3\operatorname{sech}^2(3x).
The hyperbolic functions page covers \operatorname{sech}, \operatorname{csch} and \coth as well.
Practice it now
The quotient rule
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson