1

How to model a function which satisfies following condition:

$$ f(x) = \begin{cases} 1 & x \in 3,7,11,\ldots\\ -1 & x \in 1,5,9,\ldots \end{cases} $$

The first result can be generated using $4n+1$ and the second with $4n-1$ for $n \in \mathbb{N}$. Can this be modelled using one function?

Razer
  • 125
  • 3

3 Answers3

2

$$ f(x) = \begin{cases} 1 & x=4n-1\\ -1 & x =4n+1 \end{cases} \stackrel{u=x+1}{=} \begin{cases} 1 & u=4n\\ -1 & u=4n+2 \end{cases} \stackrel{2u=y}{=} \begin{cases} 1 & y=2n\\ -1 & y =2n+1 \end{cases}=(-1)^y $$ $$=(-1)^\frac{x+1}{2}.$$

This $f(x)$ can be complex-valued unless you restrict its domain to the $x$ such that $x \equiv 1,3 \mod 4$.

Meow
  • 6,353
2

One simple answer could be $$f(x)=-\sin \frac{\pi x}{2}$$ with the bonus of being equal to zero for even values of $x$.

2

$$f(x) = \begin{cases} 1 & x \equiv 3 \bmod 4 \\ -1 & x \equiv 1 \bmod 4 \end{cases}$$

is a perfectly good definition of a function of the odd integers. Quite frequently, it is even more useful than alternative ways to write this function.