EDITOR'S NOTE: Mohammad Majd works at an engineering firm in Philadelphia. He wrote this piece in response to a CNNMoney story "How I paid off by student loans by 26."
NEW YORK (CNNMoney) -- When I graduated from Drexel University in 2009 with a degree in engineering, I was 23 and had $200 in my bank account.
In other words, I was like most American college students: Poor and in debt.
I was subletting a small studio apartment in Philadelphia with two other engineers. Our combined student loan debt was well over a quarter of a million dollars. Out of the three of us, I came out by far the least scathed -- I had about $55,000 in student loans. This was after receiving grants, scholarships, and help from my parents every year.
The loan burden: My mother was overly ambitious in helping me and put a lot of my tuition payments on her credit card; as a result, she ended up claiming bankruptcy my senior year.
My roommates each had over $100,000 to repay. One of them currently waits tables on weekends on top of having a full-time engineering job. He's been doing it since we graduated in an admirable effort to pay down his student loan debt.
When I started my career, my monthly student loan payments came to $460. My entry-level engineering job paid $48,000 a year. I was better off than most. My payments were inconvenient but still manageable.
Paying down debt: Aside from moving out of that studio and into a small two-bedroom apartment, I maintained the same modest lifestyle I had while I was a student. A lot of my friends were still struggling to find jobs, so there wasn't much social pressure on me to get a new car, a nice apartment or eat out at fancy restaurants.
I began attacking my student loans by making double and triple payments. Like a lot of other recent graduates, I was conditioned to fear debt, and I made a point to get rid of it as soon as possible.
Coming out of school just after the financial crisis had a big impact on me. I wanted to know what had just happened and why my friends weren't getting the jobs they deserved, so I started reading a lot about the crisis and about economics in general.
One important concept that I came across was Opportunity Cost -- the notion of quantifying what you give up when you chose one option over another. I asked myself: Why am I rushing to pay off loans with 3% to 6% interest rates when the S&P has historically returned 11%?
Game changer: I changed my entire philosophy on debt. I started making minimum payments on my student loans, picked up a "Stock Investing for Dummies" book, and put whatever extra money I made into the stock market.
I was a novice investor, but I bought at a time when a lot of other people were discouraged from investing in 2009 and 2010. Consequently, I was able to buy stocks at bargain prices.
When I turned 26, I noticed something astonishing My student loan debt and the money in my investment account had converged to the same amount -- $35,000. It was a really good feeling knowing that I could wipe away my entire student loan debt with just a few mouse clicks, but I opted to continue making minimum payments.
By paying the minimum, it would take me eight years to pay off all my loans. Here are the options I thought through:
Option 1 -- Pay off loans entirely
I could pay off the $35,000 immediately with the money I had made by age 26. I could then put at least $460 a month for eight more years into an investment account.
After eight years, I would have $63,000 (assuming an annual return of 10%).
Option 2 -- Continue minimum payments
The alternative was for me to continue making the $460 a month payment and keep the $35,000 I had accumulated thus far invested in the stock market.
After eight years, I would have $75,000 (assuming an annual return of 10%).
Sure, that is simplifying it a bit. Obviously, the stock market doesn't return 10% every year on the dot. These numbers also don't take taxes into account. Student loan interest is tax-deductible up to $2,500, and capital gains is 0% for anyone who taxed at the 10% to 15% rate.
The options will be slightly different for everyone. Depending on the interest rate and life of the loan, reducing debt might be the best option.
But for many of us who have grown up in modest households, we are taught to pay off debt quickly. It's not a bad lesson. But if you want to get rich, you might be better off making the minimum payment on your student loan and investing the rest.
Today I am well on my way to paying down my student debt, but I also have tens of thousands in stock market gains.
I'm glad I did the math.
Mohammad Majd works at an engineering firm in Philadelphia. He wrote this piece in response to a CNNMoney story "How I paid off by student loans by 26."