One of the big secular trends of the past year has been artificial intelligence (AI). The market for AI is forecast to hit $305.9 billion in 2024, and expected to grow to $738.8 billion by 2030.

This market expansion serves as a multiyear tailwind for companies developing AI technology. That includes tech veterans International Business Machines (IBM -1.05%) and Microsoft (MSFT 1.82%). The demand for each company's AI offerings helped propel both companies' stocks higher over the past year.

IBM shares were at a 52-week low of $120.55 last May before reaching a high of $196.90 this year. Meanwhile, Microsoft shares went from a 52-week low of $245.61 last March to a high of $420.82 on Feb. 9.

But if you had to choose just one to invest in, which would it be?

Reasons to invest in IBM

IBM has worked on AI since the 1950s, long before Bill Gates and Paul Allen founded Microsoft in 1975. IBM's latest AI platform, watsonx, debuted in the beginning of the third quarter last year. Adoption quickly ramped up.

Big Blue's watsonx book of business in the fourth quarter was about double that in the third quarter. The company's AI success helped to propel Q4 revenue to 4% year-over-year growth, reaching $17.4 billion.

Thanks to watsonx's rapid adoption, Big Blue's data and AI division saw 5% year-over-year revenue growth in 2023. An example of IBM's AI tech in action is the Sevilla Fútbol Club's use of watsonx to analyze soccer players across thousands of scouting reports to determine who to sign.

Along with this compelling technology, another strength in IBM's AI arsenal is its army of over 20,000 consultants dedicated to artificial intelligence. They help Big Blue's clients develop and implement an AI strategy.

CEO Arvind Krishna noted on the Q4 earnings call, "We are the only provider today that offers both a technology stack ... and consulting services for deploying and managing generative AI." IBM's consulting division saw Q4 revenue jump 6% year over year to $5 billion.

The case for Microsoft

Microsoft CEO Satya Nadella sees AI as "the next major wave of computing." So the company is pushing hard to be a leader in the AI race.

As a result, Microsoft became a multibillion-dollar investor in ChatGPT creator OpenAI, and has incorporated AI technology across a wide spectrum of products. As Nadella explained on a recent earnings call, "By infusing AI across every layer of our tech stack, we're winning new customers and helping drive new benefits and productivity gains."

For example, in its fiscal second quarter ended Dec. 31, Microsoft had over 1 million subscribers to its AI software development tool, GitHub Copilot, a 30% quarter-over-quarter increase from the first quarter.

And Microsoft's AI approach has led to revenue growth. The company's Q2 revenue was up 18% over the prior year to $62 billion.

Thanks to AI, Microsoft looks to be undergoing a new wave of success. This AI boon follows years of rising revenue from the company's shift toward cloud computing, when Nadella became CEO a decade ago.

MSFT Revenue (TTM) Chart

Data by YCharts.

Microsoft's Azure platform enabled this cloud computing shift, and Azure continues to experience growth now that AI has been added to it. The platform saw a 30% year-over-year increase in fiscal Q2 sales.

Deciding between Microsoft and IBM

With Microsoft and IBM providing strong AI offerings, it's ideal to invest in both companies. But before choosing just one of these tech stalwarts, there are a few other factors to consider.

IBM boasts a more attractive dividend, currently yielding over 3% compared to Microsoft's less than 1% yield. Moreover, IBM's Q4 free cash flow (FCF) of $6.1 billion was an improvement over the prior year's $5.2 billion. This solidifies the company's ability to fund its dividend payments, which it has increased for 28 consecutive years.

However, Microsoft possesses varied businesses, such as digital advertising and its ubiquitous Windows operating system. This provides the company with income diversification. For example, its video games division saw a 61% year-over-year revenue jump in Q2 thanks to its acquisition of Activision Blizzard.

Putting these factors together along with its AI successes, Microsoft edges out IBM as the better investment. Microsoft stock retreated from its 52-week high recently, so now is a good time to take advantage of the price dip and buy shares.