Proposition. [01BA]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
The square of any integer is congruent to either 0 or 1 modulo 4.
Interpretation.
- September 25, 2026
- Marcelo Fiore, Jon Sterling
Scratch work.
- September 25, 2026
- Marcelo Fiore, Jon Sterling
Given an integer n, we might try to prove the goal (n^2\equiv 0\mod 4) \lor (n^2\equiv 1\mod 4) right away. Unfortunately, we just don’t have enough information to proceed! Indeed, if we try to open “door #1” and prove n^2\equiv 0\mod 4, we are definitely going to go wrong because it’s not the case that 1^2 \equiv 0\mod 4. On the other hand, if we try to open “door #2” and prove n^2\equiv 1\mod 4, we are going to go wrong because it is not the case that 0^2 \equiv 1\mod 4.
So we need some additional information before we can make our choice. In the examples we considered, we note that 0 is even and 1 is odd. Could it be that we need to branch on whether n is even or odd?
We know, indeed, that every integer is either even or odd; so we may assume \mathsf {isEven}(n)\lor \mathsf {isOdd}(n) and then we may use this assumption and proceed by cases on whether n is even or odd: then, perhaps, when n is even we should try to show its square is congruent to 0, and when n is odd we should try to show that its square is congruent to 1. Before we try and write out the whole proof, let’s just try these cases and see if they work out.
Lemma [01B5]
- September 25, 2026
- Jon Sterling
The square of any even integer is congruent to 0 modulo 4.
Proof.
- September 25, 2026
- Jon Sterling
Let n be even so that we have some integer k with n=2k. We want to see that n^2\equiv 0\mod 4, which is to say that 4\mid n^2. We compute:
n^2 = (2k)^2 = 4k^2Evidently 4\mid 4k^2, so we are done.
Lemma [01B6]
- September 25, 2026
- Jon Sterling
The square of any odd integer is congruent to 1 modulo 4.
Proof.
- September 25, 2026
- Jon Sterling
Let n be odd so that we have some integer k with n=2k+1. We want to see that n^2 \equiv 1 \mod 4, which is to say that 4\mid n^2-1. We compute:
\begin {aligned} n^2-1 &= (2k+1)^2 - 1 \\ &= 4k^2 + 4k + 1 - 1 \\ &= 4k^2 + 4k \\ &= 4(k^2 + k) \end {aligned}4(k^2+k) is evidently divisible by 4, so we are done.
Since that worked, we can now proceed to write out a proper proof of the whole proposition.
Proof.
- September 25, 2026
- Marcelo Fiore, Jon Sterling