Show that the square of any positive integer is either of the form 4q or 4q + 1 for some integer q.

By Euclid’s Lemma, b = a × q + r, 0 ≤ r < a


Here, b is any positive integer.


Let a be an arbitrary positive integer. Then corresponding to the positive integers a and 4, there exist non-negative integers m and r, such that


a = 4m + r, where 0 ≤ r < 4


Squaring both the sides using (a + b)2 = a2 + 2ab + b2


a2 = (4m + r)2 = 16m2 + 8mr + r2


Case I When r = 0 we get


a2 = 16m2 which is an integer.


Case II When r = 1 we get


a2 = 16m2 + 1 + 8m


a2 = 4(4m2 + 2m) + 1 = 4q + 1


where q = (4m2 + 2m) in an integer.


Case III When r = 2 we get


a2 = 16m2 + 4 + 16m


a2 = 4 (4m2 + 4m + 1) = 4q


where q = (4m2 + 4m + 1) is an integer.


Case IV When r = 3 we get


a2 = 16m2 + 9 + 24m = 16m2 + 24m + 8 + 1


a2 = 4 (4m2 + 6m + 2) + 1 = 4q + 1


where q = (4m2 + 6m + 2) is an integer.


Hence, the square of any positive integer is either of the form 4q or 4q + 1 for some integer q.


1