I stumbled on this not so complicated concept and couldn't figure out what it's called.
I want to buy something that costs $M$ units of money, and have to pay it in $n$ months at a rate of $\frac M n$ every month, with no interest (just to simplify the calculations). I take $M$ units of money and immediately invest it with a compound interest rate of $r$ per month.
At the end of the first month, I'll have $rM - \frac M n$ units of money.
At the end of the second month, I'll have $r(rM - \frac M n) - \frac M n$.
And so on.
This adds up to $M[r^n - \frac 1 n (\sum_{k=1}^n r^{n-k})]$, which simplifies to $M[r^n -\frac 1 n \frac {r^n-1} {r-1}]$.
The idea behind this was to find out if given the choice to pay $m$ units of money upfront (where $m<M$) would be worth it over paying it in $\frac M n$ monthly payments, given I can guarantee the monthly interest rate $r$.
The conclusion I got to (which may be wrong) is that it is worth it if $r^n - \frac 1 n \frac {r^n-1} {r-1} > d$, where $d$ is the discount rate $1-\frac m M$.
For example, if offered a discount rate of $d=3\%$ upfront, over the option of paying the full rate over 12 months, and I have $M$ units of money and can guarantee an interest rate of $r=0.7\%$ a month, I shouldn't take the discount, since at the end of the 12 months I'll have a return of $\approx 4.8\%$ ($>3\%$) over the full amount $M$.
I'm sure this (or something resembling this) is a well known concept/formula, I just couldn't find what it is called, so some guidance would be appreciated.