Wikipedia:Reference desk/Archives/Mathematics/2014 November 22

= November 22 =

Barbie and birthday problem
I just read this paragraph from our article on Barbie:

"In July 1992, Mattel released Teen Talk Barbie, which spoke a number of phrases including 'Will we ever have enough clothes?', 'I love shopping!', and 'Wanna have a pizza party?' Each doll was programmed to say four out of 270 possible phrases, so that no two dolls were likely to be the same."

Is it really true that no two dolls were likely to be the same? It seems that there are 270 choose 4 = 216,546,345 combinations of phrases that each Barbie could say. According to this formula for the generalized birthday problem, if more than sqrt(2C*ln2)=17,327 dolls are issued where C=216,546,345, there would be more than 50% chance that two dolls say the same thing. Is this calculation correct? If so, it seems our article needs fixing (or Mattel made a mistake--but I assume they can calculate basic probabilities, whatever their other flaws). --Bowlhover (talk) 06:51, 22 November 2014 (UTC)


 * You're right if the four phrases for each doll is chosen randomly. However a manufacturer could choose them sequentially from the whole 216 million possibilities, thus making a same set coincidence 'almost impossible'. --CiaPan (talk) 09:51, 22 November 2014 (UTC)


 * I think Bowlhover's idea of most people's ability to calculate what he or she calls basic probabilities is exaggerated. There's a reason why the birthday problem is commonly called the "birthday paradox": most people don't have an intuition for it, and the same would apply with the dolls.  And I don't think Mattel would have called in a mathematician just to justify a claim like that.  Also, in any case, whoever wrote "no two dolls" might well really have intended it to mean no two dolls that, in practice, people would compare. --65.94.50.4 (talk) 10:08, 22 November 2014 (UTC)


 * Perhaps they used Apples pseudo-random algorithm (as for ipod shuffle etc) which guarantees no repeats until 216,546,345 dolls have been manufactured. As CiaPan mentions above, the Birthday paradox doesn't apply unless the choice algorithm was close to truly random.  D b f i r s   10:32, 22 November 2014 (UTC)


 * The source for the passage in our Barbie article states that "a computer chip... randomly selects four phrases for each doll" (4 from 269, after they removed the phrase "math class is tough" from the list of possible phrases after complaints) As to whether the 'chip' was a genuine random-number generator, rather than the more usual quasi-random hardware or software, it doesn't say - the latter could have gone into a loop quite soon, depending on the sophistication of the design, as true randomness isn't something you can program, or create with ordinary digital hardware. A genuine random-number generator would of course give the results that the birthday paradox predicts (assuming they filtered out the cases where the same phrase was picked for a given doll), but I'd be wary of assuming they used one. AndyTheGrump (talk) 10:40, 22 November 2014 (UTC)


 * Yes, that's just 213338251 different combinations of the 269 phrases. Didn't Steve Jobs say something like "iPods are now less random in order to seem random" when the Apple algorithm was changed to shuffle a playlist quite a few years ago?  As Andy says, we can't assume what type of algorithm Mattel used, so I've changed the article to read "no two given dolls were likely to be the same" in case they did use a cheap "random" chip.    D b f i r s   11:20, 22 November 2014 (UTC)


 * The 'chip' dates to 1992 or earlier too - which might have made it less sophisticated than Apple's current efforts. I'm fairly sure that the principles of good quasi-random number generator design had been figured out by then, but actually implementing them rather than something simpler and 'near enough' for Barbie might not have seemed worth the effort. AndyTheGrump (talk) 11:36, 22 November 2014 (UTC)


 * Actually, on checking, I think I may have got the terminology wrong here quasi-randomness appears to be something slightly different from pseudorandomness - though I'll leave it to the mathematicians here to explain the difference. AndyTheGrump (talk) 11:42, 22 November 2014 (UTC)


 * The birthday paradox applies when comparing a large set of Barbies all at once. If one brought 17K Barbies into a single room (the mind boggles), there is a good chance two of them have the same set of four phrases. But the article is talking about two Barbies at a time, as when two children bring their Barbies together for a play date. The chance that two Barbies brought together have the same set of phrases is small; using the rule of thumb in the birthday problem article, the probability that the pair has the same phrase set is $$ p \approx 2^2/(2*216,546,345) \approx 9.2\times 10^{-9}$$. --Mark viking (talk) 11:44, 22 November 2014 (UTC)


 * The "so that no two dolls were likely to be the same" phrase is not in the cited source, nor was it in earlier versions of the Wikipedia article which said, "so chances were good that no two dolls owned by a girl or her friends would be exactly the same". The change was made in good faith by  in  October 2006 edit, which was part of a string of edits they did tightening up the text.  A web search shows that our new, mathematically questionable phrasing now appears in many sources, such as William C. Harris's 2008 book, An Integrated Architecture for a Networked Robotics Laboratory Using an Asynchronous Distance Learning Network Tool. -- ToE 12:21, 22 November 2014 (UTC)
 * There can't be many people on Wikpedia who would turn up to respond to a query about an edit that they made in 2006. If I've caused confusion over the mathematics, I'm sorry, but don't take the blame for other people ripping off things that I have written on Wikipedia, which has happened before:). From this 1992 issue of Barbie dolls, the most famous controversy was that one of the phrases was "Math class is tough!" As for whether a birthday paradox was intended by Mattel, I'm not sure. My rewording was (I think) intended to imply that no two dolls bought off the shelf at random would say the same phrases, which is pretty much correct. The rewording in this edit makes it clearer.-- ♦Ian Ma c M♦  (talk to me) 15:47, 22 November 2014 (UTC)
 * Ianmacm, I hope you understood that I pinged you here because I thought you might find both the discussion of the mathematical implications of your 8 year old edit and the interesting places to which your work has diffused to be amusing. I certainly meant no blame.  It is seldom that I track down an ancient edit and find that editor to still be active.  Thank you for your years of editing Wikipedia, which I see date back all they way to 2005, well before I ever clicked the edit button.  Cheers! -- ToE 17:06, 22 November 2014 (UTC)
 * No offence taken, it's just interesting to learn that some writers use Wikipedia for their research and copy things out of it word for word, which I knew already. For the average reader, I think that the phrase "two dolls" would be taken as meaning "two children meeting who each have one of the dolls". If a person bought an enormous number of the dolls, eventually two of them would be likely to say the same phrases, assuming that everything is random.-- ♦Ian Ma c M♦  (talk to me) 17:21, 22 November 2014 (UTC)

