This used to be a philosophy question, but let's calculate!
One day, a teacher told his student to go to the garden behind the school. The garden is a straight corridor with several kinds of flowers beside it. The teacher told the student, "There are some roses in the garden. You must walk in the corridor from beginning to end and pick the rose that you think is the most beautiful. Be careful, you cannot walk back, you can only move forward: you cannot regret once you pass a flower not picking it."
The student then figures out the following plan, knowing the garden has exactly 1 1 roses:
What is the probability that the student actually picks the most beautiful rose?
If the probability can be expressed as b a , where a and b are coprime positive integers, find the value of a + b .
Details and Assumptions:
Bonus: Generalize the expression of the probability P ( n , k ) with n − k ≥ 1 for arbitrary values of n and k , where n denotes the total number of roses in the garden, and k the number of roses the student first observed but didn't pick. For instance, this question asks for P ( 1 1 , 5 ) = b a . In addition, what relationship do n and k have, to maximize the probability?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
For very large n , the optimum number of k roses to inspect before making a decision thereafter is
k = e n
where e is Euler's number.
so, for example, if only the first 4 flowers were checked instead of 5 , then the probability that the prettiest rose will be picked is 6 3 0 2 5 1 = 0 . 3 9 8 4 1 3 > 0 . 3 8 4 3 8 , using your own formula.
We can integrate instead of summing d − 1 1 to work out this limiting value k = e n , since this is for large n .
This does have a real-life practical application. If you decide that you're only going to look at k items out of n , and then pick the first that is better than any of the first k , then first look at e n items and afterwards make your pick.
Maybe you can post "the next..." of this problem by asking for this optimum ratio?
Log in to reply
Yes, I recently wanted to put the optimum ratio in the bonus section, but I will not do it, since you have discover the answer of it. Thanks for answer the question!
Log in to reply
Why can't you add that to the bonus section? I had only wondered about the relationship between "5" and "11", and thought maybe it had something to do with maximum probability of picking the best flower.
As a philosophical question, if I have n things to look at, it makes sense to adopt this strategy only if you're not allowed to return anywhere. After all, in adopting this strategy, you're likely to find the best flower after looking at about half of the flowers, but you only have a probability of 37% success in finding it, when the probability of the best flower being somewhere in the first half is about 50%. But sometimes in real life, you can't go back. For example, if you know that there are 10 homes in the market, and knowing that after you've passed up a home for sale it is very likely to sell very quickly afterwards, first check about 3 or 4 homes, and then afterwards pick the first home better than any of them.
Well, I just not care about the optimum ratio, 11 and 5 just two random numbers! Oh, I'm sorry, I mean I won't put a new question about it, I will put it in the bonus section. Thanks for suggestion!
Log in to reply
@Kelvin Hong – I think it moves your problem from "philosophy" to a real-life application. I'm still thinking about the consequences of this. Thanks for adding to the bonus, and your very interesting problem. Difficult to analyze.
Log in to reply
@Michael Mendrin – Ya thanks! Also, note that this question is not original, I took it from my friend math course problem. Have fun!
I wonder how to calculate the optimum ratio? Can you explore here?
Log in to reply
For large n , we can integrate instead of summing, so
n k ∫ k + 1 n d − 1 1
n k ( L o g ( n − 1 ) − L o g ( k ) )
Differentiating this with respect to n gets us, to find the maximum probability
n ( n − 1 ) k − n 2 k ( L o g ( n − 1 ) − L o g ( k ) ) = 0
which we can rearrange to
k n − k ( n − 1 ) L o g ( k n − 1 ) = 0 , or
n n − 1 L o g ( k n − 1 ) = 1
Let k = x n where x is some constant. then we have
n n − 1 L o g ( n n − 1 x ) = 1
so that as n → ∞ , x → e
This is easy compared to the work you've done in deriving the sum.
Thanks for your calculation Mr. Mendrin, I will add this to the bonus section.
P ( n , k ) P ( 1 1 , 5 ) = i = 1 ∑ n P ( The i -th rose is picked ) × P ( The i -th rose is the best ) = n 1 ( i = 1 ∑ k 0 + i = k + 1 ∑ n P ( The most beautiful rose in the first ( i − 1 ) roses is in the first k roses ) ) = n 1 i = k + 1 ∑ n i − 1 k = n k i = k + 1 ∑ n i − 1 1 = 5 5 4 4 2 1 3 1
See Michael's comment for the optimum ratio for large n
I will present a solution which may be similar to @Julian Poon despite I did not get this correctly.
The number of permutations satisfying our requirements = d = k + 1 ∑ n 1 ⋅ ( d − 1 n − 1 ) ⋅ ( 1 k ) ⋅ ( d − 2 ) ! ⋅ ( n − d ) !
The total number of all possible permutations = n !
Let me explain the details in deriving this crucial first line.
I can't attach an image here, so please refer to @Kelvin Hong image.
Let S = { a 1 , a 2 , . . . , a n } where a 1 is the most beautiful flower and a n is the ugliest flower.
We assign a 1 , the prettiest to the d th spot from left for k + 1 ≤ d ≤ n . There is 1 way to do so.
After the prettiest flower has been assigned, there are still n − 1 flowers left to be assigned.
Of n − 1 flowers, choose d − 1 flowers to be assigned to the first d − 1 spots, giving us ( d − 1 n − 1 ) .
But the prettiest of the d − 1 chosen flowers should be assigned to the first k spots. Otherwise the student will pick it instead of a 1 and walk away, which is not desired. So, there are ( 1 k ) to do so.
The remaining d − 2 chosen flowers can be arranged randomly in the remaining spots before the d t h spot. So, there are ( d − 2 ) ! possible number of ways to do so.
Then, the remaining flowers that are unassigned can be arranged at random. Since the first d flowers has been assigned, the number of them = n − d . So, there are ( n − d ) ! possible number of ways to do so.
With all being explained, we are ready to move on to the computational process.
The number of permutations satisfying our requirements
= d = k + 1 ∑ n 1 ⋅ ( d − 1 n − 1 ) ⋅ ( 1 k ) ⋅ ( d − 2 ) ! ⋅ ( n − d ) ! = d = k + 1 ∑ n ( d − 1 ) ! ( n − d ) ! ( n − 1 ) ! ⋅ k ⋅ ( d − 2 ) ! ⋅ ( n − d ) ! = d = k + 1 ∑ n ( d − 1 ) ! ( n − 1 ) ! ⋅ k ⋅ ( d − 2 ) ! = d = k + 1 ∑ n ( d − 1 ) ( d − 2 ) ! ( n − 1 ) ! ⋅ k ⋅ ( d − 2 ) ! = d = k + 1 ∑ n d − 1 ( n − 1 ) ! ⋅ k
We see that n , k are constants in the original question.
∴ d = k + 1 ∑ n d − 1 ( n − 1 ) ! ⋅ k = k ( n − 1 ) ! d = k + 1 ∑ n d − 1 1
P ( n , k ) = n ! k ( n − 1 ) ! ∑ d = k + 1 n d − 1 1 = n ( n − 1 ) ! k ( n − 1 ) ! ∑ d = k + 1 n d − 1 1 = n k ∑ d = k + 1 n d − 1 1
∴ P ( n , k ) = n k ∑ d = k + 1 n d − 1 1
Returning to the question, n = 1 1 , k = 5
P ( 1 1 , 5 ) = 1 1 5 ∑ d = 6 1 1 d − 1 1 = 1 1 5 ( 5 1 + 6 1 + 7 1 + 8 1 + 9 1 + 1 0 1 ) = 5 5 4 4 2 1 3 1
a + b = 2 1 3 1 + 5 5 4 4 = 7 6 7 5
Problem Loading...
Note Loading...
Set Loading...
Let's start the generalization. Assume that the total number of roses be n and the number of roses to be observed be k . Then, arrange the flower according to their degree of beautiful (I know beautiful is different to everyone, but just focus on the mathematical side!). We will have the set S = { a 1 , a 2 , a 3 , … , a n } where a 1 is the most beautiful flower, a 2 is the second most beautiful flower, a n is the ugliest flower.
Note that, a 1 cannot be in the first k roses because the student will not pick them, so we only consider the case a 1 on the position d where k + 1 ≤ d ≤ n . Furthermore, we need to know the chance a 1 appear on every position is n 1 , so every case with a value d will have a base probability B = n 1 .
Let's discuss if a 1 is on the position d , then consider if we put the first k ugliest roses on the first k position which are the roses in the set { a n − k + 1 , a n − k + 2 , … , a n } , then the student must pick up the k + 1 t h roses because it is the most beautiful compared to the first k . It isn't what we want. So there is a bound where we need to decide to put the roses in the first k position.
There are exactly d − 1 roses in front of a 1 , so the first d − 1 ugliest roses must at front of a 1 as the minimum condition. To calculate this, we need to know the d − 1 t h ugliest rose is a n − d + 2 . At the minimum case, a n − d + 2 must be the most beautiful rose in the first d − 1 roses and must place at position inside the first k roses, to ensure the student will pick the rose at the position d , which is what we want.
Before calculating these messy things, we first define the set A i to be the valid permutation of roses when the most beautiful rose in the first k roses is a i . To make it clear, every element in the set A i is a string contains all of the flowers a 1 to a n , but with different permutations. Then, the student must pick up the actual most beautiful rose by the permutation of these elements, which is called "valid permutation".
Then, let the sample set S P be all of the permutation when a 1 fixed at the position d , so n ( S P ) = ( n − 1 ) !
After the setting process, we now count the number of elements aka the valid permutations of roses in the set A n − d + 2 . a n − d + 2 must in the first k position, there are k choices for it to be planted. then all of the roses uglier then a n − d + 2 must place in front of position d , that is ( d − 2 ) ! . Then, all of the roses more beautiful than a n − d + 2 must place after position d , that is ( n − d ) ! . So n ( A n − d + 2 ) = k [ ( d − 2 ) ! ] [ ( n − d ) ! ]
Then, we consider the case for the set A n − d + 1 . We put a n − d + 1 in first k position, which is k choices. Then there are n − d − 1 roses more beautiful than it (not n − d , already excluded a 1 ), and we gonna put it after position d , which is n − d slots, so it is 1 ! ( n − d ) ! = ( n − d ) ! . After that, there are d − 1 roses left, all of them are uglier than a n − d + 1 , so the number of permutation of them will be ( d − 1 ) ! . Combining all of these, we get n ( A n − d + 1 ) = k [ ( d − 1 ) ! ] [ 1 ! ( n − d ) ! ]
Then, the case A n − d will lead to the result n ( A n − d ) = k [ d ! ] [ 2 ! ( n − d ) ! ] .
We just need to loop through the case until A 2 , not A 1 , because the most beautiful rose will not place on the first k position, so n ( A 2 ) = k [ ( n − 2 ) ! ] [ ( n − d ) ! ( n − d ) ! ]
Let the probability the student successfully pick up a 1 when it is on the d position be P ( d ) , then it can be expressed as P ( d ) = n ( S P ) n ( A n − d + 2 ) + n ( S P ) n ( A n − d + 1 ) + n ( S P ) n ( A n − d ) + ⋯ + n ( S P ) n ( A 2 ) = ( n − 1 ) ! k [ ( n − d ) ! ] [ ( d − 2 ) ! + 1 ! ( d − 1 ) ! + 2 ! d ! + ⋯ + ( n − d ) ! ( n − 2 ) ! ]
By using the identity (which will be prove at the bottom of the solution) r ! + 1 ! ( r + 1 ) ! + 2 ! ( r + 2 ) ! + ⋯ + ( n − r ) ! n ! = r ! ( r + 1 n + 1 ) We can simplify P ( d ) to P ( d ) = ( n − 1 ) ! k [ ( n − d ) ! ] [ ( d − 2 ) ! ] ( d − 1 n − 1 ) = ( n − 1 ) ! k [ ( n − d ) ! ] [ ( d − 2 ) ! ] [ ( d − 1 ) ! ] [ ( n − d ) ! ] ( n − 1 ) ! = d − 1 k
Overall, the student pick up a 1 no matter what position it is k + 1 ≤ d ≤ n will be P = B d = k + 1 ∑ n P ( d ) = n k [ k 1 + k + 1 1 + k + 2 1 + ⋯ + n − 1 1 ] = n k d = k + 1 ∑ n d − 1 1 Since the harmonic series can't be simplify anymore, this is the generalized form of the probability. Let me write down here: P ( n , k ) = n k d = k + 1 ∑ n d − 1 1 Substituting n = 1 1 and k = 5 , we will get P ( 1 1 , 5 ) = 1 1 5 [ 5 1 + 6 1 + 7 1 + 8 1 + 9 1 + 1 0 1 ] = 5 5 4 4 2 1 3 1 , so the sum a + b will equal to 2 1 3 1 + 5 5 4 4 = 7 6 7 5 .
You can see the calculation about finding the optimum ratio of n and k done by Michael Mendrin in the comment section below.
Below is the proof of the identity.
Prove that r ! + 1 ! ( r + 1 ) ! + 2 ! ( r + 2 ) ! + ⋯ + ( n − r ) ! n ! = r ! ( r + 1 n + 1 )
Proved by Induction:
When n = r , L H S = r ! , R H S = r ! ( r + 1 r + 1 ) = r ! , the equality holds.
Assume that the identity holds when n = r + k , that is r ! + 1 ! ( r + 1 ) ! + 2 ! ( r + 2 ) ! + ⋯ + k ! ( r + k ) ! = r ! ( r + 1 r + k + 1 ) . Then when n = r + k + 1 , we have L H S = r ! ( r + 1 r + k + 1 ) + ( k + 1 ) ! ( r + k + 1 ) ! = k ! ( r + 1 ) ! r ! ( r + k + 1 ) ! + ( k + 1 ) ! ( r + k + 1 ) ! = k ! ( r + k + 1 ) ! [ r + 1 1 + k + 1 1 ] = k ! ( r + k + 1 ) ! ( r + 1 ) ( k + 1 ) r + k + 2 = ( r + 1 ) [ ( k + 1 ) ! ] ( r + k + 2 ) ! = r ! ( r + 1 ) ! ( k + 1 ) ! ( r + k + 2 ) ! = r ! ( r + 1 r + k + 2 ) = R H S This completes the proof.