# Rayleigh distribution

Parameters Probability density function Cumulative distribution function scale: ${\displaystyle \sigma >0}$ ${\displaystyle x\in [0,\infty )}$ ${\displaystyle {\frac {x}{\sigma ^{2}}}e^{-x^{2}/\left(2\sigma ^{2}\right)}}$ ${\displaystyle 1-e^{-x^{2}/\left(2\sigma ^{2}\right)}}$ ${\displaystyle Q(F;\sigma )=\sigma {\sqrt {-2\ln(1-F)}}}$ ${\displaystyle \sigma {\sqrt {\frac {\pi }{2}}}}$ ${\displaystyle \sigma {\sqrt {2\ln(2)}}}$ ${\displaystyle \sigma }$ ${\displaystyle {\frac {4-\pi }{2}}\sigma ^{2}}$ ${\displaystyle {\frac {2{\sqrt {\pi }}(\pi -3)}{(4-\pi )^{3/2}}}}$ ${\displaystyle -{\frac {6\pi ^{2}-24\pi +16}{(4-\pi )^{2}}}}$ ${\displaystyle 1+\ln \left({\frac {\sigma }{\sqrt {2}}}\right)+{\frac {\gamma }{2}}}$ ${\displaystyle 1+\sigma te^{\sigma ^{2}t^{2}/2}{\sqrt {\frac {\pi }{2}}}\left(\operatorname {erf} \left({\frac {\sigma t}{\sqrt {2}}}\right)+1\right)}$ ${\displaystyle 1-\sigma te^{-\sigma ^{2}t^{2}/2}{\sqrt {\frac {\pi }{2}}}\left(\operatorname {erfi} \left({\frac {\sigma t}{\sqrt {2}}}\right)-i\right)}$

In probability theory and statistics, the Rayleigh distribution is a continuous probability distribution for nonnegative-valued random variables. It is essentially a chi distribution with two degrees of freedom.

A Rayleigh distribution is often observed when the overall magnitude of a vector is related to its directional components. One example where the Rayleigh distribution naturally arises is when wind velocity is analyzed in two dimensions. Assuming that each component is uncorrelated, normally distributed with equal variance, and zero mean, then the overall wind speed (vector magnitude) will be characterized by a Rayleigh distribution. A second example of the distribution arises in the case of random complex numbers whose real and imaginary components are independently and identically distributed Gaussian with equal variance and zero mean. In that case, the absolute value of the complex number is Rayleigh-distributed.

The distribution is named after Lord Rayleigh (/ˈrli/).[1]

## Definition

The probability density function of the Rayleigh distribution is[2]

${\displaystyle f(x;\sigma )={\frac {x}{\sigma ^{2}}}e^{-x^{2}/(2\sigma ^{2})},\quad x\geq 0,}$

where ${\displaystyle \sigma }$ is the scale parameter of the distribution. The cumulative distribution function is[2]

${\displaystyle F(x;\sigma )=1-e^{-x^{2}/(2\sigma ^{2})}}$

for ${\displaystyle x\in [0,\infty ).}$

## Relation to random vector length

Consider the two-dimensional vector ${\displaystyle Y=(U,V)}$ which has components that are normally distributed, centered at zero, and independent. Then ${\displaystyle U}$ and ${\displaystyle V}$ have density functions

${\displaystyle f_{U}(x;\sigma )=f_{V}(x;\sigma )={\frac {e^{-x^{2}/(2\sigma ^{2})}}{\sqrt {2\pi \sigma ^{2}}}}.}$

Let ${\displaystyle X}$ be the length of ${\displaystyle Y}$. That is, ${\displaystyle X={\sqrt {U^{2}+V^{2}}}.}$ Then ${\displaystyle X}$ has cumulative distribution function

${\displaystyle F_{X}(x;\sigma )=\iint _{D_{x}}f_{U}(u;\sigma )f_{V}(v;\sigma )\,dA,}$

where ${\displaystyle D_{x}}$ is the disk

${\displaystyle D_{x}=\left\{(u,v):{\sqrt {u^{2}+v^{2}}}\leq x\right\}.}$

Writing the double integral in polar coordinates, it becomes

${\displaystyle F_{X}(x;\sigma )={\frac {1}{2\pi \sigma ^{2}}}\int _{0}^{2\pi }\int _{0}^{x}re^{-r^{2}/(2\sigma ^{2})}\,dr\,d\theta ={\frac {1}{\sigma ^{2}}}\int _{0}^{x}re^{-r^{2}/(2\sigma ^{2})}\,dr.}$

Finally, the probability density function for ${\displaystyle X}$ is the derivative of its cumulative distribution function, which by the fundamental theorem of calculus is

${\displaystyle f_{X}(x;\sigma )={\frac {d}{dx}}F_{X}(x;\sigma )={\frac {x}{\sigma ^{2}}}e^{-x^{2}/(2\sigma ^{2})},}$

which is the Rayleigh distribution. It is straightforward to generalize to vectors of dimension other than 2. There are also generalizations when the components have unequal variance or correlations, or when the vector Y follows a bivariate Student t-distribution.[3]