Casino strategy
What are the chances that at a casino -$500 or 12 hours happens before +$50? With good strategy of course. What /is/ the best strategy? What game and bet sequence? Assuming you lost the first bet of this strategy, what strategy has the shortest odds of getting it back within 12 hours before minus $500? Is there a way to find this on your own for different ratios like 1:5, 1:2? 172.56.23.91 (talk) 19:31, 22 November 2014 (UTC)


 * I read somewhere that the best strategy for roulette (other than not betting at all of course) was to decide how much you intended to gamble during your entire lifetime, place the whole lot at once on red (or black), and never bet again. If this is correct, any strategy that takes 12 hours to carry out is worse... AndyTheGrump (talk) 19:52, 22 November 2014 (UTC)
 * I don't think this ("place the whole lot at once") is correct. Of course, the optimal strategy will depend on the utility function, and there are functions for which one big bet is optimal. But if we assume the standard logarithmic utility (or anything downward convex), with the added gratuitous requirement that you must bet X, the optimal solution is to bet it in many small increments. Your expectation is the same as with a big bet, but the variance is lower, which is good. -- Meni Rosenfeld (talk) 01:07, 23 November 2014 (UTC)
 * I said 12 hours because that's a small chance that the best strategy would take too long. Also the Banker bet in baccarat is 50.6% likely to win* (*slightly less than your stake) which is a smaller house edge than roulette so the "even money" bets of roulette can't be the best strategy. Also your strategy assumes you can afford to lose all the money you'd ever bet till death right now and would rather take a over 50% chance of losing a ton, never winning anything in your life and not being able to lose less than the whole lot. I'd think it's extremely unlikely that you'd lose every bet you ever bet in your life.
 * Best casino strategy: don't visit them. A large number of betting systems, most famously the Martingale, are based on the idea that strategies will work at a casino and recoup losses within a given period of time. Assuming that a game is random, this is never true. Also, the house has an edge which will wear down the player's original stake over a long period of time. Nobody would apply for a casino licence without this permanent built-in advantage. The only way to win at a casino is to quit while you are ahead. Old advice, but still true.-- ♦Ian Ma c M♦  (talk to me) 19:55, 22 November 2014 (UTC)


 * The question doesn't specify what game the bettor is playing, and therefore what the house edge is, or how long a single round takes (one minute? three minutes?), or what the standard wager is. The OP says "with good strategy, of course".  What is good strategy depends on what game is being played.  There is no concept of good and bad strategy in roulette, because the edge is the same for all bets; the wheel is either an American wheel (approximately 6%) or a European wheel (either approximately 3%, or approximately 1.5%, depending how the zero is handled).  Good strategy at craps is to bet with the shooter (approximately 0.4%, and the house makes money because of the bad side bets).  Perfect strategy at blackjack depends on correctly memorizing the rules of basic strategy (which by most calculations is very close to dead-even, so that the house only makes money because most bettors do not memorize basic strategy).  What is the house edge, what is the standard wager, and how often are there rounds of betting?  Robert McClenon (talk) 20:04, 22 November 2014 (UTC)
 * Casinos would rather a person bet $10 a hundred times than bet $1000 once. This allows more opportunities for the house edge to come into play, buy more drinks at the bar etc. The limits at a table are designed to discourage betting large amounts on a single outcome. This means that strategies are a poor idea at any casino game where the house has the edge.-- ♦Ian Ma c M♦  (talk to me) 20:21, 22 November 2014 (UTC)


 * Surely the drinks are free? Anyway, the best strategy is to own the casino. DuncanHill (talk) 22:00, 22 November 2014 (UTC)
 * I'm not an expert on casino free drinks policies, so this USA Today article is useful. Apparently many US states do not allow free drinks, and they are becoming less commonplace. Casinos have always encouraged drinking while gambling, as it can make gamblers feel better and lose track of how much they are betting.-- ♦Ian Ma c M♦  (talk to me) 22:25, 22 November 2014 (UTC)
 * A few, at least, outside of the US did as of a year ago, mainly smaller ones on various tropical islands - the nice part about that was they would give you free appetizers too, on occasion, as long as you were playing. They didn't really check to see how much you were actually gambling, so you could have come out ahead if you played slow; but, honestly, slow gambling to get free drinks and some nachos isn't my idea, or most peoples, idea of a free evening, so you aren't really winning.Phoenixia1177 (talk) 05:44, 23 November 2014 (UTC)
 * To return to the question posed by 172.56.23.91, betting systems are junk and always have been. No finite number of bets guarantees that the player will come out ahead. The more you bet, the more you can lose. The problem is made worse by some games such as American roulette and craps field bets giving the house an excessive edge. The real risk is that gambling to recoup losses will lead to even further losses. This is the classic road to problem gambling.-- ♦Ian Ma c M♦  (talk to me) 11:08, 23 November 2014 (UTC)
 * Trying to answer the original question I would think the martingale already mentioned is the approach most likely to win back your $50. So first bet place $50 on black (say). If that loses place $100. If that loses place $200. If that loses place $400. You are then at your limit and have to stop.
 * The odds are simple to calculate. You've four chances so a 15/16 chance of winning one of these bets and regaining your $50. The problem is you've 1/16 chance of losing all four and being out a further $750. In gambling terms that's odds of 15:1 on, a fair bet but not very attractive odds if you can't afford to lose your stake. And that ignores any edge the house has. The edge changes the probability of each bet, making the chance of losing higher than 1/16 and so making the bet worse than fair.
 * This is intuitively an optimal strategy as smaller bets are worse. With small enough bets it's almost certain you'll hit $500 before $50; the reasoning is similar to the biased coin flipping example of gambler's ruin, except with red and black bets (say) instead of a biased coin.-- JohnBlackburne wordsdeeds 17:42, 23 November 2014 (UTC)
 * Your first strategy is the real reason casinos have betting limits. Otherwise, a bet-doubling strategy would always be able to stop at a profit (provided sufficient funds to continue playing). It is still a pretty good strategy, as if you start low enough your ability to stop while ahead is pretty high. However, most people don't do this because it can take a long time and you only win $$2^{n+1} -\sum_{k=1}^{n} 2^k.$$ Also in real life you'd have to switch games/tables a few times, because even if the betting range accepted at a casino is fairly high, the range on one table is much lower. Another relevant article is Gambler's ruin.  SemanticMantis (talk) 17:35, 24 November 2014 (UTC)
 * No, martingale is not the reason for betting limits. The right link is Table limit. See the last paragraph. PrimeHunter (talk) 22:41, 24 November 2014 (UTC)
 * Thanks for the link correction. I read the last paragraph, and it says in part " In reality casinos are not at risk from Martingale players." -- -- does not a bet doubling strategy at near-even odds let a player with with no limits stop at a profit? Perhaps the casinos think that it is not a big risk due to lack of people attempting the strategy, but as I understand it is a real an present mathematical risk. The real reasons are only known to casino owners, but WP is not an WP:RS, and I think the sentence I quoted is just wrong. SemanticMantis (talk) 23:45, 24 November 2014 (UTC)
 * Casinos are not stupid. They don't let people bet a million times their fortune. No limit means you can bet whatever you are able to put on the table (an honest casino might stop you when it exceeds what the casino can pay out). If you could continue to bet meaningless amounts like $21000000000 then sure, you couldn't walk away with a loss because you would either win at some time or die while still betting. But that would be the case for any strategy which involves betting until you are ahead or die. If there was no limit (meaning you can bet whatever you own) then I don't imagine billionaires would be dumb enough to play martingale with a modest start bet they can afford to double a lot of times before losing their fortune. The casino can only lose the start bet in martingale. The realistic risk for the casino would be very rich players making large individual bets and not playing a martingale strategy. PrimeHunter (talk) 01:49, 25 November 2014 (UTC)
 * "a player with with no limits" – there is no such thing. There are always limits, if only those imposed by the money supply of that currency. Suppose your minimum bet is $1 and your limit is $1bn. With the bet doubling strategy (betting on black to win) and fair odds you can win back your $1 almost every time. Red would have to come up 30 times for you to lose, but it will do that every 230 bets. Tour stake rises to 230 dollars and hits your limit. And the one time that happens you lose all the  230 − 1 dollars you've won in your remaining bets, so breaking even. Of course that's with fair odds; the odds are a less than fair at a casino so rather than being expected to break even you're expected to make a loss. Casinos lose no sleep over losing strategies like this.-- JohnBlackburne wordsdeeds 03:30, 25 November 2014 (UTC)
 * Yes well we are on the math desk here, and I don't think money supply is really relevant to the math. I only wanted to point out that the martingale strategy is viable from a pure math perspective. I don't think casino policies are dumb, but the elaboration here has helped me to understand that the sentence I quoted above is indeed incorrect from a theoretical perspective: casinos are at risk from martingale players in theory. In practice, casinos may believe the risks are minimal, but that is a question of sociology/psychology, not math. SemanticMantis (talk) 15:22, 25 November 2014 (UTC)
 * In what sense is the Martingale strategy viable?
 * In the same conditions that this strategy works, every other strategy works, too. For example, if the player bets $1 every time (and has unlimited reserves and there is no house edge), he has a probability of 1 to eventually turn a profit. This is a result of the nature of random walks. The martingale strategy doesn't magically endow the player with assurance of winning. -- Meni Rosenfeld (talk) 20:00, 26 November 2014 (UTC)


 * The story of William Lee Bergstrom is relevant here. Nowadays most casinos are run by accountants who would say no if a customer turned up out of the blue and offered to place a huge amount of money on a single bet. Benny Binion was one of the old timers who was prepared to allow this type of bet. Modern casino table limits make any type of betting system impractical.-- ♦Ian Ma c M♦  (talk to me) 11:17, 25 November 2014 (UTC)