Sequence of alternating $0$'s and $1$'s in terms of $i$?
How to redefine the function $f(n) = \begin{cases} 1, & \text{if $n$ is even} \\ 0, & \text{if $n$ is odd} \end{cases}$ in terms of arithmetic operations using ⅈ?
$\endgroup$ 32 Answers
$\begingroup$The function $g(n)=i^{2n}$ maps even values to $+1$ and odd values to $-1$.
So you just need a function $h(n)$ such that:
- $h(+1)=1$
- $h(-1)=0$
This function is pretty simple: $h(n)=\dfrac{n+1}{2}$.
Now you just need to construct the function $f(n)=h(g(n))=\dfrac{i^{2n}+1}{2}$.
UPDATE:
Your piecewise function is from $\mathbb{N}$ to $\mathbb{N}$, so clearly there is no need to "involve" $\mathbb{C}$ here.
As implied by @columbus8myhw in the comment-thread below, $i^{2n}=(i^2)^n=(-1)^n$.
Therefore, you might as well use $f(n)=\dfrac{(-1)^n+1}{2}$.
$\endgroup$ 8 $\begingroup$$f(n) = \dfrac{1^n + (-1)^n}{2} = \dfrac{i^{4n} + i^{2n}}{2}$
$\endgroup$ 1