Applying squeeze theorem to a function $(-1)^n$

So we were doing a question at university, where, we had to show the sequences tended to $$0$$ using the squeeze theorem or otherwise. $$a_n = \begin{cases} \frac{1}{n} & n = 2m + 1 \\ \frac{-1}{n} & n = 2m \end{cases}$$ The way we tried applying the squeeze theorem is to write the function as $$\frac{(-1)^n}{n}$$ and then to apply the squeeze theorem say, $$-1 \leq (-1)^n \leq 1$$ Dividing throughout by $$n$$, we get, $$\frac{-1}{n} \leq \frac{(-1)^n}{n} \leq \frac 1 n$$ Now, clearly applying limits throughout, $$\lim_{n \rightarrow \infty}\frac{-1}{n} \leq \lim_{n \rightarrow \infty}\frac{(-1)^n}{n} \leq \lim_{n \rightarrow \infty}\frac 1 n$$ Which gives us, $$\lim_{n \rightarrow \infty} a_n = 0$$ Is this an acceptable proof, someone pointed out that you couldn't write, the first statement since the function $$(-1)^n$$ only has two values $$\{-1,1\}$$ and that the middle function touches both at infinitely many points so you couldn't apply the squeeze theorem. Any input would be appreciated.

• You mean $a_n=\dfrac{(-1)^{n+1}}{n}$ ? – Aryadeva Oct 16 '20 at 21:10
• @Aryadeva Comment withdrawn, you are right. To the OP: In my opinion, your proof is perfectly valid, except for the typo that Aryadeva's comment focuses on. – user2661923 Oct 16 '20 at 21:13
• No problem @user2661923 – Aryadeva Oct 16 '20 at 21:17
• @Aryadeva yeah my bad, that's a typo it's supposed to be the other way aroudn – Prakhar Nagpal Oct 16 '20 at 21:21
• "touches both at infinitely many points so you couldn't apply the squeeze theorem" - this simply is not true, your proof is fine. – Sil Oct 16 '20 at 21:54

$$\mathop {\lim }\limits_{n \to \infty } \frac{1}{n}=0$$ By definition means that for any $$\epsilon>0$$ there exists an $$N$$ such that if $$n>N$$ then $$\left|\frac{1}{n}\right|<\epsilon\quad\quad (1)$$
Thus obviously if $$a_n=\frac{(-1)^{n+1}}{n}$$ then $$a_n\to 0$$ as $$n\to\infty$$ because of the absolute value in the definition $$(1)$$.