I am a first time home buyer closing on a townhouse in about 3 months. I am having difficulty understanding how to correctly calculate whether it is more "profitable" to eliminate the PMI on my new home by putting 20% down, or to use the excess funds for investing. I found an interesting discussion about this issue here:

https://forum.mrmoneymustache.com/ask-a-mustachian/pmi-payoff-roi/However, the OP already owned the house, so it appears the calculations might be different than for the person who hasn't yet closed. I also didn't notice a definitive answer as to how to make these calculations.

**Background Info**Sales Price: $258,995

Loan Type: Fixed 30-year loan

Mortgage rate with 10% down payment: 4.625%

Mortgage rate with 5% down payment: 4.7%

Monthly PMI: $182.48

I'm not sure how to compare paying off the PMI versus investing. Could I assume I intend to put down 10% and therefore would have $25,899.50 left over for investing if I didn't put 20% down?

One problem is I do not know how to determine which percentage of monthly payments goes toward principal and interest. I suppose once I know this I could determine how long it would take to eliminate PMI if I invested the extra $25,899.50 rather than using it to eliminate PMI.

To compare the options I imagine doing something like this:

Option 1 (investing): (Total gains from investment over period it takes to eliminate PMI) - (PMI Payments over that period + the mortgage interest paid on $25,899.50)

Option 2 (Put 20% down): Profits = Avoided PMI payments over the PMI period + the mortgage interest payments saved

My apologies if this is totally off! Thank you.