I am currently revising for my maths exam in school and there is a section on recursion. The question is explained as follows: $$f(m, n) =\begin{cases} n + 1 &\text{if } m = 0\\ f(m − 1, 1) &\text{if } m > 0 \text{ and } n = 0\\ f(m − 1, f(m, n − 1)) &\text{if } m > 0 \text{ and } n > 0\\ \end{cases}$$
calculate:
1) $f(1,1)$
2) $f(1,2)$
My current problem is i don't understand how my teacher arrives at this answer:
$$f(1, 1) = f(0, f(1, 0)) = f(1, 0) + 1 = f(0, 1) + 1 = 1 + 1 + 1 = 3$$
and:
$$f(1, 2) = f(0, f(1, 1)) = f(1, 1) + 1 = 3 + 1 = 4$$
I understand the principle of recursion but I am struggling to execute the above, could somebody work through the example $f(1,1)$ so I can how how it is done?