Recursion involving Piecewise

768 Views Asked by At

Student $C$ tries to define a function $G$: $Z^{+}\rightarrow Z$ by the rule $G$($n$) = \begin{cases} \ 1, & \text{if $n$ is 1}\\ \ G(\frac{n}{2}), & \text{if $n$ is even} \\[2ex] G(3n-2), & \text{if $n$ is odd and $n>$1} \end{cases}

for all integers $n \geq $ 1. Student $D$ claims that $G$ is not well defined. Justify student $D's$ claim.

I have no idea where to begin; please can someone point me in the right direction or perhaps hints? Thank you so very much!

2

There are 2 best solutions below

0
On

It is well defined if you can follow back the chain for any input $n$ and (if there are multiple routes back) if you always get the same answer. In this case the three pieces of the definition based on $n$ form a partition of $\Bbb Z^+$, so there is only one to apply at each time. If you try to evaluate $G(2^k)$, you need $G(2^{k-1})$, which needs $G(2^{k-2})$ and so on and you find it is $1$, so is well defined. But if you try to evaluate $G(3)$, you need $G(7)$, which needs $G(19)$ and you never get to a defined one, so there is not a unique value for $G(3)$

1
On

$g(3)=g(7)=g(19)=...$, if $n$ is odd, $3n-2$ too, and if we want define $g(3)$, we have a recursion indefinite.