A continuous random variable X with a<b follows the Uniform distributionX∼Uniform(a,b) if it is equally likely to take any value in the interval [a,b]. Formally, the Uniform distribution of a random variable is given by the PDF
so that every subinterval of [a,b] of the same length has the same probability.
Then, the CDF of X is given by
0 & x \leq a, \
\dfrac{x-a}{b-a} & x \in (a, b), \
1 & x \geq b.
\end{cases}$$
Examples
Meeting Probability
Two bankers each arrive at the station at some uniformly random time between 5:00AM and 6:00AM. They stay exactly 5 minutes, and then leave.
What is the probability that they meet on a given day? X,Y∼iidUniform(0,60) represent the exact time (in minutes) of each banker's arrival. We are trying to solve for the constraint ∣X−Y∣≤5, such that p=P(∣X−Y∣≤5). With this inequality, we get Y≥X−5 and Y≤X+5. The following is a visual representation of the area between our two lines:
Let
\usepackage{pgfplots}\begin{document}\begin{tikzpicture} \begin{axis}[ width=8cm, height=8cm, xmin=0, xmax=60, ymin=0, ymax=60, axis equal image, xlabel={$X$}, ylabel={$Y$}, ylabel style={rotate=-90}, title={Region $|X-Y| \leq 5$} ] % Shade the region |x - y| < 5 by plotting its polygonal boundary: \addplot [ draw=none, fill=black, opacity=0.1, ] coordinates { (0,0) % lower‐left corner of the square (5,0) % intersection of y = x - 5 with y=0 (60,55) % intersection of y = x - 5 with x=60 (60,60) % upper‐right corner of the square (still inside |x-y|<5) (55,60) % intersection of y = x + 5 with y=60 (0,5) % intersection of y = x + 5 with x=0 (0,0) % back to (0,0) to close the polygon }; % Draw the boundary lines y = x + 5 and y = x - 5: \addplot [ domain=0:60, samples=2, thick, ] {x + 5} node[midway, sloped, above] {$Y = X + 5$}; \addplot [ domain=0:60, samples=2, thick, ] {x - 5} node[midway, sloped, below] {$Y = X - 5$}; % Draw the square [0,60]×[0,60]: \draw[black] (axis cs:0,0) rectangle (axis cs:60,60); \end{axis}\end{tikzpicture}\end{document}
To find the area between the curves, we can integrate and remove the extra parts. However, an easier method would be to think of the unshaded area as two triangles, each with area 21552, and subtract them from the total area of 602. That area of the inequality is 602−552=(60−55)(60+55)=575.
Since our sample space has an area of 602=3600, P(∣X−Y∣≤5)=3600575=14423.
Stick Cutting
You break a stick twice uniformly at random.
What is the probability that the 3 segments can form a triangle? X,Y∼iidUniform(0,1) represent the points of the first two cuts. Using these two random variables, we can cut the stick into 3 pieces: if X<Y, the 3 cuts are X, Y−X and 1−Y, and vice-versa for X>Y:
By the triangle inequality, 3 lines can form a triangle if and only if the sum of any two of the three lines is larger than the third line. As such, for the case of X<Y, we have:
X+(Y-X) > 1-Y &\implies Y > 1/2 \\
X+1-Y>Y-X &\implies Y < 1/2 + X \\
Y-X+1-Y > X &\implies X < 1/2
\end{align}$$
We use symmetry on $X>Y$, and get the following two feasible regions:
```tikz
\begin{document}
\begin{tikzpicture}[scale=6]
% Draw the unit square
\draw[thick] (0,0) rectangle (1,1);
% Draw the two mid‐lines
\draw[thick] (0.5,0) -- (0.5,1);
\draw[thick] (0,0.5) -- (1,0.5);
% Draw the two “triangle‐inequality” diagonals in each half
\draw[thick] (0,0.5) -- (0.5,1) node[midway, sloped, above] {$y=x+1/2$};
\draw[thick] (0.5,0) -- (1,0.5) node[midway, sloped, below] {$y=x-1/2$};
% Shade the two feasible triangles:
% Top‐left triangle: vertices (0,0.5),(0.5,0.5),(0.5,1)
\fill[black, opacity=0.1] (0,0.5) -- (0.5,0.5) -- (0.5,1) -- cycle;
% Bottom‐right triangle: vertices (0.5,0),(1,0.5),(0.5,0.5)
\fill[black, opacity=0.1] (0.5,0) -- (1,0.5) -- (0.5,0.5) -- cycle;
% X-Axis Ticks
\node[below left] {0};
\node[below] at (0.5, 0) {1/2};
\node[below] at (0.5, -0.1) {$X$};
\node[below] at (1, 0) {1};
% X-Axis Ticks
\node[left] at (0, 0.5) {1/2};
\node[left] at (-0.15, 0.5) {$Y$};
\node[left] at (0, 1) {1};
\end{tikzpicture}
\end{document}
```
Because 2 of the 8 half-quadrants (equivalently, 1 of the 4 quadrants) of the sample space are feasible, the probability that the 3 segments can form a triangle is $1/4$.