Hire purchase problems A bank offers loans at interest of $12\%$ per annum , compounded monthly. Jack took a $\$50,000$ loan and makes a monthly installment payments of $\$4200$ at the end of each month . Find his outstanding loan after his third installment payment. 

I'm confused with what to substitute into the compound interest formula: 

$$ A = 50,000 \left( 1 + \frac{0.12}{12} \right)^n $$

Since I do not know what's the total number of interest periods, which number should I substitute into $n$ ?
While the solutions to approach this through "brute force" are fine for a small number of periods, I thought I'd show a more general approach when you're asked to do the computation for longer durations. If you find the following heavy-going, then just do the brute force computation (I indicate where you can immediately do this in the working below).

Approach this problem from first principles. An annual interest rate of $12\%$ compounded monthly is a compound monthly rate of $1\%$. A monthly compounding means the amount owed will grow by a factor of $(1 + 0.01) = 1.01$ with each month.

Let the initial amount at the beginning of the first month (the principal) be represented by $A_0$.

Then the amount at the end of the first month $A_1 = 1.01A_0 - 4200$.

The last term is because he does a partial repayment by $\$4200$.

In fact, this is the general formula for the recursion:

$A_{n+1} = 1.01A_n - 4200$.

At this point, you can immediately apply this recursive calculation to find $A_3$, which is the simple "brute force" approach. Use $A_0$ to find $A_1$, then $A_1$ to find $A_2$, then finally $A_2$ to find $A_3$.

But if you want a more general solution, you can work through this to find a closed form for $A_n$. 

$A_n = 1.01A_{n-1} - 4200 = 1.01^2A_{n-2} - 4200(1.01 + 1) \\= 1.01^3A_{n-3} - 4200(1.01^2 + 1.01 + 1) \\= \dots \\= 1.01^nA_0 - 4200(1.01^{n-1} + 1.01^{n-2} + \dots + 1.01^0)$

the last term of which can be further simplified by the geometric sum formula.

$$4200(1.01^{n-1} + 1.01^{n-2} + \dots + 1.01^0) = 4200\frac{1.01^n-1}{1.01-1} = 4.2 \times 10^5(1.01^n-1)$$

After a little rearrangement, you will get:

$A_n = 4.2 \times 10^5 - 1.01^n(4.2 \times 10^5 - A_0)$

This closed form can be proved using induction for rigour.

From this, you can find out $A_3 = 4.2 \times 10^5 - 1.01^3(4.2 \times 10^5 - 50000) = \$38,788.63$. This is the answer to your question.

If you pursue this to the end (by setting $A_n = 0$), you will find he will have fully repaid his loan by the $13$th month.
Let a month be your period, so the answer to your actual question is that you should substitute 3 into n, because 3 is the number of periods.  However, the interest rate is not $0.12\%/12$

To find the monthly interest rate you must first use $n=12$ and put $12\%$ on the left hand side of your equation in order to calculate the monthly interest rate $x$:

$112\%=(1+x)^{12}$

$x=\sqrt[12]{1.12}-1 = 0.9489\%$ per month$

Now just use brute force to calculate what he owes each month by applying this algorithm 3 times to the principal $\$50,000$:  Add $x\%$ interest and deduct $\$4,200$.

After 1 month he owes $\$46,274.44$

After 2 months he owes $\$42,513.53$

After 3 months he owes $\$38,716.93$