The mathematical trick that explains how to find a needle in a haystack


Finding a needle in a haystack is a metaphor for a task that is nigh impossible. But here at Scientific American, we wanted to know: Exactly how hard is it, really, to find a needle in a haystack?

The short answer is: very, very hard, says Jeffrey Rosenthal, a statistics professor at the University of Toronto. While published literature on the math of literally looking for needles in actual stacks of hay are thin on the ground, the principles of such a search lie in an area of math called probabilities.

“Probability theory as a field is the mathematical study of randomness and uncertainty, and that has everything from very mathematical theorems, and so on, to very applied things about the real world,” Rosenthal says.


On supporting science journalism

If you’re enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.


To apply those principles to the haystack challenge, the first step is to figure out the numbers behind the problem. Let’s assume the haystack is approximately three feet wide, three feet long and eight feet high, or about 125,000 cubic inches in size (for reference, the interior of a Honda Civic is around 171,000 cubic inches).

Like any problem, Rosenthal says, the best way to start is by breaking it down into smaller, manageable chunks—in this case, quite literally.

“I thought, ‘Maybe you take one cubic inch at a time,’ as a rough-eyed way to think about it,” he says. In other words, you would have 125,000 separate cubic inches, and you’d have to look through each one at a time.

Rosenthal estimates that you could look through one cubic inch per second. That works out to about 35 hours straight of looking through small clumps of hay for a needle. Fortunately, each individual clump has a one-in-125,000 chance of containing said needle. And who knows, you might find it in the very first clump. Or you could be sifting through tiny bundles of hay for almost a day and a half.

Given that most people need time to eat, sleep, and generally do other things than fiddle with dried pieces of grass, Rosenthal says, you could limit your search to eight hours.

“Eight out of that almost 35 hours works out to about a 23 percent” chance of finding the needle per day, he says.

You might be able to use another, more geometric approach in which you convert the three-dimensional stack of hay into a flat mat, but Rosenthal says that may present new challenges.

“The flatter you make it, the more easy it might be to find a needle within a little piece,” he says. “But also, it will be bigger and wider when you flatten it out.”

There is a way to cheat: needle-in-a-haystack-like problems have become an interesting challenge for machine-learning designers, whereby artificial intelligence models must be trained to detect the difference between a needle and its surroundings. But like most humans, the majority of these efforts use “find a needle in a haystack” as an analogy for another task rather than literally performing that search.

Rosenthal points out that while AI models have helped solve some of the most puzzling math problems of our time, they haven’t been used much for probabilities—yet.

“Maybe they won’t notice us for a little while,” he says, referring to his field. “But I’m sure it’s coming.”



Source link

3 Must See Scientology Documentaries and Where to Watch Them

Your Apple TV 4K has an expiration date

Leave a Reply

Your email address will not be published. Required fields are marked *