How to Solve for Integers Modulo n?

  • Thread starter JJKorman1
  • Start date
  • Tags
    Integers
In summary, when given an integer p and a modulus n, to solve for a in the equation a=p mod(n), you need to find the remainder on dividing p by n. If the remainder is already between 0 and n-1, then that is your solution. Otherwise, you need to find the largest multiple of n that is less than p, and the remainder will be the difference between p and that multiple. This can also be thought of as finding the hour on a 12 hour clock that corresponds to the given number.
  • #1
JJKorman1
4
0
I understand how to solve: a=12mod7 => a = 5, I think, however,
how do you solve for a=7mod12 ?
Stumped :eek:
 
Physics news on Phys.org
  • #2
When you say solve, is what you mean is given an integer p find an integer q with 0<=q<n and p==q mod(n) as 7 is between 0 and 11 it solves itself, if you will.
 
  • #3
Do not understand your response:

if a=12mod7 yields a=5: 5 is the remainder however,
if a=7mod12 what is a? & how do I get there?

Thanks,

JimK
 
  • #4
How ling did you spend trying to understand the answer I gave? a=7 is, shall we say, in the reduced form. The remainder after dividing 7 by 12 is 7.

As it stands, when you say solve a=p mod(n) you are not using a well defined phrase. What you might ought to mean is find the remainder on division by n of p, but that isn't immediately obvious from what you wrote. That is, and I realize I'm just restating what I orginally wrote, find the a with 0<=a<n that is the remainder on dividing by n of p. If a is already in that range you are done.

Remember these aren't equals signs, they are equivalences.
 
  • #5
12 mod 7 == 5 bacause 5 is the difference when you find the largest multiple of 7 that is less than 12 (i.e., 7 itself).

To find what 7 mod 12 is, note that 0 is a multiple of any number. So, now, 0 is the largest multiple of 12 that lies just below 7, and the remainder is 7 itself.

This should be obvious from the reasoning that you are asking what hour 7 refers to on a 12 hr clock.
 

1. What are Integers Modulo n?

Integers Modulo n, also known as modular arithmetic, is a mathematical concept that deals with the remainder of division of integers by a positive integer n. It is denoted by the symbol "mod", and is used to find patterns and solutions in number systems.

2. How is modular arithmetic used in real-life situations?

Modular arithmetic has many practical applications, such as in clock systems, calculating interest rates, and cryptography. It can also be used in computer programming to efficiently store and manipulate data.

3. What are the properties of Integers Modulo n?

The properties of Integers Modulo n include closure, commutativity, associativity, distributivity, and identity. This means that when performing operations on integers modulo n, the result will always be another integer modulo n, and the order of operations does not matter.

4. How is the inverse of an integer modulo n calculated?

The inverse of an integer modulo n can be calculated using the extended Euclidean algorithm. This algorithm finds the greatest common divisor of two integers and uses it to calculate the inverse. Alternatively, the inverse can also be found by trial and error using the modular multiplicative inverse property.

5. Can every integer have a modular inverse?

No, not every integer has a modular inverse. An integer a only has a modular inverse modulo n if it is coprime to n, meaning that they share no common factors other than 1. If a and n are not coprime, then the inverse does not exist.

Similar threads

  • Linear and Abstract Algebra
Replies
25
Views
1K
Replies
1
Views
911
  • Linear and Abstract Algebra
Replies
11
Views
1K
  • Linear and Abstract Algebra
Replies
13
Views
1K
  • Linear and Abstract Algebra
Replies
33
Views
3K
Replies
9
Views
2K
Replies
5
Views
2K
  • Linear and Abstract Algebra
Replies
1
Views
584
Replies
17
Views
2K
Replies
1
Views
636
Back
Top