I’m not positive I understand your initial question, but I think I do.
On one hand, you deposit, say, $1000 at the end of every month into an account earning 5% compounded monthly for 30 years. How much will you have saved after 30 years?
On the other hand, if you finance a loan where you pay $1000 at the end of every month for 30 years at 5% compounded monthly. How much was the original loan for?
Are you asking if these two amounts are the same?
The answer is no, but they are related.
If you’re making regular deposits and want to know how much you’ll save, the formula is (and I hope this is clear, it’s a bit difficult to type clearly):
FV = pmt*[(1 + i/p)[sup]N[/sup] - 1]
FV = total amount saved up at the end
pmt = amount of each deposit
i = annual interest rate
p = number of times the interest is compounded per year = number of deposits/payments per year
N = total number of deposits made
So if you deposit $1000 at the end of every month for 30 years, and it’s earning 5% compounded monthly, you will have saved up a total of $832,258.61 after the full 30 years.
On the other hand, for a loan the equation is:
PV = pmt*[1 - (1 + i/p)[sup]-N[/sup]]
PV = size of original loan
(all other variables same as before).
So if you’re paying off a loan at 5% compounded monthly, end of the month payments of $1000 each for 30 years, the original loan must have been for $186,281.62.
So they’re not the same but they are related by compounded interest:
832,258.61 = 186,281.62(1 + .05/12)[sup]360[/sup]
This is exact, perhaps only a bit off due to rounding errors.
In the first case, if you want to know how much interest your investment has earned, simply realize that you’ve deposited $1000 on 360 separate occasions (a total of $360,000), while you actually have $832,258.61 in the account after the 30 years. The difference came from the interest earned: 832,258.61 - 360,000 = $472,258.61 in interest has been earned.
Similary, for the loan, the interest you’ve paid is 360,000 - 186,281.62 = $173,718.38.
Just let me know if any of this isn’t clear.