Register to reply 
Solving Equations With Modulos 
Share this thread: 
#1
Dec3112, 07:24 AM

P: 625

Are there general methods for solving equations of the form
a+bx = mod(c+dx, m), where, in the notation I have made up here, mod is the modulo function which resets the argument to zero when it reaches m. I hope it's clear what I mean here. 


#2
Dec3112, 10:37 AM

Mentor
P: 12,113

Every solution of that equation will also satisfy 0 = mod(ca+(db)x, m), or, in a more conventional notation, f=g x mod m where f=ac and g=db. This is a simple modular equation, and general methods to find all solutions exist.
All solutions which satisfy 0<=a+bx<m are solutions to your initial equation. 


#3
Dec3112, 10:59 AM

P: 625

I dont quite follow. When you switch from my made up notation to the real notation (sorry about that), it looks like a completely new equation. Unless you moved terms to the other side, which I didn't think was allowed. I could get a better idea of the solution by considering:
mod(x,n) = x n*floor(x/n) so that for my equations: a+bx = c+dx  m*floor((c+dx)/m) But what are the general methods for finding the solutions here? I should be clear here that I'm considering x as a real number and not necessarily and integer here. 


#4
Dec3112, 11:33 AM

Mentor
P: 12,113

Solving Equations With Modulos
0 = mod(ca+(db)x, m) switch notation 0 = ca+(db)x mod m add ac (for mathematical details: you can do this as addition is a group in Z/nZ, and it works for noninteger values as well) ac = (db)x mod m Note that "mod m" refers to the whole equation in mathematics. It is used differently in programming languages. 


#5
Dec3112, 12:11 PM

P: 625

add(x,y) = x+ym*floor((x+y)/m), which you didn't follow. Is this not the case? 


#6
Dec3112, 12:14 PM

Mentor
P: 12,113




#7
Dec3112, 12:30 PM

P: 625

Ok I'm starting to see where you're coming from now. However, I still dont know what these general methods you talk about are. Could you point me towards an explanation of the methods involved?
Edit: So x = f/g + k*m/g is the general solution for some integer k? Plus the constraint that 0<=a+bx<m. 


#8
Dec3112, 01:26 PM

Mentor
P: 12,113

Looks correct.



Register to reply 
Related Discussions  
Solving for variables using 3 different equations (simultaneous equations)  Precalculus Mathematics Homework  1  
Modulos one  Calculus  0  
Modulos raised to phi  Introductory Physics Homework  1  
Palindromes and modulos  Introductory Physics Homework  6  
Reduced residue system mod 7  Linear & Abstract Algebra  16 