I'm reading Paul Zeitz's book on problem solving and he has a problem where we need to consider $g(m)= \lfloor \sqrt{m}\rfloor$. We then need to figure out for what $b \in \Bbb R$ it holds that $$g(n^2+b)=n.$$
He then states that this holds when $0\le b < 2n+1$, but I cannot figure out how to prove this. How can I show that $$\lfloor \sqrt{n^2+b}\rfloor=n \iff 0 \le b < 2n+1?$$
\begin{align} 0\leq b<2n+1 &\iff n^2 \leq n^2+b <n^2+2n+1\\ &\iff n^2\leq n^2+b <(n+1)^2 \\ &\iff n\leq \sqrt{n^2+b} <n+1 \\ &\iff \lfloor\sqrt{n^2+b} \rfloor = n \\ \end{align}