In 2013, Apple (AAPL -0.35%) stock went on a volatile roller-coaster ride, falling about 26% and then gaining more than 40%. What happened? Did the outlook for Apple stock really change so dramatically in such a short period of time? Or is Mr. Market still just as erratically emotional and irrational as he was when Benjamin Graham first exposed him?

AAPL Chart

AAPL data by YCharts

When price and value diverge
Thanks to a shortsighted market, price movements aren't always a direct reflection of changes in fair value. I say "thanks" because it's this fact that makes it possible for individual investors to outperform the market. And Apple's volatility during 2013 is a perfect example of how prices can become irrational, providing investors excellent buying opportunities.

If you're looking for proof that stock prices are not always priced efficiently, look no further. Beginning the year with a market capitalization of approximately $475 billion at about $530 per share, shares fell to about $390 by April, wiping about $125 billion off of Apple's valuation. By the end of the year, Apple stock recovered all of its losses (plus some), adding back $150 billion to Apple's market capitalization.

Did the outlook for Apple stock really change so dramatically during this time to merit such an enormous fluctuation in the stock's fair value? Not at all. So what did change? What did cause such an enormous fluctuation? The market's wavering consensus opinion.

The cause?
I'd love to point a finger at exactly what caused investors to irrationally sell Apple off to such extraordinary lows, but I've never been talented at guessing why the market does what it does in the short term. In fact, I don't really care why the consensus opinion for Apple stock changed during 2013. Why? If investors get too caught up in what everyone else is thinking, they wouldn't be able to have an opinion that is contrary to the consensus.

But if I had to guess the reason for the market's irrational sell-off, the culprit is likely a combination of narrowing gross profit margins and soaring Android market share. In Apple's fiscal Q4, the company reported gross profit margins of 40%. This was the last quarter Apple posted margins in excess of 40%. In the company's first-quarter results, Apple's gross profit comparisons were gruesome: 38.6% compared to 44.7% in the year-ago quarter.

Meanwhile, Google's Android market share in both tablets and smartphones continued to gain on iOS. Making matters worse, Samsung continued to gain share among manufacturers, eating away at Apple's dominance.

Sure, these developments may have dampened the outlook for Apple's stock, but at $530 (the approximate price at the beginning of the year) Apple was already trading conservatively. It was trading at about 12 times earnings at the time. And despite gross profit and market share challenges, the consensus analyst estimate for annualized EPS growth over the next five years remained in the double digits. When Apple shares fell to levels around $400, Apple stock traded below 10 times earnings; at these levels, expectations for double-digit EPS growth over the next five years were undoubtedly not priced into the stock.

Even after Apple announced a major boost to its share repurchase program, shares continued to trade at levels below $450 for several months. With $60 billion to repurchase shares, Apple wouldn't even have to grow its top line to reward investors who bought shares at those levels -- a share repurchase program alone would boost earnings. And once this share repurchase program expired, Apple will likely be in a position to begin another one, thanks to Apple's healthy free cash flow generation.

The point is this: There is no way the fair value of shares really fell and rose again by magnitudes greater than $125 billion in a timeframe of less than one year. The market is irrefutably inefficient, and Apple's volatility in 2013 is proof.

Easier said than done
In hindsight, of course, it's easy to see that Apple stock offered investors an enticing entry point at levels around $400. While the first step of believing that stocks are not always priced efficiently is fairly easy, the second step of actually making an investment that goes contrary to what others believe at the time is far more difficult.

This concept is eloquently expressed by Oaktree Capital's chairman Howard Marks in his book The Most Important Thing Illuminated, "The problem is that extraordinary performance comes only from correct non-consensus forecasts, but non-consensus forecasts are hard to make, hard to make correctly, and hard to act on."

It may be difficult to make a non-consensus investment, but it is possible.

Did you pounce on the Foolish investment opportunity Mr. Market offered in 2013 when Apple stock plummeted?