Weirdly: adv. In a strikingly odd or unusual manner
< Older Blog - The Latest - Pick One - Show All - Newer Blog >

28-04-2007 Math puzzle solved

I'm happy to say that my answer to the puzzle about the falling stick is correct, and I was able to demonstrate it with a quick little C program that actually performs the act of dropping the stick on the plane a few million times, counting how many times it crosses a line. The outline of how it works goes like this:

Anyone not familiar with some trigonometry details may question the logic of that, so I'll break it down a litte further now.

The program works by picking a random location for one end of the stick, selecting a random angle that the stick falls at. Given those two pieces of information, it then calculates where the other end of the stick falls.

Because our stick has a length of 1, the location of the second end of our stick will be the location of the first one, with the cosine of our random angle added to the x-coordinate and the sine added to our y-coordinate. I was going to write a big explanation of why this is true, but that would take too long and I assume anyone who's actually interested either understands already or can go pick up a good geometry textbook.

We're not concerned about the x-coordinate though, only the y-coordinate. We want to see if the second y co-ordinate falls betwen the same two lines as the first one. If it does, then the stick does not cross a line.

With that in mind then, we know that our random point is between 0 and 1, so if we add the Δy of our stick (which, remember, is equal to the sine of the angle) to our point, then we'll know that the stick crosses a line if that new point is not between 0 and 1.

And that's how it breaks down logically. I'm quite pleased to say that it does indeed give exactly the numbers I expected, and the answer to the puzzle is indeed 2/π, or aproximately 63.66%.

If anyone is at all interested, here is the very short and simple C program I whipped together to demonstrate this:

< Older Blog - The Latest - Pick One - Show All - Newer Blog >