Drawing Blanks

Premature Optimization is a Prerequisite for Success

Archive for August 2010

On the “Son born on a Tuesday” probability puzzle

with 15 comments

If someone tells you “I have two children. One of them is a boy born on a Tuesday”, what is the probability that he has two sons?

The only thing we need in order to solve this problem is an interpretation. Here is the most natural one.

There is a crowd of people who have exactly 2 children. We pick one person at random and ask “do you have a son born on a Tuesday?”, and then ask “do you have 2 boys?”. If the answer to the 1st question is “yes”, what is the probability that the answer to the 2nd question is “yes”? (I omit the trivial assumptions about all outcomes being equally probable).

Once we have this interpretation, we can give this problem to any kid who knows how to multiply 14 by 14.

Here is a scan of the solution that my son (born on a Monday) came up with. Please pardon his chicken scratch:

 tue-boy

The filled squares are families that have a tuesday boy. The top left quadrant are boy-boy families. The answer is the ratio of the number of filled squares in that quadrant to the number of all filled squares. That is 13/27.

Yes, I explained to him about conditional probabilities and gave some examples, but only to show why such problems are so unintuitive.

"Tuesday son" is an anagram of “so unsteady” and “yes astound”.

I have to confess that the purpose of this post is to test the hypothesis that blog posts that talk about this problem attract a lot of traffic. So in case it turns out to be true: dear reader, you may also find the following topics interesting:

https://bbzippo.wordpress.com/2010/06/02/an-unfair-game/ – guessing hidden numbers using a random generator

https://bbzippo.wordpress.com/2010/05/19/optional-stopping/ – a theorem about timing the market

https://bbzippo.wordpress.com/2009/11/05/expected-number-of-coin-tosses/ – What is the average number of coin tosses needed to throw a head?

https://bbzippo.wordpress.com/2009/11/25/expected-number-of-tosses-general/ – What is the average number of coin tosses needed to throw n  heads in a row?

https://bbzippo.wordpress.com/2009/11/05/probability-of-bias/ – making a conclusion about the coin being biased based on a single throw.

And don’t forget to check out Xworder 🙂

Written by bbzippo

08/30/2010 at 12:10 am

Posted in math

HTML standards WTF

leave a comment »

<html>
<head>
    <title></title>
    <style type="text/css">
        .box
        {
            padding: 2px 2px 2px 2px;
            border: solid 1px #7aa0c0;
            margin: 2px 0x 6px 2px;
        }
    </style>
</head>
<body>
    <div class="box">Lorem</div>
    <div class="box">ipsum</div>
    <div class="box">dolor</div>
</body>
</html>

 

Try this html in IE – you’ll see the Expected Result. Try it in Firefox – no margins. “Don’t you know that FF collapses margins because the Standard allows to interpret itself in this way, and collapsing margins are in fact awesome?”. Blah-blah-blah! Of course I know that. But you should have read the code carefully – look, the boxes have borders. And padding too. And margins aren’t supposed to collapse if there are borders or padding. Your creative interpretation of Standards is not supposed to cross those borders!

So WTF is going on?

First of all, “web standard” is an anagram of "trend was bad"

Read the rest of this entry »

Written by bbzippo

08/12/2010 at 4:21 am

Posted in programming