TExcelTAD
Home › Pre-Calculus, Geometry & Trigonometry › Hyperbolic Functions

Hyperbolic Functions

The hyperbolic functions sinh⁡\sinh, cosh⁡\cosh and tanh⁡\tanh are built from exe^x and e−xe^{-x}, in the same way that sine and cosine are built from eixe^{ix} and e−ixe^{-ix}. They describe hanging cables, appear in relativity, and tanh⁡\tanh is one of the classic activation functions in neural networks.

Definitions

sinh⁡x=ex−e−x2"hyperbolic sine" (say "shine" or "sinch")cosh⁡x=ex+e−x2"hyperbolic cosine" ("kosh")tanh⁡x=sinh⁡xcosh⁡x=ex−e−xex+e−x\begin{aligned} \sinh x &= \frac{e^x - e^{-x}}{2} && \text{"hyperbolic sine" (say "shine" or "sinch")} \\ \cosh x &= \frac{e^x + e^{-x}}{2} && \text{"hyperbolic cosine" ("kosh")} \\ \tanh x &= \frac{\sinh x}{\cosh x} = \frac{e^x - e^{-x}}{e^x + e^{-x}} \end{aligned}

Compare with Euler's formulas: cos⁡x=(eix+e−ix)/2\cos x = (e^{ix} + e^{-ix})/2 and sin⁡x=(eix−e−ix)/(2i)\sin x = (e^{ix} - e^{-ix})/(2i). Dropping the ii's gives the hyperbolic versions.

Function Domain Range Symmetry Value at 0
sinh⁡x\sinh x all reals all reals odd 0
cosh⁡x\cosh x all reals [1,∞)[1, \infty) even 1
tanh⁡x\tanh x all reals (−1,1)(-1, 1) odd 0

Unlike sine and cosine, these functions are not periodic. For large xx, e−xe^{-x} is tiny, so sinh⁡x≈cosh⁡x≈ex/2\sinh x \approx \cosh x \approx e^x/2 and tanh⁡x→1\tanh x \to 1. For very negative xx, tanh⁡x→−1\tanh x \to -1.

python · try it yourself
import math

print(f"{'x':>4} {'sinh':>10} {'cosh':>10} {'tanh':>9}")
for x in [-3, -1, 0, 0.5, 1, 3]:
    print(f"{x:>4} {math.sinh(x):10.5f} {math.cosh(x):10.5f} {math.tanh(x):9.5f}")

x = 1.3
by_hand = (math.exp(x) - math.exp(-x)) / 2
print("sinh(1.3) by formula:", round(by_hand, 12), " math.sinh:", round(math.sinh(x), 12))
   x       sinh       cosh      tanh
  -3  -10.01787   10.06766  -0.99505
  -1   -1.17520    1.54308  -0.76159
   0    0.00000    1.00000   0.00000
 0.5    0.52110    1.12763   0.46212
   1    1.17520    1.54308   0.76159
   3   10.01787   10.06766   0.99505
sinh(1.3) by formula: 1.698382437293  math.sinh: 1.698382437293

Why "hyperbolic"?

The point (cos⁡t,sin⁡t)(\cos t, \sin t) lies on the circle x2+y2=1x^2 + y^2 = 1. The point (cosh⁡t,sinh⁡t)(\cosh t, \sinh t) lies on the hyperbola x2−y2=1x^2 - y^2 = 1 (its right branch), because

cosh⁡2t−sinh⁡2t=(et+e−t)2−(et−e−t)24=(e2t+2+e−2t)−(e2t−2+e−2t)4=44=1\begin{aligned} \cosh^2 t - \sinh^2 t &= \frac{(e^t + e^{-t})^2 - (e^t - e^{-t})^2}{4} \\ &= \frac{(e^{2t} + 2 + e^{-2t}) - (e^{2t} - 2 + e^{-2t})}{4} \\ &= \frac{4}{4} = 1 \end{aligned}

This is the hyperbolic Pythagorean identity. Most trig identities have a hyperbolic twin, usually with a sign change (Osborn's rule: flip the sign of any product of two sinh⁡\sinh's):

Trigonometric Hyperbolic
cos⁡2x+sin⁡2x=1\cos^2 x + \sin^2 x = 1 cosh⁡2x−sinh⁡2x=1\cosh^2 x - \sinh^2 x = 1
sin⁡2x=2sin⁡xcos⁡x\sin 2x = 2\sin x\cos x sinh⁡2x=2sinh⁡xcosh⁡x\sinh 2x = 2\sinh x\cosh x
cos⁡2x=cos⁡2x−sin⁡2x\cos 2x = \cos^2 x - \sin^2 x cosh⁡2x=cosh⁡2x+sinh⁡2x\cosh 2x = \cosh^2 x + \sinh^2 x
1+tan⁡2x=sec⁡2x1 + \tan^2 x = \sec^2 x 1−tanh⁡2x=sech⁡2x1 - \tanh^2 x = \operatorname{sech}^2 x

(sech⁡x=1/cosh⁡x\operatorname{sech} x = 1/\cosh x, csch⁡x=1/sinh⁡x\operatorname{csch} x = 1/\sinh x and coth⁡x=1/tanh⁡x\coth x = 1/\tanh x complete the family.)

