# Is $x[n]=(-1)^{n^2}$ periodic?

Is $$x[n]=(-1)^{n^2}$$ periodic? The answer said no, but when I draw it on a graph, it seems to be periodic, with fundamental period equal to $$2$$. You're right, the given $$x[n]$$ is clearly periodic. You can show this by simply checking if

$$x[n]\stackrel{?}{=}x[n+N]\tag{1}$$

is satisfied for some positive integer $$N$$.

For the given $$x[n]$$ you get

\begin{align}(-1)^{n^2}&\stackrel{?}{=}(-1)^{(n+N)^2}\\&=(-1)^{n^2}(-1)^{N(N+2n)}\tag{2}\end{align}

From $$(2)$$ it follows that for $$(1)$$ (and $$(2)$$) to hold we require

$$(-1)^{N(N+2n)}=1\tag{3}$$

i.e., $$N(N+2n)$$ must be even (for arbitrary integer $$n$$). This is certainly the case for any even $$N$$, and the smallest positive even $$N$$ is $$2$$, hence the (fundamental) period of the given $$x[n]$$ is indeed $$2$$.

I think you're missing a critical component in your drawing/calculation

Hint: Look at the exponent

EDIT: Yep I was wrong, my bad

• Can you explain it? It seems to me that for all odd $n$, $x[n]$ is always -1 and for all even $n$, $x[n]$ is always 1 so it is periodic. – Vinh Quang Tran Sep 15 '19 at 14:27

Written as you did, this seems periodic to me. As you observed, the answer depends on the parity of $$n$$. You can rewrite $$n=2\nu_n+\epsilon_n$$, with $$\nu_n$$ integer ($$\nu_n = \lfloor n/2\rfloor$$), and $$\epsilon_n = n-\lfloor n/2\rfloor$$ is zero if $$n$$ is even, and $$\epsilon_n$$ is one if $$n$$ is odd. The latter series $$\epsilon_n$$ is $$2$$-periodic.

Thus, $$x[n] = (-1)^{\epsilon_n}$$, which is $$2$$-periodic as well. Sometimes, textbooks have mistakes.