TRIGONOMETRYTrigonometryMathematics Calculator
tanh

Hyperbolic Tangent (tanh)

tanh(x) = sinh(x)/cosh(x) = (e^x - e^(-x))/(e^x + e^(-x)). Range (-1, 1). Used as an activation function in neural networks and in special relativity (v/c = tanh(φ)).

Concept Fundamentals
sinh/cosh
Definition
(-1, 1)
Range
tanh(-x) = -tanh(x)
Odd
1 - tanh²(x)
d/dx

Did our AI summary help? Let us know.

tanh is preferred over sigmoid in neural networks — zero-centered output helps training. v/c = tanh(φ) where φ is rapidity — special relativity expresses velocity via tanh. d/dx[tanh(x)] = 1 - tanh²(x) — the derivative is simple and always positive.

Key quantities
sinh/cosh
Definition
Key relation
(-1, 1)
Range
Key relation
tanh(-x) = -tanh(x)
Odd
Key relation
1 - tanh²(x)
d/dx
Key relation

Ready to run the numbers?

Why: tanh is the standard activation function in many neural networks — bounded, zero-centered, and smooth. Also appears in special relativity (velocity = c·tanh(rapidity)).

How: tanh(x) = sinh(x)/cosh(x). As x → ±∞, tanh(x) → ±1. The derivative d/dx[tanh(x)] = sech²(x) = 1 - tanh²(x) — useful for backpropagation.

tanh is preferred over sigmoid in neural networks — zero-centered output helps training.v/c = tanh(φ) where φ is rapidity — special relativity expresses velocity via tanh.

Run the calculator when you are ready.

Start CalculatingEnter x to compute tanh(x) and all 6 hyperbolic functions

Examples — Click to Load

tanh.sh
CALCULATED
$ tanh --x 1 --all-functions
tanh(x)
0.76159416
sinh(x)
1.17520119
cosh(x)
1.54308063
e^x
2.71828183
csch(x)
0.85091813
sech(x)
0.64805427
coth(x)
1.31303529
e^(-x)
0.36787944
Share:
Hyperbolic Tangent Calculator Result
tanh(1)
0.76159416
sinh = 1.17520119cosh = 1.54308063cosh² - sinh² = 1
numbervibe.com/calculators/mathematics/trigonometry/tanh-calculator

Hyperbolic Value Breakdown

All 6 Hyperbolic Functions

|tanh| vs |sinh| vs cosh

Calculation Breakdown

INPUT
Input x
1
EXPONENTIAL FORM
e^x
2.71828183
e^1
e^(-x)
0.36787944
e^(-1)
PRIMARY RESULT
sinh(x)
1.17520119
(e^x - e^(-x))/2
cosh(x)
1.54308063
(e^x + e^(-x))/2
RELATED HYPERBOLIC VALUES
TANH VALUE
0.76159416
ext{sinh}(x)/ ext{cosh}(x)
csch(x)
0.85091813
1/ ext{sinh}(x)
sech(x)
0.64805427
1/ ext{cosh}(x)
coth(x)
1.31303529
ext{cosh}(x)/ ext{sinh}(x)
IDENTITY
cosh² - sinh²
1
ext{Always} ext{equals} 1

For educational and informational purposes only. Verify with a qualified professional.

🧮 Fascinating Math Facts

🧠

tanh is a popular neural network activation function — bounded and zero-centered.

— Deep Learning textbooks

In special relativity, v/c = tanh(φ) where φ is rapidity. tanh maps rapidity to velocity.

— MIT OCW

Key Takeaways

  • tanh(x) = sinh(x)/cosh(x) = (e^x - e^(-x))/(e^x + e^(-x)) — bounded output
  • • Range: (-1, 1). Odd function: tanh(-x) = -tanh(x). As x→∞, tanh→1; as x→-∞, tanh→-1
  • • tanh(0) = 0. For small x, tanh(x) ≈ x. S-shaped (sigmoid) curve
  • ML activation function — used in neural networks for bounded, zero-centered output
  • Fluid dynamics — appears in boundary layer theory, viscous flow, and relativistic velocity (v/c = tanh)

Did You Know?

🧠tanh is a popular activation function in neural networks — bounded (-1,1), zero-centered, and smooth gradients. ReLU has largely replaced it in hidden layers, but tanh remains in RNNsSource: MIT OpenCourseWare
⚛️In special relativity, velocity addition uses tanh: v/c = tanh(rapidity). Rapidity φ adds linearly: tanh(φ₁+φ₂) gives the combined velocitySource: Wolfram MathWorld
🌊In fluid dynamics, tanh appears in boundary layer velocity profiles and in solutions to the Blasius equation for laminar flow over a flat plateSource: NIST DLMF
📐tanh(x) = 1 - 2/(e^(2x)+1). This form shows the saturation: for large x, the denominator dominates and tanh→1Source: Paul's Online Notes
📜The Gudermannian function gd(x) = 2 arctan(e^x) - π/2 relates circular and hyperbolic angles; its derivative involves sechSource: Khan Academy
🔬Fisher z-transformation in statistics uses arctanh to stabilize variance of correlation coefficients — tanh and its inverse are essentialSource: IEEE Statistics

