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

#### Complete Python Prime Pack

9 Courses     2 eBooks

#### Artificial Intelligence & Machine Learning Prime Pack

6 Courses     1 eBooks

#### Java Prime Pack

9 Courses     2 eBooks

Given:

Positive integer $q$.

To do:

We have to prove that square of any positive integer is of the form  $4q$  or  $4q\ +\ 1$  for some integer \'$q$\'.

Solution:

By Euclid\'s division algorithm,

If $a$ and $b$ are two positive integers,

$a\ =\ bm\ +\ r$, where  $0\ \underline{< }\ r\ <\ b$

Let $a$ be the positive integer and $b$ is equal to 4,

$a\ =\ 4m\ +\ r$, where $0\ \underline{< }\ r\ <\ 4$,

So, $r\ =\ 0,\ 1,\ 2,\ 3$

Now,

When,  $r\ =\ 0$,

$a\ =\ 4m$

Squaring on both sides, we get:

$a^{2}\ =\ (4m)^{2}$

$a^{2}\ =\ 4(4m​^{2})$

$a^{2}\ =\ 4q$ , where $q\ =\ 4m^{2}$

When, $r\ =\ 1$,

$a\ =\ 4m\ +\ 1$

Squaring on both sides, we get:

$a^{2}\ =\ (4m\ +\ 1)^{2}$

$a^{2}\ =\ 16m^{2}\ +\ 1\ +\ 8m$

$a^{2}\ =\ 4(4m^{2}\ +\ 2m)\ +\ 1$

$a^{2}\ =\ 4q\ +\ 1$, where $q\ =\ 4m^{2}\ +\ 2m$

When,  $r\ =\ 2$,

$a\ =\ 4m\ +\ 2$

Squaring on both sides, we get:

$a^{2}\ =\ ​(4m\ +\ 2)^{2}$

$a^{2}\ =\ 16m^{2}\ +\ 4\ +\ 16m$

$a^{2}\ =\ 4(4m^{2}\ +\ 4m\ +\ 1)$

$a^{2}\ =\ 4q$, where $q\ =\ 4m^{2}\ +\ 4m\ +\ 1$

When, $r\ =\ 3$,

$a\ =\ 4m\ +\ 3$

Squaring on both sides, we get:

$a^{2}\ =\ ​(4m\ +\ 3)^{2}$

$a^{2}\ =\ 16m^{2}\ +\ 9\ +\ 24m$

$a^{2}\ =\ 16m^{2}\ +\ 24m\ +\ 8\ +\ 1$

$a^{2}\ =\ 4(4m^{2}\ +\ 6m\ +\ 2)\ +\ 1$

$a^{2}\ =\ 4q\ +\ 1$ , where $q\ =\ 4m^{2}\ +\ 6m\ +\ 2$

Hence, the square of any positive integer is in the form of 4q or $4q\ +\ 1$, where  $q$  is an integer.

Updated on 10-Oct-2022 13:27:08