python · try it yourself
import sympy as sp

x = sp.Symbol("x", real=True)
print("cosh² − sinh² :", sp.simplify(sp.cosh(x)**2 - sp.sinh(x)**2))
print("cosh 2x check :", sp.simplify(sp.cosh(2*x) - (sp.cosh(x)**2 + sp.sinh(x)**2)))
print("tanh as exp   :", sp.tanh(x).rewrite(sp.exp))
print("asinh(x)      :", sp.asinh(x).rewrite(sp.log))
cosh² − sinh² : 1
cosh 2x check : 0
tanh as exp   : (exp(x) - exp(-x))/(exp(x) + exp(-x))
asinh(x)      : log(x + sqrt(x**2 + 1))

Inverse hyperbolic functions

Because they are built from exe^x, their inverses are logarithms:

arsinh⁡x=ln⁡(x+x2+1)all xarcosh⁡x=ln⁡(x+x2−1)x≥1 (principal branch, output≥0)artanh⁡x=12ln⁡1+x1−x−1<x<1\begin{aligned} \operatorname{arsinh} x &= \ln\left(x + \sqrt{x^2 + 1}\right) && \text{all } x \\ \operatorname{arcosh} x &= \ln\left(x + \sqrt{x^2 - 1}\right) && x \ge 1\ (\text{principal branch, output} \ge 0) \\ \operatorname{artanh} x &= \tfrac{1}{2}\ln\frac{1 + x}{1 - x} && -1 < x < 1 \end{aligned}

To derive the first, set y=arsinh⁡xy = \operatorname{arsinh} x, so x=(ey−e−y)/2x = (e^y - e^{-y})/2. Multiply by 2ey2e^y: e2y−2x⋅ey−1=0e^{2y} - 2x \cdot e^y - 1 = 0, a quadratic in u=eyu = e^y. Its positive root is u=x+x2+1u = x + \sqrt{x^2 + 1}, so y=ln⁡(x+x2+1)y = \ln(x + \sqrt{x^2 + 1}). In Python they are math.asinh, math.acosh, math.atanh.

The catenary

A chain or cable hanging freely between two posts takes the shape y=a⋅cosh⁡(x/a)y = a \cdot \cosh(x/a), called a catenary (from the Latin for chain). It looks like a parabola but is not one: it grows exponentially rather than quadratically further out. Inverting the catenary's shape gives the strongest arch for its own weight, which is why the Gateway Arch in St. Louis follows a (weighted) catenary.

The derivatives are also simple: (sinh⁡x)′=cosh⁡x(\sinh x)' = \cosh x and (cosh⁡x)′=sinh⁡x(\cosh x)' = \sinh x, with no minus sign. You will meet them in the calculus course's hyperbolic lesson and, in depth, in /calculus-stewart/hyperbolic-functions/.

In software

  • tanh⁡\tanh as an activation function. A neural network neuron computes tanh⁡(w⋅x+b)\tanh(w \cdot x + b). tanh⁡\tanh squashes any number into (−1,1)(-1, 1), is zero-centred and smooth, and its derivative is the cheap 1−tanh⁡2x1 - \tanh^2 x. LSTMs and GRUs (recurrent networks) still use it inside their gates. It is closely related to the logistic sigmoid: σ(x)=(1+tanh⁡(x/2))/2\sigma(x) = (1 + \tanh(x/2))/2.
  • Soft clipping in audio. Guitar distortion plugins use tanh⁡\tanh to push loud samples smoothly toward ±1\pm 1 instead of clipping them hard.
  • Numerical care. Computing tanh⁡\tanh from its definition overflows for large xx (e1000e^{1000} is infinite), but math.tanh(1000) returns 1.0. Library functions handle these edge cases; prefer them over hand-written formulas.
python · try it yourself
import math

def tanh_naive(x):
    return (math.exp(x) - math.exp(-x)) / (math.exp(x) + math.exp(-x))

print("tanh(2) naive vs library:", round(tanh_naive(2), 12), round(math.tanh(2), 12))
try:
    tanh_naive(1000)
except OverflowError as e:
    print("naive tanh(1000):", e)
print("math.tanh(1000):", math.tanh(1000))

sigmoid = lambda x: 1 / (1 + math.exp(-x))
print("sigmoid(1.5) =", round(sigmoid(1.5), 12), " (1+tanh(0.75))/2 =", round((1 + math.tanh(0.75)) / 2, 12))
print("soft clip:", [round(math.tanh(s), 3) for s in (0.1, 0.5, 1.0, 2.0, 5.0)])
tanh(2) naive vs library: 0.964027580076 0.964027580076
naive tanh(1000): math range error
math.tanh(1000): 1.0
sigmoid(1.5) = 0.817574476194  (1+tanh(0.75))/2 = 0.817574476194
soft clip: [0.1, 0.462, 0.762, 0.964, 1.0]

Exercises

Exercise 1: Evaluate exactly

Find cosh⁡(ln⁡2)\cosh(\ln 2) and sinh⁡(ln⁡3)\sinh(\ln 3) as fractions.

