Solving Equations With Modulos

In summary, the conversation discusses the general methods for solving equations of the form a+bx = mod(c+dx, m), where mod is the modulo function that resets the argument to zero when it reaches m. The solution also satisfies 0 = mod(c-a+(d-b)x, m) or, in a more conventional notation, f=g x mod m where f=a-c and g=d-b. It is noted that all solutions that satisfy 0<=a+bx<m are solutions to the initial equation. The conversation also clarifies the use of notation and the unexpected consideration of x as a real number. The use of addition as a group is mentioned, but the specific addition operation used in this case is different from the conventional one
  • #1
madness
815
70
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.
 
Mathematics news on Phys.org
  • #2
Every solution of that equation will also satisfy 0 = mod(c-a+(d-b)x, m), or, in a more conventional notation, f=g x mod m where f=a-c and g=d-b. 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
I don't 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.
 
Last edited:
  • #4
Unless you moved terms to the other side, which I didn't think was allowed.
It is.

0 = mod(c-a+(d-b)x, m)
switch notation
0 = c-a+(d-b)x mod m
add a-c (for mathematical details: you can do this as addition is a group in Z/nZ, and it works for non-integer values as well)
a-c = (d-b)x mod m

Note that "mod m" refers to the whole equation in mathematics. It is used differently in programming languages.

I should be clear here that I'm considering x as a real number and not necessarily and integer here.
No, this is not clear, and really unexpected in modular expressions. It is not a problem, however: it might change the general methods to solve f=gx mod m, but it does not change the other parts.
 
  • #5
mfb said:
It is.

0 = mod(c-a+(d-b)x, m)
switch notation
0 = c-a+(d-b)x mod m
add a-c (for mathematical details: you can do this as addition is a group in Z/nZ, and it works for non-integer values as well)
a-c = (d-b)x mod m

Addition is a group, but the addition operation follows the rule

add(x,y) = x+y-m*floor((x+y)/m),

which you didn't follow. Is this not the case?

No, this is not clear, and really unexpected in modular expressions. It is not a problem, however: it might change the general methods to solve f=gx mod m, but it does not change the other parts.

Well it should be pretty clear now that I've stated it explicitly. I'm working on a specific scientific problem and don't have the luxury of choosing all of the details of the problem.
 
  • #6
madness said:
Addition is a group, but the addition operation follows the rule

add(x,y) = x+y-m*floor((x+y)/m),

which you didn't follow. Is this not the case?
My steps follow the calculation mod m, the expression via division and floor is not useful here.
 
  • #7
Ok I'm starting to see where you're coming from now. However, I still don't 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.
 
Last edited:
  • #8
Looks correct.
 

1. What is a modulo in an equation?

A modulo, denoted by the symbol %, is a mathematical operation that calculates the remainder after dividing two numbers. For example, 7 % 3 would result in a remainder of 1 since 7 divided by 3 is 2 with a remainder of 1.

2. How do I solve equations with modulos?

To solve an equation with a modulo, you would first simplify the equation by performing any necessary operations (e.g. addition, subtraction, multiplication, division). Then, you would apply the modulo operation to both sides of the equation to find the values that satisfy the equation.

3. What are the rules for solving equations with modulos?

There are a few rules to keep in mind when solving equations with modulos:

  • The modulo operation only works with integer numbers.
  • The result of a modulo operation can only be between 0 and the divisor (not including the divisor).
  • The order of operations still applies, so solve any operations inside parentheses first.

4. Can you provide an example of solving an equation with a modulo?

Sure, let's say we have the equation 4x + 3 % 5 = 2. First, we would simplify the equation by subtracting 3 from both sides to get 4x % 5 = -1. Then, we can solve for x by finding the remainder when -1 is divided by 4 (since 4x % 5 is equivalent to x % 5). The remainder would be 3, so x = 3.

5. How can solving equations with modulos be applied in real life?

Modulo operations are often used in computer programming to determine if a number is even or odd, or to find the remainder of a division. They can also be used in cryptography to create secret codes and in music theory to calculate musical intervals or scales.

Similar threads

Replies
1
Views
621
Replies
5
Views
1K
Replies
6
Views
2K
  • General Math
Replies
13
Views
1K
Replies
4
Views
2K
  • General Math
Replies
1
Views
798
  • General Math
Replies
11
Views
1K
  • General Math
Replies
16
Views
3K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
Replies
9
Views
1K
Back
Top