If investors remember just one thing about 2022, it will likely be the bear market, which marked the worst downturn for Wall Street since 2008. The Nasdaq Composite is currently off 33% from its high of late last year, with many of the individual stocks that make up the index falling much further. However, for investors with the right temperament, this painful period also offers some good news. Many of the world’s top companies–which historically rebound much more quickly when the carnage is over–are selling at multi-year lows, giving investors the opportunity to profit from the short-term fear that currently grips Wall Street. Let’s take a look at two of the tech leaders: Microsoft (MSFT -1.74%) and Alphabet (GOOGL -0.66%) (GOOG -0.37%). Image source: Getty Images. Diversification is the key There’s no question that Microsoft is a household name, but pigeonholing the company into a single product or service is impossible. The tech giant has an unprecedented reach that runs the gamut from hardware to software, and from consumers to businesses. Because of the diversity of its offerings, Microsoft is somewhat insulated from the downturn. Beyond its ubiquitous Windows operating system and Office suite of productivity software, Microsoft offers Xbox video game consoles, Surface touchscreen computers, Teams business collaboration software, social and professional network LinkedIn, Azure Cloud, and much more. The benefit of having such a vast expanse of offerings can’t be overstated, helping shield Microsoft from economic headwinds. Even in the midst of the worst downturn in more than 10 years, Microsoft has continued to grow revenue at a respectable clip. For its fiscal 2023 first quarter (ended Sept. 30), revenue grew 11% year over year and 16% in constant currency, but the performance of its biggest segments varied. Microsoft’s intelligent cloud segment grew 20% year over year, while its more personal computing segment edged slightly lower, and its productivity and business processes grew 9%. This illustrates the strength that comes from the company’s diversity — when one segment lags, another picks up the slack. Another factor that should help prop up the stock is Microsoft’s dividend. Since initiating a payout in 2004, the company’s track record has been stellar, with its dividend growing a massive 750%. Furthermore, Microsoft uses just 27% of its profits to fund the payout, so it can continue to grow its profits for many years to come. While its yield might seem meager at about 1.1%, that’s the result of Microsoft’s consistent stock price gains. Over the past decade alone, Microsoft shares are up about 813% — even after its recent decline. Factor in the dividend and its total return jumps to over 1,000%. The stock’s gains have been fueled by robust business performance from a company that continues to reinvent itself. To be clear, the bear market has taken down many technology stocks and Microsoft hasn’t been completely immune, down 29% from its high of late last year, its worst decline in more than a decade. But this gives investors the opportunity to pick up shares at a discount. And at less than 26 times earnings, Microsoft is cheaper than it’s been in years. Search dominance and so much more It isn’t too often that you get to buy Alphabet on sale, but since late last year, the stock has tumbled 40%. That’s by far its worst sell-off in roughly 14 years. Yet a decline of this magnitude focuses solely on the current macroeconomic climate. Investors who take a step back will realize the wisdom of the old adage, “This too shall pass.” Alphabet absolutely dominates worldwide search with a 92% share of the market. Its adoption is so pervasive that it has become a verb — “Google it.” The company’s constantly-improving search algorithms have made it nearly impossible for potential rivals to gain ground. Search fuels Alphabet’s digital advertising — another area it dominates — with a roughly 29% market share of worldwide digital ad spending last year. Google also has nine products that boast more than 1 billion users each, including (in no particular order): Android, Chrome, Gmail, Google Drive, Google Maps, Google Search, Photos, and Google Play Store. With billions of users locked into its ecosystem, its aforementioned dominance will no doubt continue. And let’s not forget YouTube, which is widely regarded as the No. 1 streaming video platform worldwide, with 2.6 billion viewers accessing the platform monthly, providing another source of ad revenue. If these industry-leading positions weren’t evidence enough of Alphabet’s resilience, the company has quickly made a name for itself as the No. 3 cloud computing provider, with 9% of the market. For context, the top two positions are held by Amazon Web Services (AWS) and Microsoft Azure, which control 32% and 22% of the market, respectively, according to Canalys. Yet Google Cloud is the fastest-growing, which bodes well for future market share gains. That’s not to say Alphabet doesn’t face challenges. Advertising spending typically takes a hit during times of economic uncertainty — which have existed in abundance over the past year. In the third quarter, Alphabet’s revenue grew just 6% year over year in constant currency, its lowest rate of growth in nearly a decade. Of course, this came on the heels of 41% growth in 2021, making for extremely tough comps. Given its strong position in numerous growth industries, investors can get Alphabet for a song. The stock’s price-to-earnings ratio is less than 18, a valuation not seen since early 2014. John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool’s board of directors. Suzanne Frey, an executive at Alphabet, is a member of The Motley Fool’s board of directors. Danny Vena has positions in Alphabet, Amazon.com, and Microsoft. The Motley Fool has positions in and recommends Alphabet, Amazon.com, and Microsoft. The Motley Fool has a disclosure policy.