The hyperbolic tangent function, denoted tanh, is a mathematical function defined as the ratio of the hyperbolic sine to the hyperbolic cosine: tanh(x) = sinh(x)/cosh(x). It maps real numbers to the interval (−1, 1) and is an odd, smooth, and monotonically increasing function. Widely used in applied mathematics, tanh appears in fields such as differential equations, signal processing, and neural networks, where it serves as an activation function due to its S‑shaped curve and bounded output.

1 Definition and fundamental properties

1.1 Analytic definition

For any real number \(x\), the hyperbolic tangent is defined analytically by

\[ \tanh x = \frac{\sinh x}{\cosh x} = \frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}. \]

1.1.1 Relationship to exponential function

The expression in terms of exponentials shows that \(\tanh x = 1 - \frac{2}{e^{2x}+1} = \frac{2}{1+e^{-2x}}-1\), which connects the function to the logistic sigmoid.

1.2 Basic properties

1.2.1 Domain and range

The domain of \(\tanh\) is all real numbers. Its range is the open interval \((-1, 1)\); the function approaches but never reaches ±1 as \(x \to \pm\infty\).

1.2.2 Parity (oddness)

\(\tanh\) is an odd function: \(\tanh(-x) = -\tanh x\) for all \(x\).

1.2.3 Monotonicity and limits

The function is strictly increasing on \(\mathbb{R}\). Limits at infinity are

\[ \lim_{x\to\infty}\tanh x = 1,\qquad \lim_{x\to -\infty}\tanh x = -1. \]

1.3 Derivatives and integrals

1.3.1 First derivative

\[ \frac{d}{dx}\tanh x = \operatorname{sech}^2 x = 1 - \tanh^2 x. \]

The derivative is positive everywhere, consistent with monotonic increase.

1.3.2 Higher-order derivatives

Higher derivatives can be expressed in terms of \(\tanh\) and its powers. For example,

\[ \frac{d^2}{dx^2}\tanh x = -2\tanh x\,\operatorname{sech}^2 x. \]

1.3.3 Indefinite integral

\[ \int \tanh x \, dx = \ln(\cosh x) + C. \]

2 Algebraic and trigonometric identities

2.1 Addition formulas

\[ \tanh(x \pm y) = \frac{\tanh x \pm \tanh y}{1 \pm \tanh x \tanh y}. \]

2.2 Double‑angle and half‑angle formulas

\[ \tanh(2x) = \frac{2\tanh x}{1+\tanh^2 x},\qquad \tanh\left(\frac{x}{2}\right) = \frac{\sinh x}{\cosh x + 1} = \frac{\cosh x - 1}{\sinh x}. \]

2.3 Sum‑to‑product and product‑to‑sum

\[ \tanh x \pm \tanh y = \frac{\sinh(x \pm y)}{\cosh x \cosh y}. \]

2.4 Relationship to circular tangent

For imaginary arguments, \(\tanh(ix) = i\tan x\). More generally, \(\tanh(x+iy)\) relates to the circular tangent via the Gudermannian function.

3 Series expansions and approximations

3.1 Taylor series

The Taylor series about \(x=0\) is

\[ \tanh x = x - \frac{x^3}{3} + \frac{2x^5}{15} - \frac{17x^7}{315} + \cdots, \]

with radius of convergence \(\pi/2\).

3.2 Continued fraction representation

A continued fraction expansion valid for all real \(x\) is

\[ \tanh x = \cfrac{x}{1 + \cfrac{x^2}{3 + \cfrac{x^2}{5 + \cfrac{x^2}{7 + \ddots}}}}. \]

3.3 Padé approximants

Low‑order Padé approximants provide efficient rational approximations. For example,

\[ \tanh x \approx \frac{x(15 + x^2)}{15 + 6x^2} \quad \text{(Padé [1/2])}, \]

accurate for moderate \(x\).

4.1 Inverse hyperbolic tangent (artanh)

The inverse function is \(\operatorname{artanh} x = \frac{1}{2}\ln\frac{1+x}{1-x}\), defined for \(x<1\).

4.1.1 Definition and branch cuts

For real arguments, \(\operatorname{artanh}\) is single‑valued. On the complex plane, branch cuts are usually taken along \((-\infty,-1]\) and \([1,\infty)\) to ensure analyticity.

