Sequence of alternating $0$'s and $1$'s in terms of $i$?

3.9k Views Asked by At

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 ⅈ?

2

There are 2 best solutions below

8
On BEST ANSWER

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}$.

1
On

$f(n) = \dfrac{1^n + (-1)^n}{2} = \dfrac{i^{4n} + i^{2n}}{2}$