Generalization to bivariate Student's-t distribution

Suppose ${\displaystyle Y}$ is a random vector with components ${\displaystyle u,v}$ that follows a multivariate t-distribution. If the components both have mean zero, equal variance, and are independent, the bivariate Student's-t distribution takes the form:

${\displaystyle f(u,v)={1 \over {2\pi \sigma ^{2}}}\left(1+{u^{2}+v^{2} \over {\nu \sigma ^{2}}}\right)^{-\nu /2-1}}$

Let ${\displaystyle R={\sqrt {U^{2}+V^{2}}}}$ be the magnitude of ${\displaystyle Y}$. Then the cumulative distribution function (CDF) of the magnitude is:

${\displaystyle F(r)={1 \over {2\pi \sigma ^{2}}}\iint _{D_{r}}\left(1+{u^{2}+v^{2} \over {\nu \sigma ^{2}}}\right)^{-\nu /2-1}du\;dv}$

where ${\displaystyle D_{r}}$ is the disk defined by:

${\displaystyle D_{r}=\left\{(u,v):{\sqrt {u^{2}+v^{2}}}\leq r\right\}}$

Converting to polar coordinates leads to the CDF becoming:

{\displaystyle {\begin{aligned}F(r)&={1 \over {2\pi \sigma ^{2}}}\int _{0}^{r}\int _{0}^{2\pi }\rho \left(1+{\rho ^{2} \over {\nu \sigma ^{2}}}\right)^{-\nu /2-1}d\theta \;d\rho \\&={1 \over {\sigma ^{2}}}\int _{0}^{r}\rho \left(1+{\rho ^{2} \over {\nu \sigma ^{2}}}\right)^{-\nu /2-1}d\rho \\&=1-\left(1+{r^{2} \over {\nu \sigma ^{2}}}\right)^{-\nu /2}\end{aligned}}}

Finally, the probability density function (PDF) of the magnitude may be derived:

