If there were an eighth wonder of the world, we'd nominate the equation for compound interest: Your money x (1 + i)^n. (If you're not a math geek, don't worry; we're going to decipher that for you.)

Albert Einstein (or maybe it was Yogi Berra) called this deceptively simple formula the "greatest mathematical discovery of all time." We call it your ticket to financial independence.

That's right, just three straightforward inputs can change your life: the amount of money you invest; the rate of return you get; and how much time you have to let your money grow.

Hate math but like money? Read on.
Since words cannot adequately describe the magical nature of compound interest, let's try a few visuals.

Here's how a single $1,200 investment grows over time in four savings scenarios.

How a single $1,200 investment grows over time with compound interest

 

Savings Account (0.1%)

Money Market Fund (1%)

Certificate of Deposit (2%)

Stock Market (9%*)

Initial investment

$1,200

$1,200

$1,200

$1,200

5 years

$1,206

$1,261

$1,325

$1,846

10 years

$1,212

$1,326

$1,463

$2,841

15 years

$1,218

$1,393

$1,615

$4,371

25 years

$1,230

$1,539

$1,969

$10,348

30 years

$1,237

$1,617

$2,174

$15,921

35 years

$1,243

$1,700

$2,400

$24,497

40 years

$1,249

$1,787

$2,650

$37,691

*Based on the stock market's historical rate of return.

As you can see, simply socking away one lump sum and leaving it could turn $1,200 into nearly $40,000 over 40 years. Not only have you earned interest, but you've earned interest on your interest. And all you had to do was invest your first paycheck.

That said, let's be honest: $37,691 ain't what it used to be. So let's make one small revision and invest $1,200 every year. Behold compound interest in a mildly caffeinated state.

How a yearly $1,200 investment grows over time with compound interest

 

Savings Account (0.1%)

Money Market Fund (1%)

Certificate of Deposit (2%)

Stock Market (9%*)

Initial investment

$1,200

$1,200

$1,200

$1,200

5 years

$7,224

$7,444

$7,695

$9,674

10 years

$13,278

$14,006

$14,865

$22,713

15 years

$19,363

$20,903

$22,782

$42,775

25 years

$31,624

$35,770

$41,174

$121,136

30 years

$37,800

$43,777

$51,829

$194,211

35 years

$44,007

$52,192

$63,593

$306,646

40 years

$50,246

$61,037

$76,582

$479,642

*Based on the stock market's historical rate of return.

Now we're at half a million. Not bad, right? Still, we think you can top it. In fact, it's not a stretch to get near that magical $1 million milestone. Just save $2,800 a year (a mere $233 a month), and at 9% you've got a million dollars in 40 years. Or stick with the $1,200 annual contribution but improve your investing skills (which the rest of this series will show you how to do). If you are able to best the stock market's average annual returns by a mere 3 percentage points, the $1 million prize is yours.  

And the best part about compound interest is that it works the same for everyone, whether you have $20 to invest or $200,000. Go ahead, tinker with this compounding calculator to see what we mean. If you don't believe you can become a millionaire with just the resources you have right now, keep reading.

The amazing tale of the Mississippi washer woman

Oseola McCarty was born in Mississippi in 1908. For nearly 75 years, she lived in the same simple house, washing other people's clothes for a living and putting whatever money she could into savings accounts at local banks.

In the summer of 1995, Oseola made local and then national headlines when she donated $150,000 to the University of Southern Mississippi to establish a scholarship fund. "I just figured the money would do [scholarship recipients] a lot more good than it would me," she said. It soon came out that this washer woman had managed to amass nearly one quarter of a million dollars over her lifetime.

Time -- a key part of the compounding equation -- helped turn her meager early investments into hundreds of thousands of dollars.

We like this ending better

As remarkable as the Oseola McCarty story is, the ending could have been a blockbuster. After she died in 1999, one of her bankers wrote to us saying: "Time was able to turn even the modest returns of her early investments into hundreds of thousands of dollars. If we had been able to introduce her to equities earlier, she would have left millions instead of thousands."

Remember, the amount you save and your time horizon -- how long you have until you need the money you've invested -- are only two-thirds of the compounding equation. Oseola excelled in both. But she did pay a price for ignoring the rate of return on her investments.

Typically, the more risk you are willing to take on (by, say, investing in stocks rather than bonds), the higher your potential return. But risk is a four-letter word to a lot of folks: They're happy to settle for lesser returns to avoid it.

Bad idea. Stuffing all your savings into the Serta -- or sticking only with safer investments like Treasury bills or bonds -- is even more disastrous. It's not simply that they return less. It's that they barely keep up with the rate of inflation, and that means your retirement dollar is not going to go as far as you think. We Fools believe the best place for your long-term (key word ... as you'll discover in Step 4) savings is the stock market.

Your golden ticket to financial independence

There you have it: Financial independence is just three variables away. So start saving now (as much as you can), and invest it well. Because the sooner you get the wonder of compounding working for you, the sooner you'll reach your financial dreams. And that's exactly what this series will help you do.

Action: Who wants to be a millionaire? That's what we thought. Here's the magic code you need: 10,000, 2,800, 0%, 40, 8%. Plug in those numbers -- in that exact order -- here.

This article was updated March 23, 2016.

How to simplify investing -- in just 30 minutes a day
It’s roughly the same amount of time it takes to walk a quarter-mile on a treadmill… whip up dinner… read your children a bedtime story. And it’s how little time it takes to learn everything you need to know to begin investing in the stock market. (Which -- if you’re like most of us -- is something you know you should do… but keep putting off.) The Motley Fool’s Director of Investor Learning is eager to help you start down that venture -- absolutely FREE -- in just 30 minutes a day, for 13 days. Simply click here to get started.