Skip to main content
v2026.11,858 entries · CC-BY 4.0

Rayleigh Distribution: PDF, CDF, Mean and Worked Example

Rayleigh distribution explained: PDF, CDF, mean and variance, a worked σ = 2 example, maximum-likelihood estimation, and Excel, R and Python code.

Written and maintained by CASRAI Editorial Board

Last updated

The Rayleigh distribution is a continuous probability distribution for a non-negative quantity, such as the length of a two-dimensional vector whose two components are independent, zero-mean normal variables with the same variance. It has one scale parameter, σ, and its density rises from zero, peaks at x = σ and then tails off to the right. This page gives the PDF and CDF with every symbol explained, the mean, mode, median and variance, a worked example with the arithmetic shown, the maximum-likelihood estimate of σ, and short Excel, R and Python snippets.

Definition in one paragraph

A random variable X follows a Rayleigh distribution with scale σ > 0 when its density is f(x) = (x/σ²)·exp(−x²/(2σ²)) for x ≥ 0. NIST describes it as a special case of the chi distribution with 2 degrees of freedom and as a special case of the Weibull distribution with shape 2 (NIST Dataplot reference, RAYPDF). If X and Y are independent normal variables with mean 0 and the same variance σ², then √(X² + Y²) is Rayleigh with scale σ (Boost.Math documentation). Researchers meet it as a model for the magnitude of a two-component quantity, for example the length of a two-dimensional error vector.

Rayleigh distribution formula (PDF, CDF and moments)

With location 0, which is the usual form and the one used by Boost.Math and SciPy:

  • PDF: f(x; σ) = (x/σ²)·exp(−x²/(2σ²)), x ≥ 0
  • CDF: F(x; σ) = 1 − exp(−x²/(2σ²)); this follows by integrating the PDF from 0 to x
  • Survival function: P(X > x) = exp(−x²/(2σ²))
  • Mean: σ·√(π/2) ≈ 1.2533σ
  • Mode: σ
  • Median: σ·√(2 ln 2) ≈ 1.1774σ; this follows by solving F(x) = 0.5
  • Variance: σ²(4 − π)/2 ≈ 0.4292σ²

Symbols: x is the observed value (zero or larger); σ is the scale parameter, which is also the mode, and is not the standard deviation of the Rayleigh variable itself (that is σ·√((4 − π)/2) ≈ 0.6551σ). NIST’s more general form adds a location parameter u, giving f(x; u, σ) = ((x − u)/σ²)·exp(−(x − u)²/(2σ²)) for x > u. The standard Rayleigh has u = 0 and σ = 1.

Rayleigh distribution PDF derivation: from two normal components

Let X and Y be independent N(0, σ²). The pair (X, Y) has joint density (1/(2πσ²))·exp(−(x² + y²)/(2σ²)). Changing to polar coordinates (r, θ) gives a density proportional to r·exp(−r²/(2σ²)) in r, because the area element is r dr dθ. Integrating out the angle θ over 0 to 2π and normalising leaves exactly the Rayleigh PDF above. This is the reason the shape starts at zero: very small lengths require both components to be near zero at once, which has little area.

Worked example with real numbers

Suppose a measured length is Rayleigh with σ = 2 (any consistent unit). All values below were computed from the formulas above.

Quantity Arithmetic Result
Mode σ 2
Mean 2 × √(π/2) = 2 × 1.2533 2.5066
Median 2 × √(2 ln 2) = 2 × 1.1774 2.3548
Variance 2² × (4 − π)/2 = 4 × 0.4292 1.7168
Standard deviation √1.7168 1.3103
P(X ≤ 2) 1 − exp(−4/8) = 1 − 0.6065 0.3935
P(X > 3) exp(−9/8) 0.3247

Mode < median < mean (2 < 2.3548 < 2.5066) is the signature of a right-skewed distribution.

Estimating σ from data (maximum likelihood)

For a sample x₁,…,xₙ from a zero-location Rayleigh distribution, the maximum-likelihood estimate is σ̂² = Σxᵢ² / (2n). With the five observations 1.8, 2.6, 3.1, 0.9 and 2.2: the squares are 3.24, 6.76, 9.61, 0.81 and 4.84, which sum to 25.26. Then σ̂² = 25.26 / 10 = 2.526 and σ̂ = 1.5893. The estimate comes from setting the derivative of the log-likelihood to zero; the likelihood function guide explains the general method.

Interpretation: reading the numbers

