# A Short Probability Problem
Table of Contents
The problem
Given a1 ~ Unif(0,1), a2 ~ Unif(0,2), a3 ~ Unif(0,3), a4 ~ Unif(0,4) and a5 ~ Unif(0,5), what is P(a1 <= a2 <= a3 <= a4 <= a5)?
I recently saw this problem in an instagram reel, and after some help from a friend (thanks zhi!) and an hour plus of struggling with it, I finally (roughly) understand how to approach this!
Note: I am extremely unfamiliar with math in general and therefore some things were extremely foreign to me
Mistakes
I have solved a similar problem (janestreet dec 2025, writeup coming!) before where we had to calculate something like P(a1 <= a2).
One way to approach this is geometrically (groan).
As you can see, the square represents the space of all possible combinations of (a1,a2).
Therefore, if we want to find the probability that a1<=a2, we can simply take the area where a1<=a2/total area.
With this in mind,
Therefore, a natural follow up to having more a_x would to this thinking into a higher-dimensional space.
This 5D space would have volume 1x2x3x4x5 = 120 (a1 x a2 x a3 x a4 x a5)
Then, we should ask ourselves what hyper-volume of this space represents the set of (a1,a2,a3,a4,a5) where a1 <= a2 <= a3 <= a4 <= a5?
PS: it is probably not important to read past here if you are merely trying to understand the solution. This is more of a “for myself” section.
As a professionally terrible at geometry enjoyer, I was already getting lost here. No matter, chatgpt to the rescue!
Now, ChatGPT 5.2 thinking suggested that I start from a1 and integrate my way up to a5. Sounds reasonable.
Therefore, let be the length of the 1D volume of choices for a1 given .
Therefore, would be the volume of the N-D volume of choices for given that
To find the resultant volume, we would simply evaluate .
Let us now try this.
Given , can exist in the interval [0, min(1,u)].
Therefore,
and then, given that
To compute this integral, we would now have to split between the cases where , , and then for each of these cases, there are subcases for the ranges of t as well.
This quickly becomes a mess of piecewise functions and feels terrible to calculate. There has to be a better way!
The better way
Previously, we attempted to integrate from the bottom up, starting with a1 and working our way up to a5.
The problem we faced was that each function was dependent on the functions before it, and therefore dependent on the bounds of each random variable before it.
This “stacking” of piecewise functions caused an explosion in the number of terms we had to evaluate, as we had to “update” the “state” of each integral with the potential states of past integrals.
What if we try to integrate from the bottom down instead? If we start by integrating from , which only depends on (as implicitly “encodes” the information of , we might not need to deal with this issue)
Our goal still satyas the same, to have a 5D space which volume represents the set of all , and to find the hyper-volume of the space which represents the set of where .
Let us start with .
The “length” of values that can take is .
This is because and .
The alternative way to think about this is that the 1-D volume that can take is given by the integral
Therefore, the 2-D volume that is given by the set of valid values is
This is because and .
Therefore, by integrating the length of over the values of , we can find the area.
Here is the key observation. We can say that the values of solely depend on the value of ! This is due to the fact that for to exist in the set of valid solutions, the previous criteria for have already been fulfilled.
Next, we find the 3-D volume that is given by the set of valid values, with the same set of reasoning as before
Now, for the 4-D volume that is given by the set of valid values, with the same set of reasoning as before
And finally, for the 5-D volume that is given by the set of valid values
And to arrive at the final answer,
There you have it! Hopefully this was helpful and interesting :D