Equation with modulus

  • B
  • Thread starter hugo_faurand
  • Start date
  • Tags
    Modulus
In summary, the equation (a/(bx)) mod 2 = 0 means that for some nonzero integer k, x=a/(2bk). For each k, there will be a different solution for x. The value of x can be expressed as x=a/(4b) when k=2.
  • #1
hugo_faurand
62
10
Hello everyone!
I'd like to know if it's possible to solve an equation with a modulus like this one :

$$ ( \frac{200}{15x}) mod 2 = 0 $$

Thanks in advance.
Regards!
 
Mathematics news on Phys.org
  • #2
Sure. It means that ##\frac{200}{15\,x}=2k## for some nonzero integer ##k##. For each ##k## there will be a different solution ##x##.
 
  • #3
  • #4
hugo_faurand said:
Mmmmmh. I don't really understand. What is k? Does it mean that the solution is a kind of pair like in a 2 unknown equation?

Is ##x## supposed to be an integer? Or any real number?
 
  • #5
PeroK said:
Is ##x## supposed to be an integer? Or any real number?
Normally it's an integer. Does it change something to solve the equation?
 
  • #6
hugo_faurand said:
Normally it's an integer. Does it change something to solve the equation?

Have you looked for integer solutions?

Hint: 15 has a factor of 3.
 
  • #7
z mod 2 = 0 means z is an integer multiple of 2. In other words, there has to be an integer k such that z=2k. That's where the expression in post 2 comes from.

If x is an integer, then 200/(15x) won't be one.
 
  • #8
