Understanding Modulus: Positive, Negative, and the Result

In summary, the conversation discusses the concept of modulus and its application to negative numbers. It is proven that mod(xy)=mod(x)mod(y) when both x and y are negative, by using the definition of modulus for negative numbers. The conversation also addresses the difference between mod(x) and -mod(x) and the need to use the precise definition to prove the equation.
  • #1
garyljc
103
0
hi all,
i was studying modulus when i came across this mod(xy) = modx mod y
we consider 3 cases
whereby both positive , both negative, or positive negative

it reads here if we consider x and y to be negative
it will be something like this

mod xy = xy = - mod x ( - mod y ) = mod x mod y
therefore proven

i do not understand why it is -mod x and -mod y
i know that it says that x and y has to be negative
but isn't -mod x different from mod x ? eg if x is 2 , -mod x will be -2 , and mod x will be 2
correct me if I'm wrong
i'm lost
thanks
 
Mathematics news on Phys.org
  • #2
If x is negative, then mod(x)=-x. So what you've got there is that we've noted

x = -(-x)
y = -(-y)

Hence

xy = (-(-x))(-(-y)) = (-mod x)(=mod y)

if x,y <0.

And, yes mod(x) and -mod(x) are obviously different, so you're correct there.
 
  • #3
hey matt ,
but according to the proof
it's mod xy = xy = - mod x ( - mod y ) = mod x mod y

why can't it be
mod xy = xy = mod x mod y
why does it have to have an additional -mod x (-mod y) ?
 
  • #4
garyljc said:
hey matt ,
but according to the proof
it's mod xy = xy = - mod x ( - mod y ) = mod x mod y

why can't it be
mod xy = xy = mod x mod y
why does it have to have an additional -mod x (-mod y) ?

Because both x and y are negative and not equal to mod x or mod y respectively, but to -mod x and -mod y.
 
  • #5
garyljc said:
hey matt ,
but according to the proof
it's mod xy = xy = - mod x ( - mod y ) = mod x mod y

why can't it be
mod xy = xy = mod x mod y
why does it have to have an additional -mod x (-mod y) ?

Those equalities many (and indeed do) hold, but you want to *prove* that they do. So you have to use the *definition* of modulus for -ve numbers, rather than just writing what you want to be true, i.e. go the extra mile and make things explicit.

Think of it this way: you know that mod(x)=-x if x<0, now you want to show, using this knowledge, that if x,y<0, then mod(xy)=mod(x)mod(y).

Since x and y are less than 0, xy>0, so mod(xy)=xy.

Now, mod(x)=-x and mod(y)=-y, thus mod(x)mod(y)=(-x)(-y)=xy, so all is fine.

All the proof does is put those things together in one line.
 
  • #6
What definition of "modulus" are you using?. It seems to me that to prove something that fundamental you would want to use the precise definition.
 

1. What is modulus?

Modulus, denoted by the symbol %, is a mathematical operation that calculates the remainder after division. It is used to determine the "leftover" value when one number is divided by another.

2. How does modulus work with positive numbers?

When using modulus with positive numbers, the result is simply the remainder after division. For example, 10 % 3 would result in a remainder of 1, as 10 divided by 3 equals 3 with a remainder of 1.

3. What happens when the modulus operation is performed on negative numbers?

When using modulus with negative numbers, the result can be a bit more complex. The sign of the result is determined by the sign of the divisor (the number being divided by). For example, -10 % 3 would result in a remainder of -1, as -10 divided by 3 equals -3 with a remainder of -1.

4. Can the result of modulus ever be negative?

Yes, the result of modulus can be negative if the divisor is negative. In this case, the remainder will also be negative, but it will be one less than the divisor. For example, 10 % -3 would result in a remainder of -2, as 10 divided by -3 equals -3 with a remainder of -2.

5. How is modulus useful in programming?

Modulus is commonly used in programming to determine if a number is even or odd, as the remainder will be 0 for even numbers and 1 for odd numbers. It is also useful for determining if a number is divisible by another number, or for creating patterns or cycles in code.

Similar threads

Replies
5
Views
2K
  • General Math
Replies
12
Views
2K
  • Linear and Abstract Algebra
Replies
11
Views
1K
  • General Math
Replies
3
Views
1K
Replies
3
Views
2K
  • General Math
Replies
12
Views
4K
  • Calculus and Beyond Homework Help
Replies
11
Views
1K
Replies
5
Views
713
Replies
17
Views
2K
  • General Math
Replies
1
Views
1K
Back
Top