Proving Modular Arithmetic for x^2 = 0 or 1 (mod 4)

In summary: For any number in $\Bbb Z$ it is either even or odd. We have shown that if it is even, then it is a multiple of 4, and if it is odd, then it is one more than a multiple of 4. This covers all cases and concludes the proof.For the second part, you are on the right track. You can start by stating that considering $x^2 + y^2$ modulo 4, you can assume that $x$ and $y$ are either even or odd, as we proved in the first part. Then, you can show that in all cases, $x^2 + y^2$ modulo 4 can only be 0, 1, or
  • #1
cocoabeens
6
0
Hello, new to the forums here.

I need to prove that for all integers x, x^2 = 0(mod4) or x^2 = 1(mod4).

I started out by making a table of different cases.

case 1: y=0 ->0mod4
case 2: y=1 ->1mod4
case 3: y=2 ->0mod4
...
case odd: y=2n ->0mod4
case even: y=2n+1 ->1mod4

From here, I'm not quite sure how to say in words the rest of the proof.
In the next part, I use what's proved above to prove that x^2 + y^2 = 5003 doesn't have any integer solutions. I wasn't quite sure how to start this one.

Do I need to solve for two cases, where I assume x is odd in the first, and even in the second? I'm not sure how to use the Y^2 value at all.

I'd appreciate how to get the ball rolling on this one. Thanks so much in advance!
 
Physics news on Phys.org
  • #2
Hi and welcome to the forum!

cocoabeens said:
case 1: y=0 ->0mod4
case 2: y=1 ->1mod4
case 3: y=2 ->0mod4
...
case odd: y=2n ->0mod4
case even: y=2n+1 ->1mod4

From here, I'm not quite sure how to say in words the rest of the proof.
Each integers is either even or odd, and in both cases you proved the statement. This concludes the proof. If you've covered residue classes, then you can work within $\Bbb Z_4$. Each integer is in one of the classes 0, 1, 2 or 3 modulo 4, so it is enough to check the claim only for these four values.

cocoabeens said:
In the next part, I use what's proved above to prove that x^2 + y^2 = 5003 doesn't have any integer solutions. I wasn't quite sure how to start this one.
Consider $x^2 + y^2$ modulo 4. It is the sum of $x^2$ modulo 4 and $y^2$ modulo 4. Each of these values is either 0 or 1, so $x^2 + y^2$ modulo 4 equals 0, 1 or 2, but not 3, which is 5003 modulo 4.
 
  • #3
Thanks for the response!

So for the first part, I was told that I need to deliver a formal proof, and that a table going over the cases was an insufficient proof. Would a formal proof be something like this-

"Based on the table (of cases), we have shown that for all integers x,if x is even, it will always be 0mod4, and if x is odd, it will always be 1mod4." Or is that not a sufficient enough statement?For the second part, I'm still a little confused- do I start out saying that x^2+y^2 modulo 4 =5003mod4, the left side being the sum of x^2mod4 and y^2mod4, and I can assume that y will also always be either 1mod4 or 0mod4 as well because it is also an integer? And then because x^2 and y^2 are both equal to 0 or 1, it will never be 3 = 5003mod4?
 
  • #4
It is $x^2$ that will be 0 mod 4 if $x$ is even. This is because any even number squared is a multiple of 4:

$(2k)^2 = 4k^2$.

On the other hand, it is easy to see that:

$(2k+1)^2 = 4k^2 + 4k + 1 = 4(k^2 + k) + 1$

which is clearly 1 mod 4, for $x$ odd. So the only possibilities are:

$x^2 + y^2 = 0 + 0 = 0$ mod 4,
$x^2 + y^2 = 0 + 1 = 1$ mod 4,
$x^2 + y^2 = 1 + 0 = 1$ mod 4,
$x^2 + y^2 = 1 + 1 = 2$ mod 4.

You could expand this to (for example, in the second case):

$x$ even, $y$ odd means that:

$x = 2k, y = 2m+1$, so that:

$x^2 + y^2 = 4k^2 + 4m^2 + 4m + 1 = 4(k^2 + m^2 + m) + 1$.

Clearly $k^2 + m^2 + m$ is an integer if $k,m$ are. So if:

$x^2 + y^2 = 5003$, in the case that $x$ is even, and $y$ is odd, we have:

$x^2 + y^2 = 4t + 1 = 5003$, for some integer $t$.

Now 5003 = 4*1250 + 3, so if:

$4t + 1 = 4(1250) + 3$ we have:

$4(t - 1250) = 2$, which implies 2 is a multiple of 4, a contradiction

(equivalently, we have that the integer $t - 1250 = \dfrac{1}{2}$).

Personally, I take issue with the notion that a "proof by cases" is not "formal enough", an idea I find absurd.
 
  • #5
cocoabeens said:
"Based on the table (of cases), we have shown that for all integers x,if x is even, it will always be 0mod4, and if x is odd, it will always be 1mod4."
For this proof, you only need to consider the cases where x is even and x is odd. You don't have to consider separately x = 0, x = 1 and x = 2, which you did in post #1. Correspondingly, you don't really build a table of cases, but consider two possible options.
 

FAQ: Proving Modular Arithmetic for x^2 = 0 or 1 (mod 4)

What is modular arithmetic?

Modular arithmetic is a system of arithmetic that deals with integers and their remainders after division by a fixed integer, known as the modulus. It is used to solve problems involving repeating patterns, such as finding the day of the week for a given date or encrypting messages.

How is modular arithmetic used in cryptography?

Modular arithmetic is used in cryptography to encrypt and decrypt messages. The modulus is chosen to be a very large prime number, making it difficult to find the original message without knowing the private key. By using modular arithmetic, the encrypted message appears as a random string of numbers, making it nearly impossible to decipher without the key.

What is the difference between congruence and equality in modular arithmetic?

In modular arithmetic, congruence is a relation between two numbers where their difference is divisible by the modulus. For example, 7 is congruent to 19 (mod 6) because 19-7 = 12, and 12 is divisible by 6. Equality, on the other hand, means that two numbers have the same value without any consideration of the modulus.

How is modular arithmetic used in computer science?

Modular arithmetic is used in computer science in various applications, such as hashing algorithms, error-correcting codes, and data compression. It is also used in computer graphics and computer simulations to create repeating patterns and animations.

What is the significance of Fermat's Little Theorem in modular arithmetic?

Fermat's Little Theorem states that for any prime number p, and any integer a not divisible by p, a^(p-1) is congruent to 1 (mod p). This theorem is essential in cryptography as it allows for the efficient computation of large modular exponents. It is also used in primality testing algorithms to determine if a number is prime.

Similar threads

Replies
4
Views
2K
Replies
1
Views
1K
Replies
3
Views
2K
Replies
6
Views
143
Replies
7
Views
2K
Replies
1
Views
2K
Replies
6
Views
2K
Back
Top