Contents
raw book

Johann Heinrich Lambert (1728-1777), the tailor’s son who taught himself from a private library-became a polymath: cartography (Lambert projection), hygrometry, pyrometry, statistics, philosophy, and pure math. He proved \(\pi\) is irrational (a milestone toward the impossibility of straightedge-and-compass squaring of the circle). While studying “trinomial” equations and series reversion, Lambert essentially anticipated the Lagrange Inversion Theorem. Euler later cast one of Lambert’s problems in a form that leads directly to the function we now call Lambert-\(W\).

When we look at classical exponentials, the inverse is the logarithm:

Now consider the slightly more complicated map \(F(x)=xe^x\). The inverse of this function is the Lambert-\(W\) function.

Definition of Lambert W function

Let \(F(x)=x e^x\). The Lambert W function (a.k.a. the product logarithm) is the inverse of \(F(x)\):

\[ \boxed{W(F(x)) = W(xe^x) = x,} \qquad\Longleftrightarrow\qquad \boxed{W(y)e^{W(y)} = y}. \]

Core Identities of Lambert-W function

The definion of the Lambert-W function has the immediate consequences:

Real branches

For real \(x\in[-1/e,0)\) there are two real branches:

For \(x\ge0\) there is only \(W_0(x)\ge0\).

Away from the branch point at \(-1/e\), \(W\) is analytic and admits a (local) power series:

\[ W(z)=\sum_{n=0}^\infty c_n\cdot(z-z_0)^n \]

around any point \(z_0\) that is not the branch point.

General Inversion

For \(b>0, b\neq1\), consider \(g(x)=xb^x = x,e^{x\ln b}\). Then

\[ \boxed{g^{-1}(y)=\frac{W(y\ln b)}{\ln b},}. \]

This is the precise analogue of \(g^{-1}(y)=\ln y\) for \(g(x)=e^x\).

Lambert-W function Calculator

The form field computes \(W(z)\) numerically. Enter any real \(z\).

\(W(\)\()) = W( x\cdot e^x) = x \approx\)0.5671432904097838

Calculating Lambert-W

Using Newton’s method

Basic Idea: approximate \(f\) by a straight line near the current guess

Suppose we have a current guess \(w_n\) for the root. For a small change \(\Delta\),

\[ f(w_n+\Delta)\approx f(w_n)+f'(w_n),\Delta \]

(this is the first-order Taylor approximation, i.e., “use the tangent line”).

We want the next guess \(w_{n+1}=w_n+\Delta\) to satisfy \(f(w_{n+1})\approx 0\). Set the linear approximation to zero and solve for \(\Delta\):

\[ 0 \approx f(w_n)+f'(w_n)\Delta \quad\Rightarrow\quad \Delta \approx -\frac{f(w_n)}{f'(w_n)}. \]

From this follows the general Newton step:

