Nvidia (NVDA 0.25%) has returned 174% in 2024, and its market capitalization has increased from $1.2 trillion to $3.3 trillion. Meanwhile, the S&P 500 (^GSPC 0.16%) has returned 15% and its market capitalization has increased from $40 trillion to $46 trillion. Put differently, Nvidia is responsible for more than one-third of the gains in the S&P 500 this year.

As a result, the average S&P 500 stock trails the index by 10.7%, the worst underperformance since 1990, according to The Wall Street Journal. That means investors without exposure to Nvidia have found it exceptionally difficult to beat the market this year.

Investors can learn a few important lessons from the situation, and they can take steps to avoid a similar problem in the future. Read on to learn more.

Nvidia stock has gotten cheaper over the last five quarters

Some investors may have sold or avoided Nvidia due to concerns about valuation. Shares have surged 608% since the chipmaker reported financial results for Q4 of fiscal 2023 (ended January 29, 2023), and that much price appreciation compressed into such a short period usually means the price-to-earnings ratio has expanded. But that is not the case with Nvidia.

Nvidia's earnings per share increased 882% between Q4 of fiscal 2023 and Q1 of fiscal 2025 (ended April 30, 2024), outpacing the share price appreciation. As a result, Nvidia stock actually trades at a cheaper price-to-earnings multiple today than it did when the company reported financial results five quarters ago.

Additionally, while the current valuation of 79.3 times earnings looks expensive, valuation must be considered alongside growth. Wall Street expects Nvidia to grow earnings per share at 33% annually to $4.95 per diluted share by fiscal 2028 (ends January 30, 2028). If that number is divided into its current price-to-earnings multiple, the result is a PEG ratio of 2.4.

That is not necessarily cheap, per se, but it is cheaper than some mega-cap stocks. For instance, using the same methodology, Apple has a PEG ratio of 3.1 and Microsoft has a PEG ratio of 2.8.

The S&P 500 may be richly valued, but artificial intelligence has not created a stock market bubble

Another argument against Nvidia (and the broader stock market) is that artificial intelligence (AI) is overhyped, and that irrational euphoria surrounding the technology has created a stock market bubble. Some pessimists even compare the current market environment to the dot-com crash. But that comparison is inaccurate.

In January 2000, the five largest technology companies traded at an average valuation of 59 times forward earnings. Today, the five largest technology companies trade at an average valuation 37 times forward earnings. Additionally, the five largest technology companies today are expected to grow earnings 42% this year, while the five largest technology companies in 2000 were expected to grow earnings 30% in that year, according to JPMorgan Chase.

To be fair, the S&P 500 does trade at 21 times forward earnings, a premium to the five-year average of 19.2 times forward earnings, and enthusiasm about AI has undoubtedly played a role. But that does not mean AI is an overhyped technology destined to disappoint. It simply means the market is going through the normal phases of the Gartner Hype Cycle: Stocks first move too high, then move too low, before finally settling into a gradual upward slope.

The internet is an example of a technology that has been through the cycle. Naysayers labeled the internet a fad, and some experts expected it to fail. Economist Paul Krugman predicted it would have no more economic impact than the fax machine. Those opinions are laughable in hindsight. The digital economy accounted for 10% of U.S. GDP in 2022, or $2.6 trillion, and it was growing three times faster than the overall economy.

I believe AI will be much the same two decades from now. The naysayers will seem woefully out of touch in hindsight, and patient investors that bought good stocks (at reasonable prices) will have been well rewarded. That does not necessarily mean Nvidia is worth buying, but I think Morgan Stanley analysts have the right idea. "Bottom line, we think the backdrop warrants AI exposure even amid extreme enthusiasm -- and Nvidia remains the clearest way to get that exposure."

For context, Morgan Stanley has set Nvidia with a split-adjusted price target of $116 per share. The analysts have also outlined a bear-case target of $51 per share and a bull-case target of $136 per share.

How investors can avoid the Nvidia problem in the future

Investors that never owned (or sold out of) Nvidia prior to 2024 have had a difficult time beating the market. As mentioned, the average S&P 500 stock has underperformed the index by 10.7% year to date, the largest underperformance since 1990.

One way investors can avoid a similar problem in the future is by owning an S&P 500 index fund. That strategy will not help investors beat the market, but it will help them match its returns. Personally, I keep a relatively large portion of my portfolio in the Vanguard S&P 500 ETF, and I keep the remainder in individual stocks. In doing so, my portfolio will beat the market if my stocks outperform, but it won't lag the market too much if my stocks underperform.