Title: Default for 38.2 The Uniform Distribution
Course: HELM Workbooks 2023-2024

This Section introduces the simplest type of continuous probability distribution which features acontinuous random variableXwith probability density functionf(x)which assumes a constantvalue over a finite interval.

The uniform distribution

The Uniform or Rectangular distribution has random variable \(X\)  restricted to a finite interval \([a,b]\)  and has  \(f(x)\) constant over the interval.  An illustration is shown in the figure below:

[Image]

The function \(f(x)\)  is defined by: \[ f(x)=\left\{\begin{matrix} \dfrac{1}{b-a},& a\le x\le b\\\\ 0& \text{otherwise} \end{matrix}\right.\]

Mean and variance of a uniform distribution

Using the definitions of expectation and variance leads to the following calculations.   As you might expect, for a uniform distribution, the calculations are not difficult.  Using the basic definition of expectation we may write:

\begin{eqnarray*} \text{E}(X)&=&\int_{-\infty}^{\infty} x \cdot f(x)\;dx=\int_a^b x\dfrac{1}{b-a}\;dx =\dfrac{1}{2(b-a)}\left[\phantom{\dfrac{1}{1}}\!\!\! x^2\right]_a^b\qquad\qquad\qquad\qquad\qquad\qquad\\ &=&\dfrac{b^2-a^2}{2(b-a)}\\ &=&\dfrac{b+a}{2} \end{eqnarray*}

Using the formula for the variance, we may write:

\begin{eqnarray*} \text{V}(X)&=& \text{E}(X^2)-[\text{E}(X)]^2\\ &=&\int_a^bx^2 \cdot \dfrac{1}{b-a}\;dx-\left(\dfrac{b+a}{2}\right)^2= \dfrac{1}{3(b-a)}\left[\phantom{\dfrac{1}{1}}\!\!\!x^3\right]_a^b-\left(\dfrac{b+a}{2}\right)^2\qquad\qquad\qquad\qquad\\\ &=&\dfrac{b^3-a^3}{3(b-a)}-\left(\dfrac{b+a}{2}\right)^2\\ &=&\dfrac{b^2+ab+a^2}{3}-\dfrac{b^2+2ab+a^2}{4}\\ &=&\dfrac{(b-a)^2}{12} \end{eqnarray*}

Key Point

The Uniform random variable \(X\) whose density function \(f(x)\)  is defined by \[ f(x)=\left\{\begin{matrix} \dfrac{1}{b-a},& a\le x\le b\\\\ 0& \text{otherwise} \end{matrix}\right.\] has expectation and variance given by the formulae \[ \text{E}(X)=\dfrac{b+a}{2}\qquad\text{and}\qquad \text{V}(X)=\dfrac{(b-a)^2}{12}\]

Example

The current (in mA) measured in a piece of copper wire is known to follow a uniform distribution over the interval \([0,25]\).  Write down the formula for the probability density function \(f(x)\)  of the random variable \(X\) representing the current.  Calculate the mean and variance of the distribution and find the cumulative distribution function  \(F(x)\).

Solution

Over the interval \([0,25]\)  the probability density function \(f(x)\)  is given by the formula \[ f(x)=\left\{\begin{matrix} \dfrac{1}{25-0}=0.04,& 0\le x\le 25\\\\ 0& \text{otherwise} \end{matrix}\right.\] Using the formulae developed for the mean and variance gives \[ \text{E}(X)=\dfrac{25+0}{2}=12.5\ \text{mA}\qquad\text{and}\qquad \text{V}(X)=\dfrac{(25-0)^2}{12}=52.08\ \text{mA}^2\] The cumulative distribution function is obtained by integrating the probability density function as shown below. \[ F(x)=\int_{-\infty}^xf(t)\,dt\] Hence, choosing the three distinct regions \(x<0\), \(0\le x\le 25\) and \(x> 25\) in turn gives: \[ F(x)=\left\{\begin{matrix}0,& x<0\\ \dfrac{x}{25}& 0\le x\le 25\\ 1& x> 25 \end{matrix}\right.\]

Exercise

A protective coating applied to a conductor designed to work in corrosive conditions. The thickness of this coating, \(X\), follows a uniform distribution over the interval \([[value]\mu\text{m},[value]\mu\text{m}]\).  Find the expectation, standard deviation and the probability that the thickness of the coating is less than or equal to \( [value]\mu\text{m}\) thick.

\( \text{E}(X) = \) \(\mu\text{m}\)

\( \sigma(X) = \) \(\mu\text{m}\)

\( \text{P}(X\leq [value])=\)

Syntax hint: To enter \(\sqrt{2}\) use \(\texttt{sqrt(2)}\)
Feedback: Let the random variable \(X\) denote the thickness of the coating, then \(X \sim \text{Uniform}([value], [value])\) with probability density function: \[f(x) = \left\{\begin{array}{ll} 0, & \text{if $x < [value]$},\\ \dfrac{1}{[value]}, & \text{if $[value] \leq x\leq [value]$},\\ 0, & \text{if $x > [value]$}.\end{array}\right.\] Using the formulae developed for the mean and variance gives: \[\begin{align*} \text{E}(X) &= \dfrac{[value] + [value]}{2} = [value],\\ \text{V}(X) &= \dfrac{([value] - [value])^2}{12} = [value].\end{align*}\] This means that the expected value for the thickness of the coating is \(\text{E}(X) = [value]\mu\text{m}\) and the standard deviation in the coating thickness is \(\sigma(X) = \sqrt{[value]} = [value]\mu\text{m}\). The cumulative distribution function for this uniform random variable is: \[F(x) = \left\{\begin{array}{ll} 0, & \text{if $x < [value]$},\\ \dfrac{x-[value]}{[value]}, & \text{if $[value] \leq x\leq [value]$},\\ 1, & \text{if $x > [value]$}.\end{array}\right.\] Therefore, the probability that the thickness of the coating is less than or equal to \([value]\mu\text{m}\) is: \[\text{P}(X\leq [value]) = F([value]) = \dfrac{[value]-[value]}{[value]} = [value].\]

Exercise

In the manufacture of petroleum the distilling temperature (\(T^\circ\)C) is crucial in determining the quality of the final product.  \(T\) can be considered as a random variable uniformly distributed over \([value]^\circ\)C to \([value]^\circ\)C.  It costs  £\( A\) to produce 1 gallon of petroleum. If the oil distils at temperatures less than or equal to \([value]^\circ\)C the product sells for  £\(B\) per gallon.  If it distils at a temperature greater than \([value]^\circ\)C it sells for  £\(D\) per gallon.  Find the formula for the expected net profit per gallon.

Expected net profit per gallon =
Feedback: The distribution for the distilling temperature is \(T \sim \text{Uniform}([value], [value])\). The probability the distilling temperature is less than or equal to \([value]^\circ\)C is: \[ \text{P}(T\leq[value]) = \dfrac{[value] - [value]}{[value] - [value]} = [value].\] By the complement rule, the probability that the distilling temperature exceeds \([value]^\circ\)C is: \[\text{P}(T > [value]) = 1 - \text{P}(T \leq [value]) = 1 - [value] = [value].\] The net profit (sell price - cost price) per gallon under these two scenarios are presented in the table below: Scenario | \(T \leq [value]\) | \(T > [value]\) net profit | £\((B-A)\) | £\((D-A)\) Probability | \([value]\) | \([value]\) Therefore, the expected net profit per gallon is: \[\text{E}(\text{net profit}) = [value](B-A) + [value](D-A) = £[value]. \]

Exercise

Packages have a nominal net weight of 1 kg. However their actual net weights have a uniform distribution over the interval \( [value]\) g to \( [value]\)g.

1. Find the probability that the net weight of a package is less than 1 kg.

2. Find the probability that the net weight of a package is less than \(w\) g, where \( [value] < w < [value]. \)
3. If the net weights of packages are independent, find the probability that, in a sample of \([value]\) packages,  all \([value]\) net weights are less than \( w\) g and hence find the probability density function of the weight of the heaviest of the packages. (Hint: all \([value]\) packages weigh less than \( w\) g if and only if the heaviest weighs less than \( w\) g).

pdf:
Feedback: (a) The required probability is \( \text{P}(W < 1000) = \frac{1000-[value]}{[value]-[value]} = \frac{[value]}{[value]} =[value]\) (b) The required probability is \( \text{P}(W < w) = \frac{w-[value]}{[value]-[value]} = \frac{w-[value]}{[value]} \) (c) The probability that all five weigh less than \( w\) g is \( \left( \frac{w-[value]}{[value]} \right)^{[value]}\) so the pdf of the heaviest is \[ \frac{d}{dw} \left( \frac{w-[value]}{[value]} \right)^{[value]} = \frac{[value]}{[value]} \left( \frac{w-[value]}{[value]} \right)^{[value]-1} = [value] \text{ for } [value] < w < [value]. \]

Exercise

Packages have a nominal net weight of 1 kg. However, their actual net weights have a uniform distribution over the interval \([value]\text{g}\)to \( [value]\text{g}\).

1. Find the probability that the net weight of a package is less than \(1\) \(\text{kg}\).

2. Give a formula for evaluating the probability that the net weight of a package is less than \(w\text{g}\), where \( [value] < w < [value]. \)
Feedback: Let \(W\) denote the random variable for the package net weight in grams, with \(W \sim \text{Uniform}([value], [value])\). 1. The probability that the package net weight is less than \(1\text{kg}\) is: \[\text{P}(W < 1000) = \dfrac{1000-[value]}{[value]-[value]} = [value].\] 2. The probability that the package net weight is less than some value \(w\text{g}\) on the interval \( [value] < w < [value] \) is given by the uniform cumulative distribution function: \[\text{P}(W < w) = F_W(w) = \dfrac{w-[value]}{[value]-[value]} = [value].\]