If you see It means
Larger σ The whole distribution stretches to the right: the mode, mean and median all scale in direct proportion to σ.
Mean greater than median, median greater than mode Right skew, as expected for a Rayleigh variable (mean ≈ 1.2533σ, median ≈ 1.1774σ, mode = σ).
F(x) close to 1 x lies far in the right tail; the tail probability is exp(−x²/(2σ²)), which falls faster than exponentially.
Density near zero Near x = 0 the PDF is approximately x/σ², so short lengths are rare, unlike an exponential distribution.

Rayleigh vs Weibull, chi and generalised forms

The Rayleigh distribution is Weibull with shape k = 2 and scale λ = σ√2 (NIST Dataplot, RAYPDF). Check: the Weibull CDF 1 − exp(−(x/λ)²) becomes 1 − exp(−x²/(2σ²)) when λ² = 2σ². So the Weibull equation guide covers the general family, and Rayleigh is the fixed-shape member. It is also the chi distribution with 2 degrees of freedom scaled by σ, which links it to the chi-square probability distribution: the square of a Rayleigh variable divided by σ² is chi-square with 2 degrees of freedom. Boost.Math lists the chi, Rice and Weibull distributions as generalisations of the Rayleigh distribution.

Assumptions and common mistakes

  • Treating σ as the standard deviation. It is the scale and the mode. The standard deviation is about 0.6551σ.
  • Mixing parametrisations. Some software and papers use a rate-like parameter or the Weibull scale λ = σ√2. Always confirm what the parameter means before comparing numbers.
  • Ignoring the zero-location assumption. The MLE above assumes the location is 0. If values are shifted, subtract the location first or fit it separately.
  • Using it for components that are not equal-variance and independent. If the two components have different variances or a non-zero mean, the length is not Rayleigh (the non-zero-mean case leads to the Rice distribution).
  • Negative values. The support is x ≥ 0; a variable that can be negative is not Rayleigh.

How to report it (APA example)

Name the distribution, the estimation method and the estimated parameter with the sample size, for example: “Radial displacement was modelled with a Rayleigh distribution; the maximum-likelihood estimate of the scale was σ̂ = 1.59 (n = 5).” Report the parametrisation if it could be confused with the Weibull scale, and give a goodness-of-fit check such as a Q–Q plot when the model choice matters. Cite the software and its version (for example, SciPy 1.18).

How to calculate it in Excel, R or Python

Excel

CDF at x in B1, scale in B2:  =1-EXP(-B1^2/(2*B2^2)) PDF:                          =B1/B2^2*EXP(-B1^2/(2*B2^2)) MLE of sigma, data in A1:A5:  =SQRT(SUMSQ(A1:A5)/(2*COUNT(A1:A5)))

R

Base R has no Rayleigh function; the closed forms are short, and the VGAM package provides drayleigh, prayleigh and qrayleigh.

x <- c(1.8, 2.6, 3.1, 0.9, 2.2) sigma_hat <- sqrt(sum(x^2) / (2 * length(x)))   # 1.5893 1 - exp(-3^2 / (2 * 2^2))                        # P(X <= 3) when sigma = 2: 0.6753

Python (SciPy)

scipy.stats.rayleigh uses the scale argument for σ.

from scipy.stats import rayleigh rayleigh.mean(scale=2)         # 2.5066 rayleigh.median(scale=2)       # 2.3548 rayleigh.sf(3, scale=2)        # 0.3247 rayleigh.fit([1.8, 2.6, 3.1, 0.9, 2.2], floc=0)   # (0, 1.5893)

FAQ

What is Rayleigh’s equation?

The name is used for several different things. In statistics it usually means the Rayleigh PDF, f(x) = (x/σ²)·exp(−x²/(2σ²)). In optics, “Rayleigh scattering” and the “Rayleigh criterion” for resolution are unrelated results named after the same physicist, so check which one a source means.

Does Gaussian distribution mean normal distribution?

Yes. “Gaussian” and “normal” are two names for the same bell-shaped distribution. The link to this page is that the Rayleigh distribution is built from two Gaussian components, as derived above. See normal and standard normal distribution.

What is PDF and PMF?

A probability density function (PDF) describes a continuous variable: probabilities come from the area under the curve, and the height at a point is not itself a probability. A probability mass function (PMF) describes a discrete variable and gives P(X = x) directly. The Rayleigh distribution is continuous, so it has a PDF; for the discrete case see probability mass function formula.

What does z ~ N(0,1) mean?

It means z follows a normal distribution with mean 0 and variance 1, the standard normal. In the Rayleigh construction, if X and Y are N(0, σ²), then X/σ and Y/σ are each ~ N(0,1) and the length of (X, Y) divided by σ is a standard Rayleigh variable (σ = 1).

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Rayleigh Distribution: PDF, CDF, Mean and Worked Example

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →