practicecalculus
Hyperbolic derivatives

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

\frac{d}{dx}\,\tanh x = \operatorname{sech}^2 x
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
  1. Proof with the quotient rule
  2. Graph of tanh x and its derivative
  3. Comparing tan and tanh
  4. Chain rule version and examples
  5. Where 1 − tanh² x shows up
  6. Derivative of artanh x
  7. Common mistakes

The derivative of \tanh x is \operatorname{sech}^2 x, which you can also write as 1 - \tanh^2 x.

\frac{d}{dx}\,\tanh x = \operatorname{sech}^2 x = 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:

\frac{d}{dx}\,\frac{\sinh x}{\cosh x} = \frac{\cosh x\cdot\cosh x - \sinh x\cdot\sinh x}{\cosh^2 x} = \frac{\cosh^2 x - \sinh^2 x}{\cosh^2 x}

The hyperbolic identity \cosh^2 x - \sinh^2 x = 1 simplifies the top:

\frac{d}{dx}\tanh x = \frac{1}{\cosh^2 x} = \operatorname{sech}^2 x

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

Graph of y = tanh x and its derivative y = sech² x
The hyperbolic tangent is an S-shaped curve between -1 and 1. Its slope is 1 at the origin and fades to 0 on both sides.

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

\frac{d}{dx}\tanh u = \operatorname{sech}^2 u\cdot u'

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

\frac{d}{dx}\operatorname{artanh} x = \frac{1}{1 - x^2}

Common mistakes

  1. Writing \sec^2 x. That is the derivative of the circular tangent.
  2. Writing 1 + \tanh^2 x. The hyperbolic version has a minus sign.
  3. 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

Frequently asked questions

What is the derivative of tanh x?

The derivative of \tanh x is \operatorname{sech}^2 x, which also equals 1 - \tanh^2 x.

What is the derivative of tanh(2x)?

By the chain rule it is 2\operatorname{sech}^2(2x).

Why is the derivative of tanh written as 1 − tanh² x?

Because \operatorname{sech}^2 x = 1 - \tanh^2 x. Divide \cosh^2 x - \sinh^2 x = 1 by \cosh^2 x to see it. This form lets you compute the slope from the value of \tanh x alone.

What is the derivative of arctanh x?

For \lvert x\rvert < 1, \frac{d}{dx}\operatorname{artanh} x = \frac{1}{1 - x^2}.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.