How the Hyperbolic Tangent Works

tanh(x) = sinh(x)/cosh(x) is the ratio of the hyperbolic sine to cosine. Unlike sinh and cosh which grow exponentially, tanh is bounded between -1 and 1 — a sigmoid (S-shaped) function.

Exponential Definition

tanh(x) = (e^x - e^(-x))/(e^x + e^(-x)). For x > 0, the numerator and denominator are both positive; the ratio is < 1 and approaches 1 as x→∞. For x < 0, tanh is negative. The range (-1, 1) is never attained exactly for finite x.

Relation to Regular Trig

tan(ix) = i·tanh(x) and tanh(ix) = i·tan(x). Like tan(θ), tanh has no period — it increases monotonically. The derivative d/dx[tanh(x)] = sech²(x) = 1 - tanh²(x).

Geometric Interpretation & Applications

On the unit hyperbola, tanh(t) gives the slope of the line from the origin to (cosh(t), sinh(t)). In ML, tanh squashes inputs to (-1,1). In relativity, rapidity φ satisfies v = c·tanh(φ).

Expert Tips

Memorize Key Values

tanh(0)=0, tanh(1)≈0.762, tanh(2)≈0.964, tanh(3)≈0.995. For small x, tanh(x)≈x. Use Sinh and Cosh for the components.

ML Activation Function

tanh outputs in (-1,1), zero-centered (unlike sigmoid). Gradient: 1-tanh²(x). Compare with Tangent Calculator — tan is unbounded.

Special Relativity

Velocity v in units of c: v/c = tanh(φ) where φ is rapidity. Rapidity adds: φ₁+φ₂ gives combined velocity. tanh keeps v < c.

Derivative & Identity

d/dx[tanh(x)] = sech²(x) = 1 - tanh²(x). The identity 1 - tanh²(x) = sech²(x) is useful for integration.

Why Use This Calculator vs. Other Tools?

FeatureThis CalculatorScientific CalculatorManual Computation
All 6 hyperbolic functions at once❌ One at a time
Exponential form (e^x, e^(-x))✅ Slow
Visual charts & breakdown
Step-by-step explanation
Identity cosh² - sinh² = 1 check⚠️ Manual
Copy & share results
Screenshot-ready summary
Preset examples

Frequently Asked Questions

What is the range of tanh?

tanh(x) has range (-1, 1) — open interval. tanh never equals exactly 1 or -1 for finite x, but approaches these limits as x→±∞. This bounded range makes it ideal for neural network activations.

Why is tanh used in neural networks?

tanh outputs in (-1,1), is zero-centered (mean ~0), and has smooth gradients. The derivative 1-tanh²(x) is easy to compute. ReLU is now more common in hidden layers, but tanh is still used in RNNs and output layers.

What is the derivative of tanh?

d/dx[tanh(x)] = sech²(x) = 1 - tanh²(x). This follows from the quotient rule: (sinh'cosh - cosh'sinh)/cosh² = (cosh² - sinh²)/cosh² = 1/cosh² = sech².

How does tanh relate to special relativity?

Velocity v (in units of c) satisfies v/c = tanh(φ) where φ is rapidity. Rapidity adds linearly: tanh(φ₁+φ₂) gives the relativistic velocity combination. This keeps v &lt; c.

What is tanh in terms of exponentials?

tanh(x) = (e^x - e^(-x))/(e^x + e^(-x)). Equivalently, tanh(x) = 1 - 2/(e^(2x)+1). The second form shows the sigmoid shape clearly.

Why is tanh called odd?

tanh(-x) = -tanh(x). The graph has rotational symmetry about the origin. This follows from sinh(-x)/cosh(-x) = -sinh(x)/cosh(x).

Where does tanh appear in fluid dynamics?

In boundary layer theory, the velocity profile in laminar flow can involve tanh. The Blasius solution for flow over a flat plate uses functions related to tanh. Viscous flow solutions often involve hyperbolic functions.

What is the inverse of tanh?

artanh(x) = (1/2)ln((1+x)/(1-x)) for |x| &lt; 1. Also written as atanh. The inverse exists because tanh is strictly increasing on (-∞, ∞).

Hyperbolic Tangent by the Numbers

(-1, 1)
Output Range
Odd
Symmetry
sech²(x)
Derivative
ML
Key Application

Disclaimer: This calculator provides results based on standard IEEE 754 floating-point arithmetic. Results are accurate to approximately 15 significant digits. For mission-critical applications (ML training, physics simulations), always verify with certified computational tools. Not a substitute for professional analysis.

👈 START HERE
⬅️Jump in and explore the concept!
AI

Related Calculators