Graph of tanh x (hyperbolic tangent)
The hyperbolic tangent, tanh x = sinh x / cosh x, squeezes every real number into the interval from −1 to 1. Its graph is an S-curve through the origin with slope 1 there, flattening toward y = 1 and y = −1.
Key features
- Domain
- All real numbers
- Range
- −1 < y < 1
- Formula
- tanh x = (eˣ − e⁻ˣ)/(eˣ + e⁻ˣ)
- Horizontal asymptotes
- y = 1 and y = −1
- Slope at the origin
- 1
- Symmetry
- Odd
- y-intercept
- None
- Derivative
- 1−tanh(x)2
- Antiderivative
- ln(cosh(x))+C
Derivative and antiderivative from the calculator’s algebra system. Domain, range and asymptotes are stated for real x.
What the graph of tanh x looks like
Near the origin tanh x ≈ x. By x = 3 it is already 0.995, so the curve flattens quickly toward its asymptotes, much faster than arctan x does.
It is closely related to the logistic function: tanh x = 2σ(2x) − 1, where σ(x) = 1/(1 + e⁻ˣ). Both are smooth step functions.
Its derivative is 1 − tanh²x = sech²x, a bell-shaped curve peaking at 1 when x = 0.
Points of interest
Found numerically to about twelve digits in the window −5 ≤ x ≤ 5, then shown in exact form where one exists.
- x-intercepts (roots)
- x = 0
- Local maxima
- None in this window
- Local minima
- None in this window
- Inflection points
- (0, 0)
Table of values
A few points to plot, with exact values where they are simple.
| x | y = tanh x |
|---|---|
| −3 | −0.995055 |
| −2 | −0.964028 |
| −1 | −0.761594 |
| 0 | 0 |
| 1 | 0.761594 |
| 2 | 0.964028 |
| 3 | 0.995055 |
How to graph tanh x by hand
- 1Draw the asymptotes y = 1 and y = −1.
- 2Plot (0, 0), (1, 0.76), (2, 0.96) and their negatives.
- 3Draw an S-curve with slope 1 at the origin, hugging the asymptotes beyond |x| = 3.
Transformations
How the graph moves when you change the formula. The original is tanh x in blue.
y = atan(x)*2/piArctan scaled to the same range: it approaches ±1 much more slowly.y = tanh(3x)A sharper switch, approaching a step function as the factor grows.y = 1/(1 + e^(-x))The logistic sigmoid, which runs from 0 to 1 instead.
Where it shows up
- Activation functions in neural networks.
- The velocity of a falling object with quadratic air resistance, v(t) = v_terminal tanh(gt/v_terminal).
Frequently asked questions
What is the range of tanh x?
What is the derivative of tanh x?
How is tanh related to the sigmoid function?
Its derivative and integral
Related graphs
The S-curve from 0 to 1, midpoint (0, ½).
All real inputs, outputs between −π/2 and π/2.
(eˣ − e⁻ˣ)/2: odd, increasing, through the origin.
The catenary: the shape of a hanging chain.
Period π, asymptotes at π/2 + nπ, always increasing.
The bell curve: peak (0, 1), area √π.
Change the window, add sliders for a, b, h and k, trace the curve with your keyboard, or overlay its derivative.