Answer

cosh⁡(ln⁡2)=54\cosh(\ln 2) = \frac{5}{4}, sinh⁡(ln⁡3)=43\sinh(\ln 3) = \frac{4}{3}.

Solution
cosh⁡(ln⁡2)=2+122=5/22=54sinh⁡(ln⁡3)=3−132=8/32=43\begin{aligned} \cosh(\ln 2) &= \frac{2 + \frac{1}{2}}{2} = \frac{5/2}{2} = \frac{5}{4} \\ \sinh(\ln 3) &= \frac{3 - \frac{1}{3}}{2} = \frac{8/3}{2} = \frac{4}{3} \end{aligned}

Exercise 2: From one to the others

If sinh⁡x=34\sinh x = \frac{3}{4}, find cosh⁡x\cosh x and tanh⁡x\tanh x.

Answer

cosh⁡x=54\cosh x = \frac{5}{4}, tanh⁡x=35\tanh x = \frac{3}{5}.

Solution
cosh⁡2x=1+sinh⁡2x=1+916=2516, and cosh⁡x>0, so cosh⁡x=54tanh⁡x=3/45/4=35\begin{aligned} \cosh^2 x &= 1 + \sinh^2 x = 1 + \tfrac{9}{16} = \tfrac{25}{16}, \text{ and } \cosh x > 0, \text{ so } \cosh x = \tfrac{5}{4} \\ \tanh x &= \frac{3/4}{5/4} = \frac{3}{5} \end{aligned}

Exercise 3: Prove an identity

Prove that cosh⁡x+sinh⁡x=ex\cosh x + \sinh x = e^x, and use it to show (cosh⁡x+sinh⁡x)n=cosh⁡nx+sinh⁡nx(\cosh x + \sinh x)^n = \cosh nx + \sinh nx.

Answer

Both follow from the definitions and the exponent rule.

Solution
cosh⁡x+sinh⁡x=ex+e−x2+ex−e−x2=2ex2=ex(cosh⁡x+sinh⁡x)n=(ex)n=enx=cosh⁡nx+sinh⁡nx\begin{aligned} \cosh x + \sinh x &= \frac{e^x + e^{-x}}{2} + \frac{e^x - e^{-x}}{2} = \frac{2e^x}{2} = e^x \\ (\cosh x + \sinh x)^n &= (e^x)^n = e^{nx} = \cosh nx + \sinh nx \end{aligned}

This is the hyperbolic version of De Moivre's formula.

Exercise 4: Inverse by formula

Compute arsinh⁡(2)\operatorname{arsinh}(2) with the log formula and compare with math.asinh. Then compute artanh⁡(0.6)\operatorname{artanh}(0.6) both ways.

Answer

arsinh⁡(2)=ln⁡(2+5)≈1.443635\operatorname{arsinh}(2) = \ln(2 + \sqrt{5}) \approx 1.443635, artanh⁡(0.6)=12ln⁡4=ln⁡2≈0.693147\operatorname{artanh}(0.6) = \tfrac{1}{2}\ln 4 = \ln 2 \approx 0.693147.

Solution
python · try it yourself
import math
print(round(math.log(2 + math.sqrt(5)), 6), round(math.asinh(2), 6))
print(round(0.5 * math.log((1 + 0.6) / (1 - 0.6)), 6), round(math.atanh(0.6), 6))
1.443635 1.443635
0.693147 0.693147

For artanh⁡\operatorname{artanh}: (1+0.6)/(1−0.6)=1.6/0.4=4(1 + 0.6)/(1 - 0.6) = 1.6/0.4 = 4, and 12ln⁡4=ln⁡2\tfrac{1}{2}\ln 4 = \ln 2.

Exercise 5: Sag of a cable

A cable hangs as y=20cosh⁡(x/20)y = 20\cosh(x/20) between posts at x=−15x = -15 and x=15x = 15 (metres). How far does the middle sag below the post tops?

Answer

About 5.89 m.

Solution
sag=y(15)−y(0)=20cosh⁡(0.75)−20≈20×1.294683−20≈5.894 m\text{sag} = y(15) - y(0) = 20\cosh(0.75) - 20 \approx 20 \times 1.294683 - 20 \approx 5.894\ \text{m}
python · try it yourself
import math
print(round(20 * math.cosh(15 / 20) - 20, 3))
5.894

Test yourself

Which identity is correct?

  1. cosh⁡2x+sinh⁡2x=1\cosh^2 x + \sinh^2 x = 1
  2. cosh⁡2x−sinh⁡2x=1\cosh^2 x - \sinh^2 x = 1
  3. sinh⁡2x−cosh⁡2x=1\sinh^2 x - \cosh^2 x = 1
  4. tanh⁡2x+1=sech⁡2x\tanh^2 x + 1 = \operatorname{sech}^2 x

What is the range of tanh⁡x\tanh x?

  1. All reals
  2. [0,1][0, 1]
  3. (−1,1)(-1, 1)
  4. [1,∞)[1, \infty)

What is cosh⁡0\cosh 0?

  1. 0
  2. 1
  3. ee
  4. Undefined