Recurrence relation (interest) I am having trouble knowing what to do here. Can you give me a hint about what to solve this? It's a recurrence relation. Anything is helpful at this point.
"You take a loan of S dollars that is to be paid back in T periods of
time. If r is the interest rate per period of the loan, what constant payment
P do you have to make at the end of each period? This is a boundary value
problem. What are the boundary values? Solve it on the computer. Say
r = 0:05 and S = 10000. Try different P and see for which T you have paid
back. Plot with command Plot the values of your debt after period n, an,
where a0 = S."
The plotting is referred to Mathematica by the way. I know that, with interest at 5%, we have A0 = 10000, A1 = 10.500, A2 = 11.025 and so on. So a recurrence relation (in my head) would be An = An-1 + 0.05*An-1. But I don't know how that helps me solve the problem. How can I define P if T is also not defined?
 A: $a_n = a_{n-1} \cdot (1+r) - P$ where $a_0 = S$.
Plot out some values to get a sense for how things change:
$a_0 = S$
$a_1 = S \cdot (1+r) - P$
$a_2 = S \cdot (1+r)^2 - P - P \cdot (1+r)$
$a_3 = S \cdot (1+r)^3 - P - P \cdot (1+r) - P \cdot (1+r)^2$
And so on. This means:
$$a_T = S \cdot (1+r)^T - P \cdot \sum_{k=0}^{T-1} (1+r)^k$$
or
$$a_T = \dfrac{(1 + r)^T (S \cdot r - P) + P}{r}$$
We want $a_T = 0$, which means if we know $T$ and want to solve for $P$:
$$P = \dfrac{r \cdot S \cdot (1 + r)^T}{(1 + r)^T - 1}$$
Or if we know $P$ but want to solve for $T$:
$$ T = \dfrac{\log\left(\dfrac{P}{P - r \cdot S}\right)}{\log(1 + r)} $$
A: I'm a bit rusty at this but I'd like to try to help.
Let $D(n)$ be the total amount you have to pay back after the $n$th period. So then after the first period, you've got to pay back what you initially borrowed, $S$, along with its interest, $r$. For simplicity of the algebra, I'm going to write the interest as $R=105\%$ instead of as two terms with $r=+5\%$ (so $R=1+r$).
After the first period, you owe $RS$ back. But let's assume that you pay back the constant payment $P$. Taking this into account, your debt is $D(1)=RS-P$. By the same reasoning, after $2$ periods, the amount you have to pay back is your pre-existing debt, $D(1)$, with its interest and minus the payment $P$. So $D(2)=RD(1)-P$. But in general, $D(n+1)=RD(n)-P$.
So then we want an explicit formula for $D(n)$. One of the easiest ways of doing this is by running through a few terms and finding any patterns that emerge. Let's try:
$$\begin{align} D(1)&=RS-P\\
 D(2)&=R(RS-P)-P\\
 &=R^2S-RP-P\\
 D(3)&=R(R^2S-RP-P)-P\\
 &=R^3S-R^2P-RP-P\\
 D(4)&=R^4S-R^3P-R^2P-RP-P\\
\end{align}$$
Now that's quite a mess of algebra but it should be relatively clear that in general, $P(n)=R^nS-R^{n-1}P-R^{n-2}P-\ldots-RP-P$. Or, written more succinctly, $$D(n)=R^nS+\sum_{k=0}^{n-1}-R^{k}P$$
We could prove this equality by induction if we wanted more rigour. The next step is to simplify this sum as follows, by noticing that the sum is a geometric series: $$D(n)=R^nS-P\sum_{k=0}^{n-1}R^{k}=R^nS-P\frac{R^n-1}{R-1}$$
Now we can substitute in $r=R-1$ and see that our problem is now reducing our debt, $D$, to $0$ in $T$ periods. Can you take it from here?

As @Frpzzd says, this type of problem is called Amoriziation (Wikipedia)
