Recursive to explicit formula from power function

246 Views Asked by At

I have a recursive formula of a method $f\left(a,b\right)$:

$f\left(a,b\right) = \begin{cases} f\left(a,\lfloor \frac{b}{2} \rfloor\right) \cdot f\left(a,b-\lfloor \frac{b}{2} \rfloor\right) & \text{if $b > 1$} \\ a & \text{if $b = 1$} \\ 0 & \text{if $b = 0$} \end{cases}$

with $a,b \in \mathbb{N}$ (including $0$).

By calculating a few examples, I found out that the function is the power function:

$f\left(a,b\right)=a^b$

How can I prove this? Thanks for your help.


Example

$ \begin{align} f\left(5,3\right) &= f\left(5,\lfloor \frac{3}{2} \rfloor \right) \cdot f\left(5,3-\lfloor \frac{3}{2} \rfloor \right) \\ &= f\left(5,1\right) \cdot f\left(5,2 \right) \\ &= f\left(5,1\right) \cdot f\left(5,\lfloor \frac{2}{2} \rfloor \right) \cdot f\left(5,2-\lfloor \frac{2}{2} \rfloor \right) \\ &= f\left(5,1\right) \cdot f\left(5,1\right) \cdot f\left(5,1\right) \\ &= f^3\left(5,1\right) \\ &= 5^3 \end{align} $

1

There are 1 best solutions below

0
On

Prove it using strong induction.

Assume that $f(a, c) =a^c $ for all $c < b$.

Using this, prove that $f(a, b) = a^b$.

This should not be too hard.