Jump to content

Wikipedia:Reference desk/Archives/Mathematics/2008 December 21

From Wikipedia, the free encyclopedia
Mathematics desk
< December 20 << Nov | December | Jan >> December 22 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


December 21

[edit]

Feynman Restaurant Problem

[edit]

(This problem and its solution were invented by Michael Gottlieb based on a story told to him by Ralph Leighton. It can be found posted at www.feynmanlectures.info.)

Assume that a restaurant has N dishes on its menu that are rated from worst to best, 1 to N (according to your personal preferences). You, however, don't know the ratings of the dishes, and when you try a new dish, all you learn is whether it is the best (highest rated) dish you have tried so far, or not. Each time you eat a meal at the restaurant you either order a new dish or you order the best dish you have tried so far. Your goal is to maximize the average total ratings of the dishes you eat in M meals (where M is less than or equal to N).

The average total ratings in a sequence of meals that includes n "new" dishes and b "best so far" dishes can be no higher than the average total ratings in the sequence having all n "new" dishes followed by all b "best so far" dishes. Thus a successful strategy requires you to order some number of new dishes and thereafter only order the best dish so far. The problem then reduces to the following:

Given N (dishes on the menu) and M <= N (meals to be eaten at the restaurant), how many new dishes D should you try before switching to ordering the best of them for all the remaining (M–D) meals, in order to maximize the average total ratings of the dishes consumed?

Honestly I have no idea how you're supposed to answer this...any ideas? —Preceding unsigned comment added by 65.92.236.87 (talk) 03:51, 21 December 2008 (UTC)[reply]

A very similar, though simpler, problem is the secretary problem. Perhaps you will find something helpful there. Eric. 68.18.63.75 (talk) 05:03, 21 December 2008 (UTC)[reply]
A google search for "Feynman's restaurant problem" turns up a page with an expression for D in terms of M (I assume the OP has already seen this, as they state the problem with exactly the same words and notation). However, it doesn't say how this expression is derived. Also, as the given expression does not involve N, I am wondering if it is only an asymptotic solution for M << N. Gandalf61 (talk) 12:48, 21 December 2008 (UTC)[reply]
Wasn't getting very far with the discrete version of the problem as originally posed, so I thought let's assume M<<N and transition to a continuous version. So assume each dish has a "score" which is a real number normalised to be in the range [0,1], and when you choose a new dish, the score of this dish is uniformly distributed in [0,1]. You choose a new disk on the first D visits, then choose the best dish eaten so far on the remaining M-D visits. You don't know the scores of the dishes - you only know which dish out of those eaten so far has scored highest. Objective is to choose D so as to maximise the expected total score across all M visits.
After choosing new dishes on the first D visits, the expected total score so far is D/2. Suppose the expected score of the best dish after sampling k different dishes is bk. Then you want to choose D so as to maximise (D/2) + (M - D)bD.
I couldn't find a closed form for bk, but I did find that
which is sufficient to set up a spreadsheet model. For M = 10, 50, 100, 200 I get D = 4, 11, 16, 24. The expression in the link I referred to above gives D = 3.7, 9.1, 13.2, 19.0. So either I am over-estimating D or the link solution is under-estimating D. Gandalf61 (talk) 18:12, 21 December 2008 (UTC)[reply]
Okay, I think I am over-estimating D, as a numerical simulation shows better agreement with the values given by the link solution. I think my recursive expression for bk must be wrong. Does anyone know what the expected value of the maximum of k values each drawn from a U(0,1) distribution is ? Gandalf61 (talk) 15:19, 22 December 2008 (UTC)[reply]
I've looked at this and if you try to find an exact expression of the function of M you're optimizing, you get a sum of expressions involving factorials, and I don't really know where to go from there. Namely, unless I've miscalculated, you need to pick M to maximize:
  • [This was a mistake - see below.]
