10 ms·
I was a mathematician, and now work in finance (systematic trading). I've found a reasonable negative filter is A jar has 1000 coins, of which 999 are fair a
by crntaylor 13y ago
I was a mathematician, and now work in finance (systematic trading). I've found a reasonable negative filter is
A jar has 1000 coins, of which 999 are fair and 1 is double
headed. Pick a coin at random, and toss it 10 times. Given
that you see 10 heads, what is the probability that the next
toss of that coin is also a head?
That tests their ability to turn a problem into mathematics, and some very basic conditional probability. Another common question (that I don't use myself) is to ask what happens to bond prices if interest rates go up.
- thearn4 13y agoThe Monty Hall problem (or a subtle variant) is also great one to watch people work through. It's a chance to see if people can thing about probability in a sort of asymptotic way. Basically (if they get stuck), ask them how they would choose if there were actually a 100 doors, but the same rules apply. Obviously, everyone switches. What about 99? 98? ... turns out, 3 doors is the smallest number where the strategy is optimal. But when the number is large, the answer is much more obvious.
- crntaylor 13y agoThe problem with asking Monty Hall in an interview is that ~75% of candidates already know the answer.
- QuantumGood 13y agoAssume they already know it, and ask them to explain it. A good explanation is almost as rare as understanding it. If they don't know it, then ask to solve. The early controversy with the Monty Hall problem was that explanations left loopholes, or weren't compelling enough, and even people who who should have known better didn't understand the solution clearly enough.
- Guvante 13y agoThere are tons of variations and few people know them. For instance ask "What if the showman didn't know which door the car was behind?" IIRC even if you exclude instances where the showman shows a car, it evens out the odds.
- baddox 13y agoAnd if they didn't, they would probably get it wrong even if they're experienced statisticians.
- ballard 13y agoYeah, because it's in every easy undergrad stats textbook. The problem with asking trick questions in an interview is that, although they may make the interviewer look smart, they are orthogonal to the ability to do the job. It's better to ask how to solve a current, pressing problem and see what questions the candidate asks. It's the questions that elucidate thinking style. Also, it's crowdsourcing and you can attribute or blame the candidate as the case maybe. The other part is getting along, so if an interview doesn't include something fun, it's all boring formality that doesn't allow anyone to get to know each other. Take them to a normal lunch if possible, because much more is learned by how people eat.
- k2enemy 13y agoThe Tuesday boy problem is a little less known: http://mikeschiraldi.blogspot.com/2011/11/tuesday-boy-problem-in-under-300-words.html http://mikeschiraldi.blogspot.com/2011/11/tuesday-boy-proble...
- StavrosK 13y agoI don't get it, even after the explanation. What's the mechanism that constrains those probabilities?
- baddox 13y agoYou should be able to convince yourself that the conclusion is correct by writing a quick script to run a simulation with a million or so iterations. Actually understanding the reasoning intuitively is more challenging, but I think the linked article has a good explanation (the part about how the manner in which we receive information is as important as the information itself): http://scienceblogs.com/evolutionblog/2011/11/08/the-tuesday-birthday-problem/ http://scienceblogs.com/evolutionblog/2011/11/08/the-tuesday...
- StavrosK 13y agoThat helps, thank you.
- Guvante 13y agoDepressing, just asked my coworkers this and can't convince them it isn't an independent event :(.
- deleted 13y ago[deleted]
- alok-g 13y agoOne issue I have with Monty Hall problem as an interview question is that the problem statement is too subtle, with several hidden assumptions. Interviewers often end up posing a different puzzle without realizing just by using a slightly different language to pose it.
- jbermudes 13y agoShould I parse it as tossing the same coin 10 times, or choosing from the jar 10 times?
- crntaylor 13y agoGood question, and one that sometimes comes up when I ask it in interviews. You are tossing the same coin 10 times.
- silentOpen 13y ago0.5005?
- joezydeco 13y agoThat's what I got. There's a .999 chance you have a fair coin and a .001 chance you have the rigged coin. (0.999 * 0.5) + (0.001 * 1) = 0.5005. Seems too simple, but a coin is a coin, right?
- 11001 13y agoAsk yourself a question: can you use the data (the 10 coin tosses) to update the probability of the current coin being two-headed?
- joezydeco 13y agoI wouldn't use the data. The coin hasn't changed since I picked it out of the jar. If I flip it 1, 10, or 10e100 times, the coin would still be the same coin. So figure the p(heads) for the coin and ignore the previous history. Overthinking it is why this makes a good FizzBuzz problem.
- dmurray 13y agoAn example that should show this approach is wrong: Suppose that the jar contains 500 double-head coins and 500 double-tail coins. You pull a coin from the jar, flip it 10 times, and get 10 heads. What is the probability it will come up heads next time?
- peteretep 13y agoMy wife and I have discussed this, and get a different answer to a few of the solutions we then googled for. I think it is as simple as: http://pastebin.com/gg5DTySG http://pastebin.com/gg5DTySG
- pakitan 13y agoI'm thinking this: http://pastebin.com/GW1hTXwD http://pastebin.com/GW1hTXwD Dying to know if I made it through the math FizzBuzz :)
- jules 13y agoThere is a mistake in the deduction in the second sentence. The chance that you picked the fair coin is approximately 49% not 1/1024.
- deleted 13y ago[deleted]
- amalag 13y agoThis is the simplest explanation, thank you.
- aeon10 13y agoDo you mind posting a simple walkthrough for the answer
- crntaylor 13y agoSure. The slick answer is The chance of picking the biased coin is 1/1000. The chance of seeing 10 heads from a fair coin is (1/2)^10 = 1/1024. These are nearly equal, so given that you've seen 10 heads, there is a 50/50 chance of having a biased coin. So the probability the next flip shows a head is P(H) = P(biased) * P(H|biased) + P(fair) * P(H|fair) = 0.75 The long answer - Yo want to figure out P(biased | 10H). Using Bayes rule this is P(biased | 10H) = P(10H | biased) * P(biased) / P(10H) = P(10H | biased) * P(biased) / (P(10H|biased) * P(biased) + P(10H|fair) * P(fair)) = 1 * (1/1000) / (1 * 1/1000 + 1/1024 * 999/1000) ~ 0.5 and you now compute the probability of the next toss being a head as above.
- joezydeco 13y agoIsn't the gotcha of this test the fact that the history of previous coin flips has no effect on the next flip, given a fair coin? The OP is only asking what the outcome of the NEXT flip is, not the probability of flipping 11 heads in a row. Or did I read this wrong?
- jules 13y agoYou didn't read it wrong, but you probably did fail the test ;-) There is no gotcha in the question, it's just a math problem that you either do or do not know how to solve. This isn't really about intelligence as much as it is about whether you have taken a course on probability. If you flipped 10 heads in a row the probability of the coin you have being the double heads coin increases dramatically, so you have to take that into account for the next flip. For intuitive understanding it often helps to go to extremes. Suppose you do 1 billion flips and all come up heads. What is the probability that the next flip comes up heads? Because we had 1 billion heads it is virtually certain that we are dealing with the double heads coin, so the probability that the next flip will come up heads is close to 1.
- deleted 13y ago[deleted]
- madcaptenor 13y agoThat's a nice filter. (Of course, I'm a former mathematician as well.) Here's how I think of it: - the prior odds that you picked the double-headed coin are 1/999. - after seeing ten heads, the posterior odds that you picked the double-headed coin are (2^10)/999 - let's approximate this as 1. (Bayes' theorem usually gets expressed in terms of probabilities, but it's so much simpler in terms of odds.) - so it's roughly equally likely that you have the double-headed coin or any non-double-headed coin; the probability of flipping an eleventh head is then approximate (1/2)(1) + (1/2)(1/2) = 3/4.
- 11001 13y ago0.7531 if you don't assume that 2^10 = 999
- gallamine 13y agoCan you elaborate on the posterior calculation of (2^10)/999?
- madcaptenor 13y agoSure. In terms of odds, Bayes' theorem says (posterior odds) = (prior odds) * (likelihood ratio) The prior odds are 1/999, so we need to show that the likelihood ratio is 2^10. The likelihood ratio is the probability of seeing 10 heads from a double-headed coin divided by the probability of seeing 10 heads from a fair coin, which is 1/((1/2)^10) or 2^10.
- orp 13y agoFor the interested, some links to Bayes' theorem: http://en.wikipedia.org/wiki/Bayes'_theorem http://en.wikipedia.org/wiki/Bayes'_theorem http://yudkowsky.net/rational/bayes http://yudkowsky.net/rational/bayes Useful if you want to know (or need a good way to explain) what a posterior probability is and how it's different from a prior probability
- phamilton 13y agoWhy is it 1/999? Shouldn't it be 1/1000 since there are 1000 total coins?
- thejteam 13y agoI've used a similar question, but with two coins. I think if I am ever in a position where I am hiring again, I may follow-up that question with this extension to 100 coins. What is the most common answer? Typically, I get either blank stares or a gut answer of just a little over 50%. I find that physics people are pretty good at solving the problem. I would also REALLY hope that somebody who is applying for a job in finance understands the bond prices and interest rates, but I suppose that does make it a good fizz buzz type question.
- crntaylor 13y ago> I would also REALLY hope that somebody who is applying for a job in finance understands the bond prices and interest rates. You'd be surprised at how many people can't answer instantly. Or how many people can't give a convincing description of what a share is, and what rights it gives you. These are all easy questions, which to my mind is the point. The fact that someone can answer them doesn't tell you much, but if someone can't answer them then you need to think very hard about whether to hire them.
- deleted 13y ago[deleted]
- madcaptenor 13y agoBut it's very likely that you picked a fair coin to start with, because most of the coins are fair. How do you compensate for that?
- linuxlizard 13y agomumble mumble bayes mumble mumble I'll show myself out.
- danbmil99 13y agorelated problem: a population has a 10% incidence of condition X. A test exists that is 90% accurate. 1) What is the expected percentage of positive test results? 2) if a person tests positive, what is the probability that they actually have the condition? 3) if a person tests negative, what is the probability that they are actually free of the condition?
- JoshuaDavid 13y agoBy "90% accurate", you mean "10% false positive rate and 10% false negative rate", correct?
- danbmil99 13y agocorrect, I should have made that explicit
- notahacker 13y agoThe bond prices question is a pretty bad filter, since it doesn't give the competent candidate much chance to express how they think, and a weak candidate has a good chance of guessing "they go down" and even a fair chance of blustering their way through followup questions/explanations. On the flip side, you could probably unintentionally trip up someone with a generally competent grasp of economics/stats but a lack of specific interest in bonds over terminology if your followup questions start asking them to distinguish between types of yield. Same with exchange rates (although I do remember back in school in a competitive presentation being complemented on my confident and plausible sounding explanation of the effect of an interest rate rise on exchange rates that also happened to be the reverse of the correct answer :-) )
- ACow_Adonis 13y agoThe funny thing is, I imagine I'd fail this, and a lot of other "interview" questions. (Not fizzbuzz incidentally :P) Why? Because my brain just doesn't seem to work in the way people expect "experts" brains to work in our world of tests/qualifications. Now for context, I don't consider my self some wishy washy "Oh I have a different KIND of intelligence" making-excuses dumb as nails nancy. I've worked several years now for my nation's statistics agency. I've written programs to calculate things professional statisticians couldn't (indeed that seems to be one of the reasons I get to keep my job :P) and just about every useless bloody stat there is, I've written my own probabilistic data linking software, finished in the top 10% of unrelated competitions on kaggle, and my formal qualifications are in economics. I don't think I'm the greatest thing ever, but if i might be so blunt, I feel I'm at the stage where I can confidently claim to have "proven my capabilities". But I haven't memorized Bayes theorem (or any other probability or math-formulas), despite having applied it about 100 gazillion times. And despite being an economist, I haven't memorized "the relationship between bond prices and interest rates". Now, I could try to reason these things out from scratch in front of you, but I imagine most people in our world would see that as a "weakness" or trying to hide the fact that I couldn't answer the question. With the probability one, I'd start going down the various interpretations of probability and whether your notion of probability is internally consistent/justified, etc etc etc. I doubt I could write the math on the white board of the top of my head in an interview (and i know several statisticians who couldn't also), but I could probably outperform most of the candidates who could in its application in the real world (speaking from experience), or be able to question whether there is a better tool for the job in the real world. With the bond one, I know there's an answer that you expect me to give from rote during my education. But i won't. I haven't memorized it (because from experience, memorising these types of things is bad form, conditions you into erroneous thinking when they eventually turn out not to be universally true, and is far worse than reasoning, questioning or thinking about problems). So i'll ask you to describe your idea of a bond to me. I'll ask you to describe your idea of interest rates. Why are the interest rates rising? Maybe then, depending on what answers YOU give, I'll say "well then obviously bond prices must move inversely to interest rate movements", but there's just as much chance i'll pick up on some mistake you've made and never reach that point. Now I'm not attacking you specifically. I don't know you, or what we think of each other, or how we'd interview each other. But from my experience, most people/recruiters/employers/interviewers would take my behaviour as a negative sign. A sign of "stalling" or "evading the question". Questioning, or reasoning, or skeptically interrogating things or mulling over questions for long periods of time, especially if they consider the answer "known", is a "bad sign". And the rote learner, who'd just happened to memorise a particular formula or spent most of their time in one particular context, or bought the book on interview questions for said industry will get a big fat tick. Moral of the story: Please don't use "interview questions" :P
- deleted 13y ago[deleted]
- akalin 13y agoGiven that this is hacker news, I'm surprised that no one bothered to write a simulation to sanity-check their answer. Here's a quick and dirty one: http://jsfiddle.net/qc9qk/2/ http://jsfiddle.net/qc9qk/2/ The mistake that most people seem to be making is using P(biased) and P(fair) instead of P(biased|10 heads) and P(fair|10 heads). Spoiler: The answer is ~0.75.
- danbmil99 13y agowith 1025 coins the numbers are nice: 1024/1025 * 1/1024 = 1/1025 (probability of unbiased coin, 10 heads) 1/1025 (probability of biased coin & 10 heads) relative probability = .5 the answer is then precisely 3/4