Can a square be in the form $2x + 1$, when $x$ is odd? I was given this question, and I think I have solved it, but I'm not sure it is correct because this differs from how the answer is given. What is the most common way to solve this problem?
Let's suppose there was a square that could be written as $$2x + 1$$ x being odd. Then: $$2x + 1 = S^2$$ and $$2x = (S + 1)(S - 1)$$ and $$x = \left(\frac{S + 1}{2}\right)(S-1)$$ Now, if $x$ is odd, then $S$ must be odd too. So $S + 1$ is even, therefore $$x = N(S - 1)$$ [with] $N$ being a natural number. And since $S - 1$ is also even, we have $$x = NE.$$ A contradiction, as any number multiplied by even must be even, and $x$ is supposed to be odd.
 A: $2(2k+1)+1=4k+3\equiv 3 \pmod{4},$ but squares can only be $\equiv 0,1\pmod 4$
A: The most common way to solve this problem is with modular arithmetic: compute the squares modulo $4$ to obtain this periodic sequence: $$0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, \ldots$$ If $x$ is odd, then $2x + 1 \equiv 3 \pmod 4$, which is an impossible value for a square.
I will show you a way that is slightly more complicated than the common way but is still simple enough almost anyone can follow along: If $y$ is odd, then $(2y)^2 = 4y^2$, while $(2y + 1)^2 = 4y^2 + 4y + 1$. We can rewrite $$4y^2 + 4y + 1 = 2x + 1$$ by setting $x = 2y^2 + 2y$, but clearly this means $x$ is even, not odd as desired.
A: Your proof is almost correct. After you reach
$$
2x = (S+1)(S-1)
$$
you say that "if $x$ is odd, then $S$ must be odd too", but there is no implication here. Indeed, since $S^2 = 2x+1$ it follows that $S^2$, and thus $S$ is odd, for every $x \in \Bbb{Z}$. In turn, this means that $S+1$ and $S-1$ are even, so by the above equation $4 \mid 2x$, i.e. $2 \mid x$.

As already pointed out by others, the standard way to solve this problem is to show that the square of an integer can only be $0$ or $1$ modulo $4$ -- just take the square of $2k$ or $2k+1$, respectively -- and then that $2x + 1 \equiv 3 \pmod{4}$.