Anybody know how to do this?
On the other hand, I think you can approximate the problem this way for large N: You get to eat N dishes. Each time you try a new dish, its quality is a random real number between 0 and 1. How many times should you try a new dish before settling?
Unless I've made a mistake, this problem can be solved almost exactly. By "almost" I mean you get M within 1.
The probability, after M tries, that the best dish had quality ≤ t is tM. Thus you get a probability density function by differentiating: MtM - 1. The expectancy of the best dish after M tries is the integral over [0,1] of t times this function, which gives M / (M + 1). So the thing you want to maximize is (1 / 2)M + (N - M)M / (M + 1). A little calculus (please correct me if I've miscalculated) shows that this function of a real variable M increases until it attains a maximum at the real number sqrt(2N + 2) - 1, and then decreases. Therefore the maximum is one of the two integers nearest sqrt(2N + 2) - 1.
If I haven't made a mistake, I imagine that with a lot of extra work, this could be turned into a proof that in the actual problem the optimal M is asymptotically equivalent to sqrt(2N). Joeldl (talk) 16:01, 22 December 2008 (UTC)[reply]

It seems I misinterpreted the problem. What was called D above, I called M, and for some reason I remembered the problem as having M and N identical. So in what I wrote, replace N with M and M with D, and N is sort of infinite. Also, the exact formula I gave first is for a special case. Sorry - I shouldn't have worked from memory. Joeldl (talk) 16:08, 22 December 2008 (UTC)[reply]

Okay, this might be a correct formula to maximize in terms of D:

  • [Correction: The formula should have been ]
The sum can be simplified
Bo Jacoby (talk) 23:41, 22 December 2008 (UTC).[reply]
Uh, except that that's not correct. Take N = 4 and D = 2 for an example. Joeldl (talk) 05:37, 23 December 2008 (UTC)[reply]

Uh, how embarassing. Thank you. I ment to write

Your function becomes

Bo Jacoby (talk) 09:41, 23 December 2008 (UTC).[reply]

Joeldl, can you explain how you derived your expression
Is it exact, or is it an approximation for M<<N ? Gandalf61 (talk) 09:21, 23 December 2008 (UTC)[reply]
It's exact. I'll get back to you in a bit, Gandalf.
Bo Jacoby, I think it's still wrong, but thanks for the idea, because I think the sum is
  • .
I get it: you count the number of D + 1 element subsets of {1,...,N + 1} by counting for each k how many of those subsets have k + 1 as their maximum. Joeldl (talk) 10:07, 23 December 2008 (UTC) . (Joeldl, you are right again. Bo Jacoby (talk) 22:47, 23 December 2008 (UTC).)[reply]


Actually, I screwed up the formula too. What I did was say that the thing we're trying to maximize is

where EN,D is the expectancy of the maximum of a randomly chosen D-element subset of {1,...,N}. The number of sets with maximum equal to k is , so

and this can be further simplified, as we now know. So my formula was off. Joeldl (talk) 10:35, 23 December 2008 (UTC)[reply]

Actually, ED,N simplifies to (N + 1)D / (D + 1). There must be a simpler argument for this! Joeldl (talk) 10:43, 23 December 2008 (UTC)[reply]

This means that the function to be maximized is

  • .

This shows that the optimal D depends only on M and not on N, and is one of the two integers closest to sqrt(2M + 2) - 1.

Now we need to figure out a simple argument for why this didn't depend on N. Joeldl (talk) 10:49, 23 December 2008 (UTC)[reply]

The preceding calculations may be intimidating, so let's reformulate the question. Basically, the question is this: Choose a D-element subset of {1,...,N} at random. Prove in a simple way that the maximum of the subset will have as its average value (N + 1)D / (D + 1). Joeldl (talk) 21:12, 23 December 2008 (UTC)[reply]

Okay, I think I've got it. Take a D-element subset T with maximum k. The average value of an element of a subset T of this kind, other than k itself, is the average of 1,...,k - 1, namely k / 2. So for a subset T with maximum k, the sum of all the elements of T will, on average, be (D - 1)k / 2 + k = (D + 1)k / 2. Thus, for an arbitrary random D-element subset T, the average sum of its elements will be (D + 1) / 2 times its average maximum. But the average sum of the elements is D times the average value of an element, which is (N + 1)/2. So the average maximum is D(N + 1) / 2 ÷ (D + 1) / 2 = (N + 1)D / (D + 1). This computes EN,D above and leads to a solution. Joeldl (talk) 21:44, 23 December 2008 (UTC)[reply]

Btw, the answer is D = sqrt(2(M+1)) - 1... —Preceding unsigned comment added by 65.92.236.87 (talk) 06:45, 25 December 2008 (UTC)[reply]

Not exactly. sqrt(2M + 2) - 1 isn't always an integer, so that can't be the answer. As mentioned above, D will be one of the two integers closest to sqrt(2M + 2) - 1 if this last number is < N (and it would take some extra work to find out which one it would be for a given M). Otherwise D = N. Joeldl (talk) 20:38, 25 December 2008 (UTC)[reply]

Socks in drawer problem

[edit]

I'm working through some probability problems and would appreciate help with this one: "There are 10 red socks and 20 blue socks in a drawer. If socks are pulled out at random, how many must be done for it to be more likely than not that all of the red ones have been chosen?" I reasoned that if n (>= 10) socks in all were to be chosen and 10 of them were to be red, then the remaining ones had to be blue which could be done in 20 C n-10 ways. The number of ways of choosing n socks from 30 is 30 C n, so the probability of picking all 10 red ones in n draws is p(n) = (20 C n-10)/(30 C n). Is this right so far?

Putting the expression another way, I got that p(n) = (20.19.18...)/(30.29.28...), with 30-n terms in numerator and denominator. Is this right? To get this to > 0.5 required n=29, as I calculated that p(28)=38/87 and p(29)=2/3. Is this right, too, and is there a better way of getting the required value of n than arithmetic evaluation?→86.132.165.135 (talk) 17:16, 21 December 2008 (UTC)[reply]

Sooner or later arithmetic evaluation would be necessary, but there is a slightly easier approach for this particular problem. Consider: what is the most number of socks that you can draw out of the drawer, so that there is more than a 1/2 chance of drawing only blue socks? Eric. 68.18.63.75 (talk) 18:33, 21 December 2008 (UTC)[reply]

Using the binomial coefficient notation: The probability to draw red socks out of socks in the sample is . So the probability to draw red socks out of socks in the sample is

Due to cancellation of factors it is easy to evaluate

,

Bo Jacoby (talk) 03:16, 22 December 2008 (UTC).[reply]

PS. The approximation makes it possible to solve analytically: This is perhaps "a better way of getting the required value of n than arithmetic evaluation". Bo Jacoby (talk) 10:59, 22 December 2008 (UTC).[reply]

Thanks for the replies - it appears that my analysis of the problem was OK. →86.160.104.208 (talk) 20:16, 23 December 2008 (UTC)

Surely, your result is correct, but somehow your analysis didn't quite convince you ! Note that the function p(n) is characterized by the following properties

  1. p(n) = 0 for n = 0,1,2,3,4,5,6,7,8,9 and p(30) = 1.
  2. p is a polynomial of degree 10.

The first property is shown without algebra while the second property is perhaps less evident. The solution to the 10th degree equation p(n) = 1/2 cannot be expressed in closed form, while the solution to (3/2)n−30 = 1/2 is elementary. Bo Jacoby (talk) 23:29, 23 December 2008 (UTC).[reply]

Elegant... as to the solution of p(n) = 1/2, or better of , I trust more the explicit arithmetic evaluation. As far as I understand the symbol here has only a qualitative meaning and does not tell us how close is n to the solution of the approximated equation. Making the computation rigorous would take more work than the arithmetic evaluation...--PMajer (talk) 14:43, 24 December 2008 (UTC)[reply]

Thanks for showing me the \scriptstyle feature! The problem is solved, and it seems pointless to keep beating a dead horse. However it may be nice to be able to find the solution to the equation . The equation of degree 10 in

can due to symmetry be reduced to an equation of degree 5 in ,

where . Note that

The derivation of the simplification is

Bo Jacoby (talk) 15:02, 25 December 2008 (UTC).[reply]

Nice... well, in my experience no dead horse is so dead that sooner or later he raises and give me back everything. So I will be thinking a little more to your equation p(x)=y, staying ready to run ;) --PMajer (talk) 21:33, 26 December 2008 (UTC)[reply]

