We had to prove the following algorithm by induction:
$ a^n = a^{n/2*2} = a^{n/2}*a^{n/2} $ if $n$ is even
$ a^n = a^{\frac {n-1}2*2}*a = a^{\frac {n-1}2} * a^{\frac {n-1}2} * a $ if $n$ is odd
I need to prove this by induction.
My Solution:
Base Case: Let $n = 1$: $a^1 = a$ (Proven for $n = 1$)
Induction Hypothesis: Let this be true for all integers upto n. If $n$ is even break it into parts and as those values must be less than $n$ it would be true for them and then multiply that by a (Base Case.)
Same for when is odd.
Hence proven.
Is my solution correct?