Real Analysis problem concerning recursive sequence limit. Define $$a_1=1$$, and define
$$
a_{n+1} = \left\{\begin{aligned}
&a_n+1/n &&: a_n^2\leq 2\\
&a_n-1/n &&: a_n^2>2
\end{aligned}
\right.$$
I am then asked to show that $$|a_n-\sqrt{2}|<2/n$$ for all indices n in order to show convergence by comparison.
My initial thought was to use induction but my algebra during the inductive step doesn't go very far. Any thoughts would be greatly appreciated.
 A: Induction works. Suppose $|a_n - \sqrt 2| < 2/n$, i.e.
\begin{equation*}
(1) \quad \sqrt 2 - 2/n < a_n < \sqrt 2 + 2/n.
\end{equation*}
There are two cases:
Case 1. If $a_n^2 \le 2$, i.e. $a_n \le \sqrt 2$, we can refine (1) to
\begin{equation*}
\sqrt 2 - 2/n < a_n \le \sqrt 2.
\end{equation*}
And we have $a_{n + 1} = a_n + 1/n$, so by adding $1/n$ to this inequality, we get
\begin{equation*}
\sqrt 2 - 1/n < a_{n + 1} \le \sqrt 2 + 1/n,
\end{equation*}
i.e. $|a_{n + 1} - \sqrt 2| < 1/n$.
Case 2. If $a_n^2 \ge 2$, i.e. $a_n \ge \sqrt 2$, we can refine (1) to
\begin{equation*}
\sqrt 2 < a_n \le \sqrt 2 + 2/n.
\end{equation*}
And we have $a_{n + 1} = a_n - 1/n$, so by subtracting $1/n$ from this inequality, we get
\begin{equation*}
\sqrt 2 - 1/n < a_n \le \sqrt 2 + 1/n,
\end{equation*}
i.e. $|a_{n + 1} - \sqrt 2| < 1/n$.
Either way, we have $|a_{n + 1} - \sqrt 2| < 1/n$. And for all $n \ge 1$, we have $1/n \le 2/(n + 1)$.
(Proof of the last inequality:
\begin{equation*}
2/(n + 1) - 1/n = (2n - n - 1)/(n(n + 1)) = (n - 1)/(n^2 + n),
\end{equation*}
which is nonnegative).
