Derivative of tanh(x)
The derivative of the hyperbolic tangent is $\dfrac{d}{dx}\tanh x = \operatorname{sech}^2 x = 1 - \tanh^2 x = \dfrac{1}{\cosh^2 x}$. All three forms are equal.
See the derivative of tanh(x) step by step in the calculator →
📈 Graph of tanh(x) and its derivative
🔍 Why is the derivative of tanh(x) equal to $1-\tanh^2 x$?
Write $\tanh x = \frac{\sinh x}{\cosh x}$ and use the quotient rule together with $\cosh^2 x - \sinh^2 x = 1$:
The form $1-\tanh^2 x$ expresses the derivative through the function value itself. That is why tanh is used as an activation function in neural networks: once $\tanh x$ is computed, the slope costs one multiplication.
🔗 Derivative of tanh(x) with an inner function
If the argument is a function $u(x)$, the chain rule adds the inner derivative:
✏️ Worked examples
⚠️ Common mistakes
Writing $1+\tanh^2 x$ – that is the derivative of $\tan x$, not of $\tanh x$.
Confusing $\operatorname{sech}^2 x$ with $\sec^2 x$.
❓ Frequently asked questions
Is the derivative of tanh(x) equal to 1 − tanh²(x)?
Yes. $\frac{d}{dx}\tanh x = 1-\tanh^2 x = \operatorname{sech}^2 x$.
What is the maximum slope of tanh(x)?
$1$, at $x = 0$.
What is the second derivative of tanh(x)?
$-2\tanh x\,\operatorname{sech}^2 x$.