One thing investors look for when they buy a stock is whether the company in question has an effective economic moat. This refers to the ability of a company to maintain its competitive advantage, thereby protecting its profit and market share over the long term. A review of the top five companies by market cap reveals that there is a common thread that runs through them that may not be obvious at first glance.

On the surface, they all have very drastically different businesses -- a smartphone maker, a search engine, an operating system and software provider, a social network, and e-commerce site. So what do Apple (NASDAQ:AAPL), Alphabet (NASDAQ:GOOGL) (NASDAQ:GOOG), Microsoft (NASDAQ:MSFT), Facebook (NASDAQ:FB), and (NASDAQ:AMZN) all have in common?

Each uses artificial intelligence (AI) to turn enormous amounts of consumer data into a nearly insurmountable competitive advantage.

Silhouette of virtual human on retro skyscraper city with words Big Data.

Big data and artificial intelligence combine to create an incredible competitive advantage. Image source: Getty Images.

Knowledge is power

The sheer magnitude of data these companies possess is staggering. Google knows everything you search for, including all of the metrics and details supplied by your day-to-day usage of Android devices. Facebook knows what you share, what you like, and what you click in your news feed. Amazon knows what you buy, and in some cases, what you stream, listen to, or read. Microsoft can gather data from any device loaded with its operating systems or business productivity software, not to mention its Bing search offering. While Apple is something of an exception, having been vocal in its promises to protect user data, that doesn't prevent it from aggregating information from an estimated billion devices worldwide. 

The advent of voice-activated speakers like the Amazon Echo, Google Home, and Apple HomePod will only result in more data flowing to these companies, as they glean additional insight on their millions of users.

Deep learning is the key

AI plays a role in this process, thanks to deep learning, a sub-discipline of machine learning. Data scientists have succeeded in creating computer models -- inspired by the human brain -- that allow them to learn in much the same way humans do. These systems are fed massive amounts of data, and using a set of complex algorithms, they're able to recognize patterns and draw conclusions that might otherwise overwhelm and elude their human counterparts. The pattern recognition and insights gained then allow these companies to dominate their respective industries.

Consider just some of the ways AI helps to build moats for these companies. Together, Google and Facebook account for nearly all the recent growth in digital advertising. Not only do their platforms provide the greatest reach, but the edge gained by AI allows them to more effectively deploy those ads. Amazon's product recommendations are firmly rooted in AI, and it's estimated that the company accounted for 43% of all online sales in the U.S. 

The proof is in the pudding

If you don't think data provides the biggest edge in modern technology -- think again. Each of these companies has parlayed the combination of massive quantities of consumer data and AI into huge competitive advantages, which is borne out by their financial results. The five tech behemoths have collectively produced net income of over $25 billion in the second calendar quarter of 2017 alone. 

Beyond commercial applications, AI is also becoming a tool in cancer treatments, to provide cybersecurity, and even fight terrorism.

The hordes of data and AI technologies that draw from it create a virtuous cycle -- more data provides more insight, which captures more customers, who go on to provide even more data. Barring a change in the landscape, don't expect any of these companies to relinquish their supremacy any time soon.

Suzanne Frey, an executive at Alphabet, is a member of The Motley Fool's board of directors. Teresa Kersten is an employee of LinkedIn and is a member of The Motley Fool's board of directors. LinkedIn is owned by Microsoft. Danny Vena owns shares of Alphabet (A shares), Amazon, Apple, and Facebook and has the following options: long January 2018 $640 calls on Alphabet (C shares) and short January 2018 $650 calls on Alphabet (C shares). The Motley Fool owns shares of and recommends Alphabet (A shares), Alphabet (C shares), Amazon, Apple, and Facebook. The Motley Fool has a disclosure policy.