Given 5 numbers, each randomly chosen between zero and one, what is the probability that the number in the "middle" (the third one when sorted) is between 0.4 and 0.6?
I found this easier to calculate the probability that the median will not be in the range 0.4 to 0.6 and then take the complementary probability.
If the median is less than 0.4 then at least three of the five numbers are less than 0.4. Similarly, if the median is more than 0.6 then at least three of the five numbers are more than 0.6. These two events are independent since there are only five numbers total to distribute.
The probability that at least three of the five numbers are all less than 0.4 is equal to the sum of the first three terms of the binomial expansion of (0.4 + 0.6)^5. Those three terms are C(5,0)*(0.4)^5*(0.6)^0 + C(5,1)*(0.4)^4*(0.6)^1 + C(5,2)*(0.4)^3*(0.6)^2.
C(5,0)*(0.4)^5*(0.6)^0 + C(5,1)*(0.4)^4*(0.6)^1 + C(5,2)*(0.4)^3*(0.6)^2
= 1*2^5/5^5 + (5)*2^4*3/5^5 + 10*2^3*3^2/5^5
= 32/3125 + 240/3125 + 720/3125 = 992/3125
992/3125 is the probability that at least three of the five numbers are all less than 0.4. Using the same calculation 992/3125 is also the at least three of the five numbers are more than 0.6. Therefore the probability the median number is between 0.4 and 0.6 is 1 - 992/3125 - 992/3125 = 1141/3125.