4.1.2 Series for artanh

\[

\operatorname{artanh} x = x + \frac{x^3}{3} + \frac{x^5}{5} + \frac{x^7}{7} + \cdots,\quadx<1.

\]

4.2 Relationship to Gudermannian function

The Gudermannian function \(\operatorname{gd}(x)\) satisfies \(\tanh x = \sin(\operatorname{gd} x)\) and provides a direct link between hyperbolic and circular functions.

5 Applications in applied mathematics

5.1 Neural networks and activation functions

\(\tanh\) is a common activation function in artificial neural networks. Its output is zero‑centered, which can facilitate learning.

5.1.1 Comparison with logistic sigmoid

Unlike the logistic sigmoid \(\sigma(x) = 1/(1+e^{-x})\) whose output range is (0,1), \(\tanh\) outputs values in (−1,1). This symmetry often leads to faster convergence in practice.

5.1.2 Vanishing gradient considerations

Because the derivative \(\tanh'(x) = 1-\tanh^2(x)\) saturates to zero for large \(x\), deep networks using \(\tanh\) may suffer from vanishing gradients. Rectified linear units (ReLU) are often preferred to mitigate this issue.

5.2 Differential equations

5.2.1 Solutions to the logistic growth equation

The logistic differential equation \(\frac{dy}{dt} = r y (1-y/K)\) has a solution expressible via \(\tanh\) after a change of variable.

5.2.2 Soliton solutions and the Korteweg–De Vries equation

The Korteweg–De Vries (KdV) equation admits solitary‑wave solutions of the form \(u(x,t) = A\operatorname{sech}^2(kx-\omega t)\), where \(\operatorname{sech}^2\) relates to \(\tanh\) through the derivative.

5.3 Signal processing and control theory

5.3.1 Soft clipping and saturation modeling

The tanh function is used to model soft saturation in amplifiers and as a soft‑clipping nonlinearity in audio processing, smoothly limiting signal amplitude.

5.3.2 State estimation (extended Kalman filter)

In nonlinear filtering, \(\tanh\) can serve as a differentiable nonlinearity when composing state transition or observation models.

5.4 Numerical methods

5.4.1 Computation of tanh (CORDIC, polynomial approximations)

Efficient evaluation of \(\tanh\) is achieved via CORDIC algorithms, Padé approximants, or piecewise polynomial interpolation.

5.4.2 Use in boundary value problems

The tanh function appears in coordinate transformations (e.g., tanh‑spacing) to cluster grid points near boundaries in numerical solution of PDEs.

6 Generalizations

6.1 Tanh for complex arguments

For a complex number \(z\), \(\tanh z = \frac{e^z - e^{-z}}{e^z + e^{-z}}\). It is meromorphic on \(\mathbb{C}\).

6.1.1 Periodicity and poles

\(\tanh\) is periodic with period \(i\pi\). It has simple poles at \(z = i\pi(k+1/2)\) for integer \(k\).

6.1.2 Relationship to tangent

\(\tanh(i z) = i \tan z\), and conversely \(\tan(i z) = i \tanh z\).

6.2 Matrix hyperbolic tangent

For a square matrix \(A\), \(\tanh A\) can be defined via the matrix exponential as \(\tanh A = (e^A - e^{-A})(e^A + e^{-A})^{-1}\), provided \(e^A + e^{-A}\) is invertible.

6.2.1 Definition via matrix exponential

This definition generalizes the scalar function and shares many algebraic properties, such as the addition formula, under appropriate commutativity conditions.

6.2.2 Application in matrix exponential integrators

Matrix hyperbolic tangent appears in exponential integrators for stiff ODEs, particularly in methods that require computing functions like \(\varphi_1(hA)=(\tanh(hA/2))/(hA/2)\).

7 Historical notes

The hyperbolic functions were first studied in the 18th century by mathematicians such as Johann Heinrich Lambert and Vincenzo Riccati. Lambert introduced the notation “sinh” and “cosh,” and the hyperbolic tangent emerged naturally in the solution of differential equations. The function’s modern application in neural networks gained prominence in the 1980s and 1990s with the rise of backpropagation.