Lambert Function

Have you ever heard of a mathematical function called the Lambert function? If not, this is an interesting function that may come in handy in some applications. To understand it, let us consider the following example

$$ xe^x = y $$ and ask ourselves can we express or solve the above equation for variable $x$ and given $y$ i.e., $x = f(y)$? At first glance, it may feel simple, but then we will realize that the term $x$ is outside and inside the exponential function and cannot be separated. The question is, is it at all possible?

The answer is yes, and that function $f(y)$ is the Lambert function. For real $x$ and $y$ the solution for $xe^x=y$ exists if and only if $y\geq -e^{-1}$. More specifically, $$ \begin{align} x &= W_0(y), y \geq 0\\ x &= W_{-1}(y) \text{ and } W_{0}(y), -e^{-1}\leq y <0 \end{align} $$ For the case of complex variables refer.

We will solve one equation which can sometimes can come in handy and whose solution involves Lambert function in the solution. We solve for $x$ in the following equation:

$$ e^{ax} = bx + c $$ and assume $a\neq 0, b\neq 0, c\neq 0$. For other cases it can be solved without having to invoke Lambert function. Now we solve with sequence of steps as follows:

$$ \begin{equation} \begin{aligned} bx+c &=e^{ax}\\ (bx+c)e^{-ax}&=1\\ (bx+c)e^{-\frac{abx}{b}}e^{-\frac{ac}{b}}&=e^{-\frac{ac}{b}}\\ (bx+c)e^{-\frac{a(bx+c)}{b}}&=e^{-\frac{ac}{b}}\\ a(bx+c)e^{-\frac{a(bx+c)}{b}}&=ae^{-\frac{ac}{b}}\\ -\frac{a(bx+c)}{b}e^{-\frac{a(bx+c)}{b}}&=-\frac{ae^{-\frac{ac}{b}}}{b}\\ -\frac{abx+ac}{b}&=W_{-1}\left(-\frac{ae^{-\frac{ac}{b}}}{b}\right)\\ x&=\frac{-bW_{-1}\left(-\frac{ae^{-\frac{ac}{b}}}{b}\right)-ac}{ab}\\ \end{aligned} \end{equation} $$

One of the applications of the Lambert function occurs in the field of communications. Consider a simple example: the following is the Shannon capacity expression for AWGN (additive white Gaussian noise) channel

$$ C = B\log_2\left(1 + \frac{\rho}{B}\right) {\rm bit/s} $$ where $C$ is the capacity, $B$ is the Bandwidth, and $\rho = P/N_0$ is the normalized signal-to-noise ratio (SNR). What is the required $B$ for given $C$ and $\rho$? Here as well, the term $B$ is outside and inside the logarithmic function. Before we provide solution for this problem consider a related simplified version of the problem,

Let $k\geq 0$ to solve $$ z\ln\left(1 + \frac{1}{z}\right) = k $$ One can show that after some mathematical manipulations, that $z$ can be rewritten in terms of $k$ using the Lambert function as follows: $$ z = \frac{-k}{W_{-1}(-ke^{-k}) + k} $$ and this holds when the condition that $\ln k< k -1$ holds, which is indeed always true. However, some times the solution may not be desirable in that situation solution doesn’t exist. For example, if the requirement is that $z$ has to be positive then for solution to exist $k\leq 1$.

Now we can solve the initial problem which we intended to solve i.e., to solve for $B$ in terms of other variables. The solution exists if $C\leq \frac{\rho}{\ln 2}$. Then we can obtain the solution in closed form and it is obtained by utilizing the above result and substituting: $B = z\rho$ and $k = \frac{C}{\rho}\ln 2$

Following is the MATLAB code snippet which we can use to test the above expression

clc;
clear;

% Let first solve for C for given B and rho
rho = 2;
B = 1e3; % 1 KHz

% Obtaining Capacity value
C = B*log2(1 + rho/B);

% Now we shall use the expression given above
k = (C/rho)*log(2); 

% solving for z
z = (-k)/(k + lambertw(-1,-k*exp(-k)));

% Rescaling to obtain desired B, estimated using the Lambert function
Bcheck = z*rho;

Code results:

>> B

B =

        1000

>> Bcheck

Bcheck =

   1000.0000

Another application in the wireless domain where the Lambert function comes into play is obtaining closed-form expression for maximizing energy efficiency with respect to power ($p$) i.e., maximizing the following expression $$ \frac{B\log_2\left(1 + \frac{p\beta}{BN_0}\right)}{\frac{p}{\mu} + P_{\rm circuit}} $$ where $\beta$ is the pathloss parameter, $N_0$ is noise power spectral density, $\mu$ amplifier efficiency and $P_{\rm circuit}$ is the circuit power. All variables are constant except $p$. If carefully derived, the optimal solution $p^{*}$ involves the Lambert function. On a side note, strictly speaking, Lambert is not a closed-form function because this function cannot be represented in terms of elementary functions. We can think of it as another function similar to Q-function or Gamma function.

Zakir Hussain Shaik
Zakir Hussain Shaik
PhD Student in Communications Systems

My research interests include wireless communications, distributed signal processing, and convex optimization