2

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

Dan Oak
  • 220

2 Answers2

4

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

barak manos
  • 43,599
  • That can be written in a more simply as $\frac{(-1)^n+1}2$. – Akiva Weinberger Oct 01 '14 at 14:50
  • @columbus8myhw: I know, but OP asks to use $i$. – barak manos Oct 01 '14 at 14:54
  • $\frac{(-1)^n+1}2+i-i$ works, then, if you want to be cheaty. – Akiva Weinberger Oct 01 '14 at 15:25
  • @columbus8myhw: Yeah, I've figured I could just add $0 \cdot i$, but I'm not sure if there is any point to that. In any case, OP's piecewise function is from $\mathbb{N}$ to $\mathbb{N}$, so clearly there is no need to "involve" $\mathbb{C}$ here, unless that's really what you want to do (and I guess that's what OP wanted to do). – barak manos Oct 01 '14 at 15:28
  • My guess is that he was interested in the "oscillatory" properties of $i^n$. However, all roots of unity (not just $i$) have that property, including $-1$. – Akiva Weinberger Oct 01 '14 at 15:30
  • @columbus8myhw: OK, I added your suggestion to the answer. Thanks for pointing that out. – barak manos Oct 01 '14 at 15:39
  • yeah, thanks guys. i was really interested in the "oscillatory properties". actually just i wanted to convert $\sum_{n\ge0}{z^{2n}}$ to $\sum_{n\ge0}{f(n)z^n}$. hmm... interesting how to generalize to the case of sum of $z^{kn}$ – Dan Oak Oct 01 '14 at 15:59
  • @DanyloDubinin You use other roots of unity. (I will agree, though - it is an interesting problem.) – Akiva Weinberger Oct 01 '14 at 16:18
3

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

taninamdar
  • 2,662