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

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

November 7, 20263 min read Add Us On GoogleAdd SciAmThis is how hard it is to find a needle in a haystackWe asked a statistics expert how difficult it would be to find a needle in a haystack—the answer is: just as hard as you thinkGood luck. Jack Orion/ShutterstockNo Dumb Questions is a weekly feature in which Scientific American staff try to answer some of life’s greatest, weirdest and most enduring mysteries.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 journalismIf 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.”Subscribe to Support Independent JournalismGreat science journalism requires human expertise, time, effort and creativity. And it costs money. That’s why I and the journalists here at Scientific American hope you’ll join our community.When you subscribe, you are supporting staff and freelance journalists who are passionate about telling science stories that are true, important and compelling. Our editors and reporters are often experts in their fields, which means they understand the nuances of big discoveries and can untangle the breakthroughs from the hype. With a subscription, you are also supporting rigorous fact-checking to ensure the words we publish are precise and accurate. And you’re supporting original illustrations, graphics and photos that bring you closer to an advanced laboratory, an ice sheet in Antarctica or a space mission in orbit. You’re helping us craft other types of high-quality journalism as well: Our newsletters are carefully written, edited and curated by staffers you have or will come to know and love. Our Science Quickly podcast is based on original reporting, collaboration with editors and scientists and exacting production.Subscriptions keep this engine running so we can continue to deliver thoughtful, rigorous and independent science journalism to you. In an era of viral misinformation, this work is crucial. If you value what we do, I hope you’ll consider joining us as a subscriber

Original Source

Read the full article at Scientificamerican →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.