\[ \boxed{w_{n+1}=w_n-\frac{f(w_n)}{f'(w_n)}}. \]

Newton’s method for Lambert-W

Here \(f(w)=w e^{w}-y\). Differentiate:

\[ f'(w)=(w+1)e^{w}. \]

Plug into the Newton step:

\[ \boxed{w_{n+1}=w_n-\frac{w_n e^{w_n}-y}{(w_n+1)e^{w_n}}}. \]

That’s Newton’s method for \(W\). It usually converges quadratically (errors roughly square each step) once you’re close.

Halley’s method

Newton used a line (first-order). Halley upgrades the local model to a curve using a second-order approximation and solves that more accurately.

Second-order Taylor model of \(f\) near \(w_n\)

Let \(\Delta=w-w_n\). Then

\[ f(w_n+\Delta)\approx f_n+f'_n\Delta+\frac{1}{2}f''_n\Delta^2, \]

where \(f_n=f(w_n),\ f'_n=f'(w_n),\ f''_n=f''(w_n)\).

We want \(f(w_n+\Delta)\approx 0\). Solve the quadratic

\[ \frac{1}{2}f''_n\Delta^2+f'_n\Delta+f_n\approx 0. \]

Directly using the quadratic formula is possible but can be numerically touchy. Halley’s trick is to take the root that is a second-order correction to Newton’s step. That root can be written compactly as

\[ \Delta_{\text{Halley}} = -\frac{2 f_n f'_n}{2 (f'_n)^2 - f_n f''_n}. \]

From this follows the general Halley step:

\[ \boxed{w_{n+1}=w_n-\frac{2 f(w_n) f'(w_n)}{2[f'(w_n)]^2 - f(w_n) f''(w_n)}}. \]

This method has cubic convergence near the root (errors roughly cube each step), so it’s typically faster than Newton once you’re in the basin of attraction.

Halley’s method for Lambert-W

For \(f(w)=w e^{w}-y\),

\[ f'(w)=(w+1)e^{w},\qquad f''(w)=(w+2)e^{w}. \]

Insert into Halley’s formula:

\[ \boxed{w_{n+1} = w_n-\frac{2(w_n e^{w_n}-y)(w_n+1)e^{w_n}} {2(w_n+1)^2 e^{2w_n} - (w_n e^{w_n}-y)(w_n+2)e^{w_n}}}. \]

You can cancel a common (e^{w_n}) if you like:

\[ w_{n+1} = w_n-\frac{2(w_n e^{w_n}-y)(w_n+1)} {2(w_n+1)^2 e^{w_n} - (w_n e^{w_n}-y)(w_n+2)}. \]

Calculating the Omega constant

Take \(y=1\) (so \(W(1)=\Omega)\). With Newton’s formula above and start \(w_0=0.5\):

\[ w_1\approx 0.57102,\quad w_2\approx 0.56716,\quad w_3\approx 0.56714,\dots \]

So \(\Omega\approx 0.567143\) and indeed \(\Omega e^{\Omega}=1\).

Fixed-point iteration (simple “mental math” hint)

From \(y=we^{w}\) we get \(\ln y=\ln w + w\), so

\[ \boxed{w=\ln\Big(\tfrac{y}{w}\Big)}. \]

With a guess \(w_0\) (e.g. \(w_0=\ln y\) when \(y>e\)), iterate

\[ w_{k+1}=\ln\Big(\frac{y}{w_k}\Big)\ \longrightarrow\ W(y) \]

In practice this method is often slowly, but pretty easy to remember.

Derivative of the Lambert \( W \) Function

The derivative of the Lambert \( W \) function is valid only for \( x\neq 0\), as the defining equation involves division by \( x \). Starting from the implicit relationship introduced earlier:

\[ x = W(x)e^{W(x)}, \]

we differentiate both sides with respect to \( x \):

\[ 1 = \frac{d}{dx} \left( W(x) e^{W(x)} \right). \]

Applying the product rule:

\[ 1 = W'(x)e^{W(x)} + W(x) W'(x) e^{W(x)}. \]

Factoring \(W'(x)e^{W(x)}\), we obtain:

\[ 1 = W'(x)e^{W(x)} \left( 1 + W(x) \right). \]

Rearranging gives:

\[ W'(x) = \frac{1}{e^{W(x)} \left( 1 + W(x) \right)}. \]

Substituting \(e^{W(x)} = \frac{x}{W(x)}\) to rewrite in terms of \(x\) and \(W(x)\):

\[ W'(x) = \frac{W(x)}{x \left( 1 + W(x) \right)}. \]

This compact formula provides \(W'(x)\), highlighting the intricate behavior of \(W(x)\) under differentiation.

Near the origin \(x=0\), \(W(x)\approx x\) or more specific \(W(x)=x+O(x^2)\). Hence \(W'(0)=1\) (a frequent typo is \(0\)).

ODE viewpoint. The derivative formula says \(W\) solves

\[ \frac{dW}{dx}=\frac{W}{x(1+W)},\qquad W(0)=0. \]

Applying Lambert-W to Tetration

If the infinite power tower \(y=x^{x^{x^{\cdot^{\cdot}}}}\) converges, it satisfies \(x^{y}=y\). Solving gives

\[ \boxed{y=-\frac{W(-\ln x)}{\ln x},}. \]

(Use the branch that makes \(y>0\) when it exists.)

For complex \(x\), the iteration may diverge or settle into cycles (length (2,3,\dots)); plotting parameters reveals fractal-like boundaries.

Worked Examples

Solving \(x^x=2\)

\[\begin{array}{rrl} &x^x &= 2\\ \Leftrightarrow&\ln(x^x) &= \ln(2)\\ \Leftrightarrow&x\ln(x) &= \ln(2)\\ \Leftrightarrow&\ln(x) e^{\ln(x)} &= \ln(2)\\ \Leftrightarrow&W(\ln(x) e^{\ln(x)}) &= W(\ln(2))\\ \Leftrightarrow&\ln(x) &= W(\ln(2))\\ \Leftrightarrow&x&= e^{W(\ln(2))}\\ \Leftrightarrow& x & \approx 1.55961047 \end{array}\]

Solving \(a^x + bx = c\)

\[\begin{array}{rrl} & a^x + bx &= c\\ \Leftrightarrow & a^x &= c - bx\\ \Leftrightarrow & \frac{a^x}{b} &= \frac{c}{b} - x\\ \Leftrightarrow & \frac{1}{b} &= (\frac{c}{b} - x) \cdot a^{-x}\\ \Leftrightarrow & \frac{a^{c/b}}{b} &= (\frac{c}{b} - x) \cdot a^{\frac{c}{b} - x}\\ \Leftrightarrow & \frac{a^{c/b}}{b} &= (\frac{c}{b} - x) \cdot e^{\log(a)\cdot(\frac{c}{b} - x)}\\ \Leftrightarrow & \log(a)\cdot \frac{a^{c/b}}{b} &= \log(a)\cdot(\frac{c}{b} - x) \cdot e^{\log(a)\cdot(\frac{c}{b} - x)}\\ \Leftrightarrow & W\left(\log(a)\cdot \frac{a^{c/b}}{b}\right) &= \log(a)\cdot(\frac{c}{b} - x)\\ \Leftrightarrow & x &= \frac{c}{b} - \frac{W\left(\log(a)\cdot \frac{a^{c/b}}{b}\right)}{\log(a)}\\ \end{array}\]

Solving \(x^a \cdot b^x = c\)

\[\begin{array}{rrl} &x^a \cdot b^x &= c\\ \Leftrightarrow & x \cdot b^{x/a} &= c^{1/a}\\ \Leftrightarrow & \frac{x}{a} \cdot b^{x/a} &= \frac{c^{1/a}}{a}\\ \Leftrightarrow & \log(b) \cdot \frac{x}{a} \cdot e^{\log(b) \cdot x/a} &= \log(b) \cdot \frac{c^{1/a}}{a}\\ \Leftrightarrow & \log(b) \cdot \frac{x}{a} &= W\left(\log(b) \cdot \frac{c^{1/a}}{a}\right)\\ \Leftrightarrow & x &= \frac{a \cdot W\left(\log(b) \cdot \frac{c^{1/a}}{a}\right)}{\log(b)}\\ \end{array}\]

Solving \(a^x = x^b\)

\[\begin{array}{rrl} &a^x &= x^b\\ \Leftrightarrow & x \ln(a) &= b \ln(x) \\ \Leftrightarrow& \frac{\ln(x)}{x} &= \frac{\ln(a)}{b} \\ \Leftrightarrow& -\frac{\ln(x)}{x} &= -\frac{\ln(a)}{b} \\ \Leftrightarrow& (-\ln(x))e^{-\ln(x)} &= -\frac{\ln(a)}{b} \\ \Leftrightarrow& -\ln(x) &= W\left(-\frac{\ln(a)}{b}\right) \\ \Leftrightarrow& \ln(x) &= -W\left(-\frac{\ln(a)}{b}\right) \\ \Leftrightarrow& x &= e^{-W(-\frac{\ln(a)}{b})} \end{array}\]

Solving \(x =\ln(4x)\)

\[\begin{array}{rrl} & x &= \ln(4x)\\ \Leftrightarrow& e^x &= 4x\\ \Leftrightarrow& \frac{1}{x}e^x &= 4\\ \Leftrightarrow& -xe^{-x} &= -\frac{1}{4}\\ \Leftrightarrow& W(-xe^{-x}) &= W(-\frac{1}{4})\\ \Leftrightarrow& -x &= W(-\frac{1}{4})\\ \Leftrightarrow& x &= -W(-\frac{1}{4})\\ \Leftrightarrow& x & \approx 0.357402956 \end{array}\]

Example \(x^2e^x =2\)

\[\begin{array}{rrl} & x^2e^x &= 2\\ \Leftrightarrow& \sqrt{x^2e^x} &= \sqrt{2}\\ \Leftrightarrow& xe^{\frac{x}{2}} &= \sqrt{2}\\ \Leftrightarrow& \frac{x}{2}e^{\frac{x}{2}} &= \frac{\sqrt{2}}{2} = \frac{1}{\sqrt{2}}\\ \Leftrightarrow& W\left(\frac{x}{2}e^{\frac{x}{2}}\right) &= W\left(\frac{1}{\sqrt{2}}\right)\\ \Leftrightarrow& \frac{x}{2} &= W\left(\frac{1}{\sqrt{2}}\right)\\ \Leftrightarrow& x &= 2W\left(\frac{1}{\sqrt{2}}\right)\\ \Leftrightarrow& x & \approx 0.901201032 \end{array}\]

Example \(x+e^x =2\)

\[\begin{array}{rrl} &x +e^x&= 2\\ \Leftrightarrow&e^x&= 2 -x \\ \Leftrightarrow&1 &= (2 -x)^{e^{-x}}\\ \Leftrightarrow&e^2 &= (2 -x)^{e^{2-x}}\\ \Leftrightarrow&W(e^2) &= W((2 -x)^{e^{2-x}})\\ \Leftrightarrow&W(e^2) &= 2 -x\\ \Leftrightarrow&x &= 2 - W(e^2)\\ \Leftrightarrow&x &\approx 0.442854401 \end{array}\]

Example \(3^x + x = 2\)

\[\begin{array}{rrl} &3^x + x &= 2 \\ \Leftrightarrow&3^x &= 2-x \\ \Leftrightarrow&1 &= (2-x) \cdot 3^{-x} \\ \Leftrightarrow&3^2 &= (2-x) \cdot 3^{2-x} \\ \Leftrightarrow&9 &= (2-x) \cdot {e^{\ln(3)}}^{2-x} \\ \Leftrightarrow&\ln(3) \cdot 9 &= \ln(3)(2-x) \cdot e^{\ln(3)(2-x)} \\ \Leftrightarrow&W(\ln(3)\cdot 9) &= \ln(3)(2-x) \\ \Leftrightarrow&x &= 2 - \frac{W(\ln(3)\cdot 9)}{\ln(3)} \\ \Leftrightarrow&x &\approx 0.41769372 \end{array}\]

Example \(x^{\sqrt{x}} = 3\)

\[\begin{array}{rrl} &x^{\sqrt{x}} &= 3\\ \Leftrightarrow & \sqrt{x}\cdot\ln(x) &= \ln(3)\\ \Leftrightarrow & x^{1/2}\cdot\ln(x) &= \ln(3)\\ \Leftrightarrow & e^{u}\cdot 2u &= \ln(3)\; \text{ with } u = \frac{1}{2}\ln(x)\\ \Leftrightarrow & u\cdot e^{u} &= \frac{1}{2}\ln(3)\\ \Leftrightarrow & u &= W\left(\frac{1}{2}\ln(3)\right)\\ \Leftrightarrow & \ln(x) &= {2W\left(\frac{1}{2}\ln(3)\right)}\\ \Leftrightarrow & x &= e^{2W\left(\frac{1}{2}\ln(3)\right)}\\ \Leftrightarrow & x &= 2.124799\\ \end{array}\]