I simplified (and corrected!) my simplification above a little. (The horse was not quite dead!) Note that if you can solve the degree 10 equation right away, then the simplification is not necessary, and if you cannot solve the degree 5 equation anyway, then the simplification is not sufficient. However, the precision of standard floating point computation may sometimes be sufficient for evaluating a degree 5 polynomial but not for evaluating a degree 10 polynomial. So simplification is good strategy. Bo Jacoby (talk) 08:58, 27 December 2008 (UTC).[reply]

Assuming that you want the solution expressed by formulas that can be evaluated by pre-computer tools such as pencil and slide rule. Then an approximation is called for. The degree 5 polynomial satisfy and . That means that approximately where is chosen between and , say . The solution to is giving the fine result . Bo Jacoby (talk) 14:25, 31 December 2008 (UTC).[reply]

Boubaker polynomials (3): Mr. Boubaker, please come and give your personal definition

[edit]

I'm not an expert in special functions and orthogonal polynomials, and I confess that I never heard about "Boubaker polynomials" before. However, I suspect that there is something to rectify in the article. It states that the are linear combinations of the Chebyshev polynomials; precisely, . If so, the recursive relation should be the same as the and , thus ; but it's reported as . The generating function also does not match: if the denominator is really then the stable linear recursive relation should be . Finally, an explicit formula is quoted, giving as linear combination of m-th powers of and ; in this case we would have . Discouraged, I made no further experiments... Well, I've just had a glance to the list of colors, there are so beautiful ones that I am tempted to revise the whole arcticle. But let us give an end to this Carnival... so, which one is the right formula? PMajer (talk) 23:06, 21 December 2008 (UTC)[reply]

You may want to ask User:Luoguozhang who appears to be largerly responsible for this fairly new article Nil Einne (talk) 18:26, 22 December 2008 (UTC)[reply]

You may also want to mention this at talk:Boubaker polynomials. Michael Hardy (talk) 23:42, 22 December 2008 (UTC)[reply]

Done. Personally, I think that definitions in mathematics non sint multiplicanda praeter necessitatem, but it is right that people be free to give names to any object if they wish.--PMajer (talk) 12:57, 23 December 2008 (UTC)[reply]