As with E=mc² and the universe, everything that you need to know about Google—how it works, why it works, where it comes from, and where it’s likely going—can be summarized in one line. It’s the basic equation that underlies Google’s search engine:

Don’t worry if you don’t understand it just yet. What you likely do understand is that Google is currently in a heap of legal trouble— because of YouTube, its newest acquisition. Three weeks ago, Viacom filed a $1 billion lawsuit claiming that Google has turned a blind eye to teenagers’ illicitly uploading clips from Viacom properties, such as The Daily Show and MTV videos, onto YouTube. There’s a strong whiff of Napster in the air, so Googlewatchers are now consumed by an eye-glazing debate over the finer points of modern copyright law, the stake that Big Media hammered so decisively into Napster’s heart a few years ago. Is Google protected by the “safe harbor” provisions of the Digital Millennium Copyright Act? Or is YouTube illegally hosting, with prior knowledge, copyrighted video, rendering it as ultra-suable as Napster? Why in God’s name did Google buy YouTube anyway, since this lawsuit was probably inevitable?

Pundits have posited several possible reasons why Google wound up in this fight. Maybe it was pure greed: Viacom had spent months trying to work out a deal to legally distribute its TV shows on YouTube, but Google wouldn’t give it a big-enough slice of online ad revenue. Or maybe Google was just cocky, confident that copyright law would shield it no matter how much piracy gleefully went down on YouTube. Or maybe it was Machiavellian: Blogger Michi Kono argued that Google’s executives bought YouTube precisely because they knew YouTube was bound to get sued—and they wanted their smarty-pants lawyers heading up the legal defense of online video sharing.

All those reasons are probably partly true. But the real reason Google has wound up facing the biggest copyright lawsuit in history is considerably stranger. It’s a question of corporate culture: Google is a nerd company, following nerd logic. It’s the equation, as it were, that got them in trouble.

Nerd logic holds that smart ideas deserve to trump dumb ones. Indeed, nerds are fierce believers in meritocracy. This is somewhat self-serving, of course: Nerds love the idea of intellectual Darwinism because they think they’re smarter than everyone around them, thus fated to win every contest. But at Google, nerd logic is a particularly potent force because the technology that made its executives rich—the very equation reproduced above—is a living embodiment of that culture.

Consider for a second how the formula, and thus Google’s search engine, works. If you type in “fly-fishing Massachusetts,” Google will find the 937,000 pages containing those words. Then, crucially, the algorithm ranks each page to see how many “inbound links” it has—how many other Websites point toward it. The one with the most links wins the No. 1 spot on a Google search, just like the person with the most votes wins an election.

This is also why it’s so good. Google’s search engine is mostly impervious to PR bunk, political spin, and big-bucks marketing. You can trust Google’s search results because they’re pure: driven by the crystalline logic of a superb mathematical algorithm. And so we have a world in which the majority of Web searchers use Google, endowing the company with a ridiculously high stock price and ridiculously wealthy employees. At Google, right makes might.

But Google’s pursuit of meritocratic results has a side effect: It has given the company a sort of corporate version of Asperger’s syndrome. It’s like the kid who doesn’t play well with others because he’s too busy realphabetizing his stamp collection. Or for that matter, breaking into your house and reorganizing your stamp collection. Google’s battle with Viacom over YouTube’s modus operandi isn’t really new: Google’s M.O. has always been to hoover up other people’s content without asking permission. When Google first started organizing the Web, it realized that it needed to “crawl” the Internet every day, making a copy of every Web page it could find, so it could know what’s out there. At first, Website owners howled: Wasn’t this a massive form of copyright violation? Sure, except that upon reflection, Website owners realized it was far more important to play ball with Google because Google brought so much traffic to their sites.

But then two years ago Google went one step further—and decided to start organizing old media: things like books and TV shows. It started Google Book Search, a project whose first step was to scan 8 million books in order to make them subject to its search algorithm. It also set up Google Video and announced that it was uploading TV shows to make them searchable, too. For info-hounds like me, this stuff was deliriously cool: The idea of having all human knowledge at my fingertips made me giddy.

Except, of course, Google was now horning in on a very different culture. The culture of the nerds slammed headfirst into the culture of New York’s Big Media—which is radically different from, even diametrically opposed to, Google’s.

TV executives are creatures of PR, spin, synergy, and backroom deals. They’re really good at making money—TV advertising is a $70 billion business—but you wouldn’t exactly call it meritocratic. Sumner Redstone, after all, originally acquired Viacom in a hostile takeover. Over the next two decades, he built his business by buying up media companies such as Paramount and CBS, tossing their content into his increasingly huge vault, then spinning them off again. The path to riches in media, as Redstone has adroitly observed, is in owning a boatload of TV shows and movies and syndicating them endlessly. And for guys like Redstone, this requires a take-no-prisoners approach to the enforcement of copyright in the courts, and endless lobbying in D.C. to extend the rights of intellectual-property owners. It is the total inversion of nerd logic: For Big Media, might makes right.

So when Redstone realized that YouTube’s hottest clips tended to be from The Daily Show, The Colbert Report, and South Park, he freaked, demanding that Google pull 100,000 clips from YouTube. “If you want to use us,” Redstone thundered to the press, “pay us.” Then he defected to Joost, the copyright-friendly YouTube clone. A month later, Viacom arch-rival News Corp. pulled a similar move: It announced that it was teaming with NBC Universal and posting all their content on their own as-yet-unnamed “NewTube.”

I happened to be in Google’s New York office the very day that Redstone demanded that the clips be yanked. The rank and file were unperturbed. As always, programmers cruised serenely to and fro on their Xootr scooters. The view from the Googleplex is that Redstone shouldn’t have been mad at Google. He should have been grateful. After all, Google was just doing what it had always done: making stuff easier to find, organizing the world. Why wouldn’t Viacom want its shows to be more easily found? If everything is promiscuously available digitally, and easily findable, this will be a cosmic win-win for everyone. We consumers will find more and better stuff to read and listen to and watch—and that will bring more business for media giants. Lovely!

The only person who I found really sweating it was David Eun, Google’s vice-president in charge of “content partnerships”—essentially, the guy whose job it is to persuade Redstone to play nice with Google. But as a former TV exec himself, Eun knows that the broadcast industry fundamentally does not believe that a win-win is possible. Hell, the entire industry is based on win-lose propositions—stealing audience from one another. From the perspective of TV execs, the online world is pretty much a big hassle: Piracy is sapping their ability to charge for their goods, and Google’s suspiciously central role in the online ecosphere allows it to hog the ad money. Their business model is crumbling, and someone’s gotta figure out how to pay for all the cool TV, movies, and books we enjoy. A zillion teenagers downloading a ripped, ad-free copy of Lost ain’t gonna keep the lights on at the studio, right? Nestled in one of the poufy, Seussian blue couches that dot his office, a suit in a geek’s world, Eun parses his words with surgical precision.

“We had a very interesting and healthy relationship with Viacom. We want to continue to explore ways that we can work together with them,” he says slowly. “Frankly,” he adds, “I think companies are still trying to figure out what’s the right business arrangement.” To say the least.

Yet despite the culture clash, the odds are strong that Viacom’s case will never get to court. It is more likely a tactic designed merely to drive Google to abandon its high-minded talk about a win-win future and cough up real money for rights. This will probably work, because neither wants to risk a legal precedent that screws its business. Both Google and Viacom might actually benefit from keeping the legality of YouTube fuzzy and letting their negotiators hammer out a truce. They’ll learn to live together. But they’ll never understand each other.