recurrence relation for loans You borrow $4000$ dollars, at $12$ percentage compounded monthly, to
buy a car. If the loan is to be paid back over two years, what is the
monthly payment? Note you pay back same amount every month. Use a recurrence relation (for loans) to solve the problem.
What I have tried so far is
$P(A|P, i\%, N)$
This I substitute to $4 000(1\%, 24)$ and the table of discrete compounds give me $(A|P , 1\%,24) = 0.0471$
$4000(0.0471) = 188.4$
with $a_0 = 4 000$
and $a_n= a_{n-1} - 188.4$ gives $a_{24}= - 521.6$
However,  $4000 \times 1.12 = 4480 $ and $4480 \ne 521.6 $
The second thing i tried was to calculate with $a_{n-1}\times\left(1+\frac {0.12} {100}\right)-1666.6667$ and this gives $a_{24}= 61.115$
It should be $a_{24}= 0$, what am I missing?
 A: Not gonna do your problem for you. However, here is a full explanation for the derivation of the formula for the monthly payment, and a more in-depth description can be found at my blog post on this page.
Given the initial balance, the number of payments, and the monthly interest amount, finding the monthly payment can be a tricky task. However, we can set up an iterated function to calculate it. First, we assign variables to the givens and the unknowns. Our givens are $L$, the loan amount; $m$, the monthly interest rate; and $n$, the number of payments. Our unknowns are $p$, the monthly payment; $i_k$, the interest amount at the kth payment; $l_k$ be the interest amount at the kth payment; and $B_k$, the balance after the kth payment.
We already know one thing about the relationship between $i_k$ and $B_k$; namely, that
$$i_k=mB_{k-1}$$
because the interest of the kth payment is the monthly interest times rate times the current balance before the payment is made. We also know that
$$l_k=p-i_k$$
because whatever part of a payment not interest is the principal part of the payment. Also, because whatever is not interest goes towards the loan,
$$B_k=B_{k-1}-l_k$$
We can now substitute $p-i_k$ for $l_k$ and we get
$$B_k=B_{k-1}-(p-i_k)$$
$$B_k=B_{k-1}-p+i_k$$
We also can substitute $mB_{k-1}$ for $i_k$, so
$$B_k=B_{k-1}-p+mB_{k-1}$$
$$B_k=(m+1)B_{k-1}-p$$
We have turned $B_k$ into a sequence. In order to finish defining the sequence, we need only one term of the sequence. We already know that before any payments, the balance is $L$, so we can let $B_0=L$. Then we can define $B_k$ as
$$B_k=f(B_{k-1})$$
where
$$f(x)=(m+1)x-p$$
However, since $B_0=L$, then
$$B_k=f^k(L)$$
and by our formula for the nth iteration of functions of the form $f(x)=cx+d$,
$$f_k(x)=(m+1)^kx+p\frac{1-(m+1)^k}{m}$$
and
$$B_k=(m+1)^kL+p\frac{1-(m+1)^k}{m}$$
But this is still in terms of $p$, which is an unknown as of yet. However, we can solve for $p$ because we know another value of $B_k$. Since, after the last payment, the balance will be $0$, we can say that $B_n=0$. We can substitute and solve for $p$:
$$0=(m+1)^nL+p\frac{1-(m+1)^n}{m}$$
$$p\frac{(m+1)^n-1}{m}=(m+1)^nL$$
$$p=\frac{m(m+1)^nL}{(m+1)^n-1}$$
