# How to find the Inverse Transform of the Gumbel distribution

How does one find the Inverse Tranform of the Gumbel distribution?

Let $$X\sim \text{Gumbel}(\mu,\beta)$$ with scale parameter $$\beta>0$$.

The CDF is then $$F_X(x)=\text{e}^{-\text{e}^{-(x-\mu)/\beta}}$$.

Finding the inverse transform follows a typical pattern. Start with the CDF, $$F_X(x)$$ and set equal to $$U$$.

Solve $$F_X(x) = U$$ for $$x$$.

\begin{align} \text{e}^{-\text{e}^{-(X-\mu)/\beta}} &= U\\ -\text{e}^{-\left(\frac{X-\mu}{\beta} \right)} &= \text{ln}(U) \\ -\left(\frac{X-\mu}{\beta} \right) &= \text{ln}(-\text{ln}(U)) \\ X-\mu &= -\beta \,\text{ln}(-\text{ln}(U)) \\ X &= \mu -\beta \,\text{ln}(-\text{ln}(U)) \quad \quad \square \end{align}

When sampling with this method, $$U\sim \text{Uniform}(0,1)$$ and $$X\sim \text{Gumbel}(\mu,\beta)$$.

More on the Inverse Transform here and here.

% MATLAB 2017a
% Code to generate X ~ Gumbel(mu,beta) with inverse transform method
% Parameters
mu = 1;
beta = 2;
n = 1000;                    % number of samples to generate

% Generation
U = rand(n,1);               % U ~ Uniform(0,1)
X = mu - beta*log(-log(U));  % X ~ Gumbel(mu,beta)