The benchmark S&P 500 index plunged into a bear market in 2022 when it fell more than 20% from its all-time high. But following a strong 2023, it recovered nearly all of that lost ground.

The index is on the cusp of setting a new record high, which would mark the official beginning of a new bull market. It only needs a gain of 0.5% to get there.

A chart of the S&P 500. it's about to reach a new all-time high.

Data source: YCharts.

History suggests 2024 will likely be another positive year for the stock market, which would practically guarantee the S&P 500 enters bull territory. With that in mind, here's why investors might want to begin the year with shares of the world's two largest companies: Microsoft (MSFT 0.12%) and Apple (AAPL 0.16%).

1. Microsoft

Microsoft was founded in 1975 as a software company, and it went public in 1986 valued at $777 million. After expanding into hardware, gaming, cloud computing, and artificial intelligence (AI) over the last 48 years, Microsoft amassed a valuation of $2.8 trillion. It trails only Apple for the title of world's largest company.

That significant value creation prompted Microsoft to execute nine stock splits since 1987 to ensure its shares remained accessible to small investors -- who might be grateful right now, considering it soared 57% in 2023, doubling the return of the S&P 500. And 2024 could be another strong year as the company ramps up efforts to monetize its growing portfolio of AI products.

Management started 2023 with a bang when it agreed to invest $10 billion in top generative AI start-up OpenAI, which is responsible for the ChatGPT chatbot. Microsoft has since embedded that technology into its Windows operating system, Edge internet browser, Bing search engine, Microsoft 365 document suite, and Azure cloud computing platform.

Azure OpenAI Service allows businesses to access OpenAI's latest GPT-4 models to help them build their own AI applications. The service started calendar year 2023 with just 200 customers, but within nine months, over 18,000 organizations had signed up. I anticipate that number will grow significantly this year as businesses race to embed AI into their operations to boost efficiency.

Microsoft is also running an early-access program for its ChatGPT-powered Copilot technology in Microsoft 365 applications. Now, businesses can harness the power of AI in Word, Excel, PowerPoint, Outlook, and Teams for $30 per employee, per month. The company says 40% of the Fortune 500 companies are participating in the early-access program, including giants like Visa and KPMG.

According to Statista, over 1.3 million companies use Microsoft 365, so the ability to charge them more for AI-enabled versions could be a seismic financial opportunity.

Microsoft's fiscal 2024 will end on June 30 this year. Wall Street analysts estimate the company will deliver $243 billion in revenue, an increase of 14.8% year over year. Its earnings per share are expected to jump 14.5% to $11.24.

It places the stock at a forward price-to-earnings (P/E) ratio of 33.5, which is a slight premium to the Nasdaq-100 technology index. However, the company's presence in AI might still warrant further gains. Leading Wall Street technology analyst Dan Ives at Wedbush recently named Microsoft as his top pick, and he thinks the stock could hit $450 in 2024 thanks to AI. That implies an upside of almost 20%.

A photo of the Apple logo inside an Apple store.

Image source: Getty Images.

2. Apple

Apple was founded in 1976, and it went public in 1980 valued at $1.8 billion. It now generates that much in revenue every 40 hours, and it became the first company in history to amass a $3 trillion valuation.

Like Microsoft, it has created so much value that its management executed five stock splits since 1987 to keep its shares accessible to small investors.

The catalyst behind the bulk of Apple's market value is the iPhone, which was introduced in 2007. It has taken consumers on a journey packed with innovation, like the smartphone's high-resolution displays, its camera technology, and its app ecosystem. But the latest iPhone 15 lineup sets the stage for what could be the next big value creator: on-device artificial intelligence.

The iPhone 15 is fitted with the Apple-designed A17 Pro processor, which is the smartphone industry's first 3-nanometer chip. Simply put, the brain of the iPhone is now smaller, faster, and more efficient than ever.

Its neural engine, which processes AI and machine-learning workloads, delivers a twofold performance boost over its predecessor, the A16 Bionic. That allows the iPhone to manage AI workloads independently of the cloud or third-party computing services, which many AI applications currently rely upon.

It will open the door to powerful advancements in features like the Siri voice assistant, predictive text, and Visual Lookup -- a camera tool capable of identifying faces, plants, and even famous landmarks.

However, Apple is rumored to be working on its own large language models and even a generative AI application called Apple GPT. Details remain scarce, but imagine having a ChatGPT-style tool woven throughout every aspect of your iPhone, processed using the device's own chip hardware. The possibilities will be endless; it could craft your messages and emails, or even create image and video content for you.

AI isn't the only area in which Apple is innovating. It's gearing up to launch its new virtual reality headset, the Vision Pro, in the early part of this year. It's priced at $3,499, so it probably won't sell in high volumes initially, but it's Apple's first new product category since it launched its watch in 2015. It gives developers an opportunity to build new gaming and entertainment experiences, which could attract consumers to this new platform.

Wall Street estimates Apple will generate $396 billion in revenue in fiscal 2024 (ending Sept. 30, 2024), which would mark a gain of just 3.5% year over year. While it sounds sluggish, there's an even bigger force likely to keep Apple stock afloat: The company continues to return truckloads of money to shareholders. It bought back $77.5 billion worth of its own stock in fiscal 2023, and paid out $15 billion in dividends. That's music to the ears of its largest investors, which include Warren Buffett.

Apple has always been a long-term story. It isn't very agile given its enormous size; it's more like an aircraft carrier that takes time to maneuver. But 2024 will likely be one of the company's most exciting years as it lays more groundwork for its AI initiatives, and consumers interact with the Vision Pro platform at scale for the first time.