The solution is [itex]x=1\mod 2[/itex]. If [itex]x=0\mod 2[/itex] then [itex]\frac{200}{15x}[/itex] is undefined[itex]\mod 2[/itex] (so not a solution according to Russell's theory of definite descriptions).

This assumes you are looking for solutions in the field of integers [itex]\mod 2[/itex], so there are but two possible solutions. The equation reduces to [tex]\frac{0}{x}=0\mod 2[/tex]As in any field any nonzero element is a solution of this equation.
 
Last edited:
  • #9
@Martin Rattiqan: None of that is right.
As you can easily verify, x=1 for example is not a solution, but you claim it would be.
200/(15x) is well-defined for x=2 and you can consider 200/(15x) mod 2 while x=0 mod 2 is satisfied.
Martin Rattigan said:
This assumes you are looking for solutions in the field of integers mod 2
Why would you assume that?
Martin Rattigan said:
The equation reduces to
You can't reduce equations like that.
 
  • #10
mfb said:
@Martin Rattiqan: None of that is right.

It's not right according to the interpretation that @hugo_faurand probaby has in mind, where mod 2 arithmetic is considered an algorithm performed on the integers.

However, from the more advanced viewpoint of talking about ##\mathbb{Z}/(2 \mathbb{Z}) ## we have that the notation "200" represents the coset ## [200]= [0] = \{...-4,-2,0,2,4,...\}## and it is indeed true that ##[200]/([15][x] )= [0]/([1] [x])##. Whether to call that "reduction" could be debated. It's also true that letting ##[x] = [1]## gives us ##[0]/([1][1]) = [0]/[1] = [0][1]^{-1} = [0][1] = [0]##.

So if @Martin Rattigan errs ,he errs only in taking a more advanced viewpoint that the original poster.
 
  • #11
Mmmmh it's a quite interesting debate. But to give a context I'd like to know if I can have an expression of x with this equation :
$$ \frac{a}{bx} \mod 2 = 0 $$
In case of I'm not clear enough, I want an equation which looks like that :
$$ x =
\text{something with b and a }
$$
 
  • #12
hugo_faurand said:
Mmmmh it's a quite interesting debate.
The only subject for debate is the meaning of your question.
But to give a context I'd like to know if I can have an expression of x with this equation :
$$ \frac{a}{bx} \mod 2 = 0 $$
Notation, by itself, does not specify a context.

Instead of "have an expression of x", you probably mean to ask whether a certain equation "has a solution for x".

Defining the meaning of your notation "##\frac{a}{bx} \mod 2 = 0##" requires some words.

For example, what is your interpretation of "##\mod 2##"? By some interpretations of "##\mod 2##" it is correct to write "##4 = 0 \mod 2##" because, in that context, the relation "=" is not the ordinary equivalence relation for numbers.

A different interpretation is that "## \frac{c}{d} \mod 2##" denotes an operation on two numbers ##c,d## that is performed by taking the positive remainder after c is divided by d. That interpretation is not specific until you define the set of numbers that may be operated upon. For example, must c and d be integers?

If you don't know the meaning of your notation "##\frac{a}{bx} \mod 2##", perhaps you can tell us where you saw this notation. What book? What course?
 
  • #13
Assuming "mod 2" as operator does what e.g. computers would do (find a value from 0 inclusive to 2 exclusive that differs by an integer multiple of 2 from the input), see post 2: There is a k such that a/(bx) = 2k. Now we can solve for x in the usual way: x=a/(2bk). Every integer k apart from zero will lead to a solution for x. As an example, k=2 leads to x=a/(4b), if we plug that into the original equation we get a/(b*(a/4b) mod 2 = 4 mod 2 = 0 on the left hand side, which is indeed equal to zero.
 
  • #14
Stephen Tashi said:
The only subject for debate is the meaning of your question.

Notation, by itself, does not specify a context.

Instead of "have an expression of x", you probably mean to ask whether a certain equation "has a solution for x".

Defining the meaning of your notation "##\frac{a}{bx} \mod 2 = 0##" requires some words.

For example, what is your interpretation of "##\mod 2##"? By some interpretations of "##\mod 2##" it is correct to write "##4 = 0 \mod 2##" because, in that context, the relation "=" is not the ordinary equivalence relation for numbers.

A different interpretation is that "## \frac{c}{d} \mod 2##" denotes an operation on two numbers ##c,d## that is performed by taking the positive remainder after c is divided by d. That interpretation is not specific until you define the set of numbers that may be operated upon. For example, must c and d be integers?

If you don't know the meaning of your notation "##\frac{a}{bx} \mod 2##", perhaps you can tell us where you saw this notation. What book? What course?

For me "x mod 2" is like dividing x by 2 and take the rest of the division.

mfb said:
Assuming "mod 2" as operator does what e.g. computers would do (find a value from 0 inclusive to 2 exclusive that differs by an integer multiple of 2 from the input), see post 2: There is a k such that a/(bx) = 2k. Now we can solve for x in the usual way: x=a/(2bk). Every integer k apart from zero will lead to a solution for x. As an example, k=2 leads to x=a/(4b), if we plug that into the original equation we get a/(b*(a/4b) mod 2 = 4 mod 2 = 0 on the left hand side, which is indeed equal to zero.
Why a value from 0 inclusive to 2 exclusive ?
 
  • #15
hugo_faurand said:
Why a value from 0 inclusive to 2 exclusive ?
That's what computers will usually do. Here is python, for example:

>>> 2%2
0
>>> 3.141%2
1.141
>>> -1%2
1
>>> -5.5%2
0.5
 
  • #16
mfb said:
That's what computers will usually do. Here is python, for example:

>>> 2%2
0
>>> 3.141%2
1.141
>>> -1%2
1
>>> -5.5%2
0.5

OK but now I have two unknowns k and x .SO How can I solve it ?
 
  • #17
See above. There are many values of x that satisfy the equation, one for every k.
 
  • #18
mfb said:
That's what computers will usually do. Here is python, for example:

>>> 2%2
0
>>> 3.141%2
1.141
>>> -1%2
1
>>> -5.5%2
0.5
But if you run

<p id="a">
<script>
function m2(exp){document.getElementById("a").innerText += (exp)%2+"\n"}
m2(2)
m2(3.141)
m2(-1)
m2(-5.5)
m2(200/(15*1))
</script>

in e.g. Chrome, javascript gives:

0
1.141
-1
-1.5
1.333333333333334

You can't rely on different computer programs to give the same answers.

Given that this is a mathematics forum rather than a programming forum I expect OP would prefer an answer conforming with generally accepted mathematics.

In this case only the odd numbered elements in my list are defined because the even numbered elements have denominators which are not relatively prime to 2.

Javascript gets the wrong answer for my fifth - it should be 0 (or rather I ask it to get the wrong answer because the "/" is interpreted as floating point division - there is no native javascript division[itex]\mod n[/itex]). Both python and Javascript get the first and third right. The answers are the same because [itex]1=-1\mod 2[/itex].
 
Last edited:
  • #19
mfb said:
See above. There are many values of x that satisfy the equation, one for every k.

But really the whole usefulness of arithmetic modulo [itex]n[/itex] is that the canonical isomorphism from [itex]\mathbb{Z}[/itex] to [itex]\mathbb{Z}/n\mathbb{Z}[/itex] allows you to ignore the [itex]k[/itex]s. There is only one value[itex]\mod 2[/itex] that satisfies OP's equation as stated in my original post.
 
Last edited:
  • #20
mfb said:
Assuming "mod 2" as operator does what e.g. computers would do (find a value from 0 inclusive to 2 exclusive that differs by an integer multiple of 2 from the input), see post 2: There is a k such that a/(bx) = 2k. Now we can solve for x in the usual way: x=a/(2bk). Every integer k apart from zero will lead to a solution for x. As an example, k=2 leads to x=a/(4b), if we plug that into the original equation we get a/(b*(a/4b) mod 2 = 4 mod 2 = 0 on the left hand side, which is indeed equal to zero.

The problem with the operator you describe is that its not very useful mathematically if it's applied to the real numbers, because it doesn't necessarily respect arithmetic in the reals. E.g.

<p id="a">
<script>
function m2(exp){document.getElementById("a").innerText += (exp)%2+"\n"}
m2(Math.sqrt(5)*Math.sqrt(5))
m2((Math.sqrt(5)%2)*(Math.sqrt(5)%2))
</script>

when run in Chrome gives

1.0000000000000009
0.055728090000841266

For any ring [itex]R[/itex] there is a canonical homomorphism from [itex]R[/itex] to [itex]R/nR[/itex] (where [itex]nR[/itex] is defined as [itex]\{r+r+\ldots+r\ (n\text{ times}):r \in R\}[/itex], which might be described as a[itex]\mod n[/itex] operator (and, of course, respects the arithmetic in [itex]R[/itex]), but if [itex]R[/itex] is a field then the quotient is either the single element ring or the field you started with depending on the field's characteristic, ergo not much use. The operator would not be the one you described in the case [itex]R=\mathbb{R}[/itex] because in that case the ring of even integers is not the ideal [itex]2\mathbb{R}[/itex].

The [itex]\mod n[/itex] notation in mathematics is usually used when [itex]R[/itex] is [itex]\mathbb{Z}[/itex] or possibly [itex]\{i/j:i,j\in \mathbb{Z}\text{ and }(j,n)=1\}.[/itex]
 
Last edited:
  • #21
Martin Rattigan said:
Javascript gets the wrong answer for my fifth - it should be 0 (or rather I ask it to get the wrong answer because the "/" is interpreted as floating point division - there is no native javascript division ##\mod n##)
JS gets many things wrong, but not that.
Check the order of operation. The mod function is evaluated on the number 200/(15*1) = 13.333... and 13.333... mod 2 = 1.333...

What you seem to want is ##\frac{200 \mod 2}{15 \mod 2}## but that is different from OP's problem.
 
  • #22
mfb said:
JS gets many things wrong, but not that.
Check the order of operation. The mod function is evaluated on the number 200/(15*1) = 13.333... and 13.333... mod 2 = 1.333...

What you seem to want is ##\frac{200 \mod 2}{15 \mod 2}## but that is different from OP's problem.

As I said in parentheses.

And yes, I want the division performed in the integers mod 2.

I assumed from OP's inclusion of "mod 2" in his equation that that was exactly the problem he wanted solved. The expression ##\frac{200}{15x}## is undefined in the ring of integers for any integral ##x##, so to obtain a solution the division must be carried out mod 2.

The result of ##\frac{200}{15x}\% 2## using the % operator in python or javascript is, apart from being inconsistent, just not useful in mathematical terms. (See my post #20.)
 
Last edited:
  • #23
I'm totally lost...
 
  • #24
Martin Rattigan said:
I assumed from OP's inclusion of "mod 2" in his equation that that was exactly the problem he wanted solved.
Why would you do that?
If you see the expression ##\frac{a}{b}+1##, you don't assume that the operation "add 1" has to be done in numerator and denominator separately either.
Martin Rattigan said:
The result of ##\frac{200}{15x}\% 2## using the % operator in python or javascript is, apart from being inconsistent, just not useful in mathematical terms. (See my post #20.)
It is consistent and it leads to a non-trivial result. Your interpretation is inconsistent and leads to a trivial result only.
hugo_faurand said:
I'm totally lost...
You could help us by clarifying how the question was meant. What exactly does the "mod 2" there mean? How was it introduced, how was it used in previous problems?
 
  • #25
mfb said:
Why would you do that?
If you see the expression ##\frac{a}{b}+1##, you don't assume that the operation "add 1" has to be done in numerator and denominator separately either.It is consistent and it leads to a non-trivial result. Your interpretation is inconsistent and leads to a trivial result only.You could help us by clarifying how the question was meant. What exactly does the "mod 2" there mean? How was it introduced, how was it used in previous problems?

I'd like to solve a problem that you can find here https://www.codingame.com/training/medium/aneo . To sum up it, you have to find the max speed which a car can have to cross a road whithout stop at the traffic lights. Each traffic lights have only 2 "state" : red and green. And all traffic lights keep their state for x seconds (x is an integer). At the start all the traffic lights are green.I wrote my equation to know if when the car cross the traffic light the traffic light is green or red.
 
  • #26
A classical x-y-question. We wasted 25 posts discussing what your question could mean - and it turns out that it is not even your problem. It is your attempt to solve the problem, and it is unclear if that approach can work at all.
hugo_faurand said:
I wrote my equation to know if when the car cross the traffic light the traffic light is green or red.
From the problem website I guess 200 is the distance and 15 is the period. What do you expect from solutions to the equation? Note that just a few specific values of x will solve it, but a large range of speeds will work for a given traffic light.
 
  • #27
mfb said:
A classical x-y-question. We wasted 25 posts discussing what your question could mean - and it turns out that it is not even your problem. It is your attempt to solve the problem, and it is unclear if that approach can work at all.From the problem website I guess 200 is the distance and 15 is the period. What do you expect from solutions to the equation? Note that just a few specific values of x will solve it, but a large range of speeds will work for a given traffic light.
I thought that I can find the ideal speed with this equation where x is the speed :

$$ \frac{distance}{x duration} mod 2 = 0$$

distance is the distance from the start. Distance and duration are integers.
 
  • #28
Why mod 2 and then equals 0?
The highest speed allowed by a single traffic light would be "as fast as the car can go".
The lowest speed to still catch the first green light is distance/duration.
What is the fastest speed to catch the second green light?
What is the lowest speed to catch the second green light?
Can you construct allowed speed intervals from that?
 
  • #29
mfb said:
Why mod 2 and then equals 0?
The highest speed allowed by a single traffic light would be "as fast as the car can go".
The lowest speed to still catch the first green light is distance/duration.
What is the fastest speed to catch the second green light?
What is the lowest speed to catch the second green light?
Can you construct allowed speed intervals from that?

I want to do an interval. But I thought that I can find speeds for the interval with that. Mod 2 is here to know if the traffic light is green or red.
 
  • #30
hugo_faurand said:
Mod 2 is here to know if the traffic light is green or red.
How exactly do you expect this to work?
 

1. What is an equation with modulus?

An equation with modulus, also known as an absolute value equation, is an equation that contains an absolute value expression. This means that the variable within the absolute value must be positive, regardless of its original sign.

2. How do you solve an equation with modulus?

To solve an equation with modulus, you must isolate the absolute value expression and set it equal to both the positive and negative value of the other side of the equation. Then, solve for the variable in both equations to find the possible solutions.

3. Can an equation with modulus have more than one solution?

Yes, an equation with modulus can have more than one solution. This is because the absolute value expression can be equal to both the positive and negative value of the other side of the equation, resulting in two possible solutions.

4. What is the difference between an equation with modulus and an inequality with modulus?

An equation with modulus is an equality statement, meaning the two sides of the equation are equal. In contrast, an inequality with modulus is a statement of inequality, meaning the two sides are not necessarily equal.

5. How are equations with modulus used in real life?

Equations with modulus are used in various real-life situations, such as calculating distances, determining the range of possible values for a given scenario, and solving optimization problems. They are also commonly used in engineering, physics, and economics.

Similar threads

Replies
5
Views
2K
Replies
3
Views
932
Replies
5
Views
685
  • General Math
Replies
10
Views
1K
  • Precalculus Mathematics Homework Help
Replies
14
Views
156
Replies
1
Views
741
  • Materials and Chemical Engineering
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
  • Other Physics Topics
Replies
24
Views
660
Replies
7
Views
39K
Back
Top