${\displaystyle f(r)=F'(r)={r \over {\sigma ^{2}}}\left(1+{r^{2} \over {\nu \sigma ^{2}}}\right)^{-\nu /2-1}}$

In the limit as ${\displaystyle \nu \rightarrow \infty }$, the Rayleigh distribution is recovered because:

${\displaystyle \lim _{\nu \rightarrow \infty }\left(1+{r^{2} \over {\nu \sigma ^{2}}}\right)^{-\nu /2-1}=e^{-r^{2}/2\sigma ^{2}}}$

## Properties

The raw moments are given by:

${\displaystyle \mu _{j}=\sigma ^{j}2^{j/2}\,\Gamma \left(1+{\frac {j}{2}}\right),}$

where ${\displaystyle \Gamma (z)}$ is the gamma function.

The mean of a Rayleigh random variable is thus :

${\displaystyle \mu (X)=\sigma {\sqrt {\frac {\pi }{2}}}\ \approx 1.253\ \sigma .}$

The standard deviation of a Rayleigh random variable is:

${\displaystyle \operatorname {std} (X)={\sqrt {\left(2-{\frac {\pi }{2}}\right)}}\sigma \approx {\sqrt {0.429}}\ \sigma }$

The variance of a Rayleigh random variable is :

${\displaystyle \operatorname {var} (X)=\mu _{2}-\mu _{1}^{2}=\left(2-{\frac {\pi }{2}}\right)\sigma ^{2}\approx 0.429\ \sigma ^{2}}$

The mode is ${\displaystyle \sigma ,}$ and the maximum pdf is

${\displaystyle f_{\max }=f(\sigma ;\sigma )={\frac {1}{\sigma }}e^{-1/2}\approx {\frac {0.606}{\sigma }}.}$

The skewness is given by:

${\displaystyle \gamma _{1}={\frac {2{\sqrt {\pi }}(\pi -3)}{(4-\pi )^{3/2}}}\approx 0.631}$

The excess kurtosis is given by:

${\displaystyle \gamma _{2}=-{\frac {6\pi ^{2}-24\pi +16}{(4-\pi )^{2}}}\approx 0.245}$

The characteristic function is given by:

${\displaystyle \varphi (t)=1-\sigma te^{-{\frac {1}{2}}\sigma ^{2}t^{2}}{\sqrt {\frac {\pi }{2}}}\left[\operatorname {erfi} \left({\frac {\sigma t}{\sqrt {2}}}\right)-i\right]}$

where ${\displaystyle \operatorname {erfi} (z)}$ is the imaginary error function. The moment generating function is given by

${\displaystyle M(t)=1+\sigma t\,e^{{\frac {1}{2}}\sigma ^{2}t^{2}}{\sqrt {\frac {\pi }{2}}}\left[\operatorname {erf} \left({\frac {\sigma t}{\sqrt {2}}}\right)+1\right]}$

where ${\displaystyle \operatorname {erf} (z)}$ is the error function.

### Differential entropy

The differential entropy is given by[citation needed]

${\displaystyle H=1+\ln \left({\frac {\sigma }{\sqrt {2}}}\right)+{\frac {\gamma }{2}}}$

where ${\displaystyle \gamma }$ is the Euler–Mascheroni constant.

## Parameter estimation

Given a sample of N independent and identically distributed Rayleigh random variables ${\displaystyle x_{i}}$ with parameter ${\displaystyle \sigma }$,

${\displaystyle {\widehat {\sigma }}^{2}=\!\,{\frac {1}{2N}}\sum _{i=1}^{N}x_{i}^{2}}$ is the maximum likelihood estimate and also is unbiased.
${\displaystyle {\widehat {\sigma }}\approx {\sqrt {{\frac {1}{2N}}\sum _{i=1}^{N}x_{i}^{2}}}}$ is a biased estimator that can be corrected via the formula
${\displaystyle \sigma ={\widehat {\sigma }}{\frac {\Gamma (N){\sqrt {N}}}{\Gamma (N+{\frac {1}{2}})}}={\widehat {\sigma }}{\frac {4^{N}N!(N-1)!{\sqrt {N}}}{(2N)!{\sqrt {\pi }}}}}$[4]

### Confidence intervals

To find the (1 − α) confidence interval, first find the bounds ${\displaystyle [a,b]}$ where:

${\displaystyle P(\chi _{2N}^{2}\leq a)=\alpha /2,\quad P(\chi _{2N}^{2}\leq b)=1-\alpha /2}$

then the scale parameter will fall within the bounds

${\displaystyle {\frac {{N}{\overline {x^{2}}}}{b}}\leq {\widehat {\sigma }}^{2}\leq {\frac {{N}{\overline {x^{2}}}}{a}}}$[5]

## Generating random variates

Given a random variate U drawn from the uniform distribution in the interval (0, 1), then the variate

${\displaystyle X=\sigma {\sqrt {-2\ln U}}\,}$

has a Rayleigh distribution with parameter ${\displaystyle \sigma }$. This is obtained by applying the inverse transform sampling-method.

## Related distributions

• ${\displaystyle R\sim \mathrm {Rayleigh} (\sigma )}$ is Rayleigh distributed if ${\displaystyle R={\sqrt {X^{2}+Y^{2}}}}$, where ${\displaystyle X\sim N(0,\sigma ^{2})}$ and ${\displaystyle Y\sim N(0,\sigma ^{2})}$ are independent normal random variables.[6] (This gives motivation to the use of the symbol "sigma" in the above parametrization of the Rayleigh density.)
• The chi distribution with v = 2 is equivalent to the Rayleigh Distribution with σ = 1.
• If ${\displaystyle R\sim \mathrm {Rayleigh} (1)}$, then ${\displaystyle R^{2}}$ has a chi-squared distribution with parameter ${\displaystyle N}$, degrees of freedom, equal to two (N = 2)
${\displaystyle [Q=R^{2}]\sim \chi ^{2}(N)\ .}$
• If ${\displaystyle R\sim \mathrm {Rayleigh} (\sigma )}$, then ${\displaystyle \sum _{i=1}^{N}R_{i}^{2}}$ has a gamma distribution with parameters ${\displaystyle N}$ and ${\displaystyle {\frac {1}{2\sigma ^{2}}}}$
${\displaystyle \left[Y=\sum _{i=1}^{N}R_{i}^{2}\right]\sim \Gamma (N,{\frac {1}{2\sigma ^{2}}}).}$
• The Rice distribution is a noncentral generalization of the Rayleigh distribution: ${\displaystyle \mathrm {Rayleigh} (\sigma )=\mathrm {Rice} (0,\sigma )}$.
• The Weibull distribution with the "shape parameter" k=2 yields a Rayleigh distribution. Then the Rayleigh distribution parameter ${\displaystyle \sigma }$ is related to the Weibull scale parameter according to ${\displaystyle \lambda =\sigma {\sqrt {2}}.}$
• The Maxwell–Boltzmann distribution describes the magnitude of a normal vector in three dimensions.
• If ${\displaystyle X}$ has an exponential distribution ${\displaystyle X\sim \mathrm {Exponential} (\lambda )}$, then ${\displaystyle Y={\sqrt {X}}\sim \mathrm {Rayleigh} (1/{\sqrt {2\lambda }}).}$

## Applications

An application of the estimation of σ can be found in magnetic resonance imaging (MRI). As MRI images are recorded as complex images but most often viewed as magnitude images, the background data is Rayleigh distributed. Hence, the above formula can be used to estimate the noise variance in an MRI image from background data.[7] [8]

The Rayleigh distribution was also employed in the field of nutrition for linking dietary nutrient levels and human and animal responses. In this way, the parameter σ may be used to calculate nutrient response relationship.[9]

In the field of ballistics, the Rayleigh distribution is used for calculating the circular error probable - a measure of a weapon's precision.

In physical oceanography, the significant wave height may be derived analytically, since the distribution of wave heights approximately follows a Rayleigh distribution.[10]