Is (ka)mod kb Equal to k(a mod b)?

  • Thread starter Apteronotus
  • Start date
In summary: It seems that the correct answer is indeed "yes", as (ka) mod (kb) = a mod b. This can be proven using the remainder theorem or the Euclidean algorithm. In summary, the remainder when ka is divided by kb is equal to the remainder of a divided by b, making the statement (ka) mod (kb) = a mod b true.
  • #1
Apteronotus
202
0
Hi

Just a simple Mod question.

Is (ka)mod kb = k(a mod b)?

Thanks
 
Mathematics news on Phys.org
  • #2
(ka) mod kb is the remainder when ka is divided by kb. Obviously, ka/kb= a/b and so has the same remainder as a divided by b. Therefore, the answer to your question is "no". What is true is that (ka) mod kb= a mod b.
 
  • #3
perhaps a counter example to your reply...

15 mod 9 = 6
5 mod 3 = 2
but
3(5 mod 3) = 6
 
  • #4
Yes I do believe I am correct. Suppose
ka mod kb = c
and
a mod b = d
then this means that
ka = Z(kb)+c
and
a = Z(b)+d
where Z is an integer
Hence c/k=d, and if this is true then
ka mod kb = c = kd = k(a mod b)

Thank you for your reply anyway.
 
  • #5
Apteronotus said:
Yes I do believe I am correct. Suppose
ka mod kb = c
and
a mod b = d
then this means that
ka = Z(kb)+c
and
a = Z(b)+d
where Z is an integer
Hence c/k=d, and if this is true then
ka mod kb = c = kd = k(a mod b)

Thank you for your reply anyway.

This is a special case.
[itex]ka=Z(kb)+c[/itex] and [itex]a=Z'(b)+d[/itex],where[itex]Z,Z'\in\mathbb Z[/itex]
But generally,[itex]Z\not =Z'[/itex]
 
Last edited:
  • #6
kntsy said:
This is a special case.
[itex]ka=Z(kb)+c[/itex] and [itex]a=Z'(b)+d[/itex],where[itex]Z,Z'\in\mathbb Z[/itex]
But generally,[itex]Z\not =Z'[/itex]

No I don't think so.

We have
ka=(kb)Z+c where 0<c<kb
and
a = bZ'+d where 0<d<b
multiplying the second equation by k we arrive at
ka = kb Z' +kd
so
kb Z +c = kb Z'+kd
kb(Z-Z')=kd-c
(Z-Z')=(kd-c)/kb
Hence the right hand side must be an integer. But since both kd and c are in (0,kb), the distance between them kd-c cannot be larger than kb. so it must be zero.
Giving us Z=Z'
 
  • #7
First, your equality can only be valid for [itex]k\geq 0[/itex]. Second, everyone seems to be forgetting the remainder theorem: for b,a in Z, there are unique integers q and r, such that:
[tex]
b = aq + r, 0 \leq r <\left|a\right|
[/tex]

Therefore:
[tex]
b=aq + r \Rightarrow kb = \left(ka\right)q + kr
[/tex]

But, as [itex]0 \leq r <\left|a\right|[/itex] and [itex]k \geq 0[/itex] then [itex]0 \leq kr <\left|ka\right|[/itex], which means that (by uniqueness) kr is the remainder of kb divided by ka, hence:

(kb mod ka) = kr = k(a mod b), [itex]k\geq 0[/itex]
 
Last edited:
  • #8
JSuarez said:
..., hence (kb mod ka) = a mod b, for [itex]k\geq 0[/itex].

2*7 mod 2*3 = 2
7 mod 3 = 1

?
 
  • #9
Sorry. There was a typo in the last equality; it's corrected now.

2*7 mod 2*3 = 2(7 mod 3) = 2
 
  • #10
HallsofIvy said:
(ka) mod kb is the remainder when ka is divided by kb. Obviously, ka/kb= a/b and so has the same remainder as a divided by b. Therefore, the answer to your question is "no". What is true is that (ka) mod kb= a mod b.

Not true...
Suppose a=12, b=5, k=8
Then you have, ka=96, kb=40

Sure, a/b=2.4 and ka/kb=2.4

But, a mod b = 2 whereas (ka) mod (kb) = 16



And, by the way, the answer (if it was unclear by reading through this thread), is "yes"
k * (a mod b) = (ka) mod (kb) for ALL a, b, k such that k<>0 and b<>0 (otherwise, you will have a divide-by-zero error)
 
  • #11
zgozvrm said:
And, by the way, the answer (if it was unclear by reading through this thread), is "yes"
k * (a mod b) = (ka) mod (kb) for ALL a, b, k such that k<>0 and b<>0 (otherwise, you will have a divide-by-zero error)

Here's the proof...

Let's first assume that the symbol, [tex]\odot[/tex] is the operator for the function "mod"
and that the function "int" returns an integer which rounded down from it's argument; for example, int(8.9) = 8, but int(-8.9)= -9

[tex]a \odot b = a - int \left( \frac{a}{b} \right) * b[/tex] (this is the definition of the mod function)

Therefore,
[tex]k * ( a \odot b) = k * \left( a - int \left( \frac{a}{b} \right) * b \right) = ka - int \left( \frac{a}{b} \right) * kb[/tex]

Then,
[tex] (ka) \odot (kb) = (ka) - int \left( \frac{ka}{kb} \right) * kb[/tex]

but since [tex]\frac{ka}{kb} = \frac{a}{b}[/tex]

we have

[tex] (ka) \odot (kb) = (ka) - int \left( \frac{a}{b} \right) * kb[/tex]

which has already been shown to be equal to [tex]k * (a \odot b)[/tex]
 
Last edited:
  • #12
I found the above terribly painful, but completely correct. To prove your deal, just use the euclidean algorithm. Write
[tex]
a = q\cdot b + r,
[/tex]
where [itex]q[/tex] is the quotient and [itex]r[/itex] is the remainder ([itex]0\leq r< |b|[/itex]). Then, just multiply everything by [itex]k.[/itex]

In fairness, this is just zgozvrm proof with less abusive notation. Note that Halls of Ivy just confused the quotient with the reminder.
 
  • #13
Thank you all for your replies.
 

1. Is (ka)mod kb Equal to k(a mod b)?

The answer is yes. The two expressions are equivalent.

2. What does "mod" mean in this context?

"Mod" stands for modulo or modular arithmetic, which is a mathematical operation that finds the remainder after division.

3. Can you give an example to illustrate this equation?

Sure, for example, if a = 10 and b = 4, then (ka)mod kb would be (10*4)mod (4*4) = 40mod 16 = 8. Similarly, k(a mod b) would be k(10 mod 4) = k(2) = 2. Therefore, both expressions are equal to 8.

4. Is this equation only applicable to specific numbers or does it work for any values of a and b?

This equation works for any values of a and b, as long as b is not equal to 0.

5. What is the significance of this equation in scientific research?

This equation is commonly used in computer science and cryptography to perform operations on large numbers and ensure data security. It is also used in number theory and abstract algebra to solve mathematical problems.

Similar threads

Replies
4
Views
218
  • Precalculus Mathematics Homework Help
Replies
5
Views
732
  • Precalculus Mathematics Homework Help
Replies
10
Views
2K
  • General Math
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
2
Views
695
Replies
5
Views
2K
  • General Math
Replies
12
Views
2K
Replies
1
Views
664
  • Linear and Abstract Algebra
Replies
2
Views
858
Replies
3
Views
2K
Back
Top