Minimization of amount in the change coins problem using the dynamic programing approach
Your formula is wrong (I would like to see where exactly this formula appears in the course, it is not in the gif you linked).

The correct formula is the following:
Let $n$ be your amount. Let minCoins be an array of $n+1$ elements indexed from $0$ to $n$, where minCoins$[i]$ is the minimum amount of coins needed to give change for the amount $i$. Let $c_1, \dots, c_k$ be the denominations of coins you have available.

Then minCoins$[0]=0$ and, for $i&gt;0$:
$
\text{minCoins}[i] = \min_{\substack{j=1,\dots,k\\c_j \le i}} \{1 + \text{minCoins}[i-c_j] \}.
$

In your specific example:

$$
\begin{align*}
\text{minCoins}[9] &amp;= \min \{\text{minCoins}[9-6]+1 , \text{minCoins}[9-5]+1, \text{minCoins}[9-1] +1\} \\
&amp;= \min \{\text{minCoins}[3]+1 , \text{minCoins}[4]+1, \text{minCoins}[8] +1\} \\
&amp;= \min\{ 3+1, 4+1, 3+1\} \\
&amp;=  \min\{ 4, 5, 4\} = 4.
\end{align*}
$$