# Modular Arithmetic help!

• Mar 25th 2013, 05:02 PM
zhengcl86
Modular Arithmetic help!
so this is confusing, with mod arithmetic i see that you only need the remainder as an answer but i don't get how it is solved.

like
2 (equivalence sign) 4(mod 3)
(3+4)(mod 5)
• Mar 25th 2013, 05:10 PM
Ant
Re: Modular Arithmetic help!
Quote:

Originally Posted by zhengcl86
so this is confusing, with mod arithmetic i see that you only need the remainder as an answer but i don't get how it is solved.

like
2 (equivalence sign) 4(mod 3)
(3+4)(mod 5)

I don't understand your question, could you clarify?

2 is not equal to 4 modulo 3. 4 is equal to 1 modulo 3.
• Mar 25th 2013, 05:14 PM
zhengcl86
Re: Modular Arithmetic help!
2 = 4(mod3) is a true/false question and the = sign after 2 is the one with the 3 bars the equivalence sign. since i don't know the code to put that in.

like if i get something like (2-4)(mod 7) and (2+9)(mod 10) how would i go about solving those?
• Mar 25th 2013, 05:28 PM
Ant
Re: Modular Arithmetic help!
Quote:

Originally Posted by zhengcl86
2 = 4(mod3) is a true/false question and the = sign after 2 is the one with the 3 bars the equivalence sign. since i don't know the code to put that in.

like if i get something like (2-4)(mod 7) and (2+9)(mod 10) how would i go about solving those?

2 = 4 (mod 3) is false.

Modulo arithmetic really isn't too bad once you get used to the idea. In fact, we often use modulo arithmetic to tell the time; For example, 13 o'clock = 1 o'clock. And, 20:00 = 8pm. This is all modulo 12.

Two number are equal modulo n if they differ by a multiple of n.

Perhaps the best way to write a number modulo n, is to write it as a number less than n but greater than 0.

If you number is lager than n, subtract multiples of n until you reach a number less than n. If you have a negative number, add multiplies of n until you arrive at a number greater than 0 but less than n.

so what is 4 modulo 3? Well, 4 -3 = 1. So 4 = 1 mod 3.

What is -10 modulo 3? Keep adding multiples of 3 until you reach a number greater than 0 but less than 3. -10 = -7 = -4 = -1 = 2 mod (3)

Addition and subtraction are easy, just work out the answer as usual, then add or subtract multiples of 3 until you arrive at a number greater than 0 but less than n.
• Mar 25th 2013, 05:40 PM
zhengcl86
Re: Modular Arithmetic help!
this kinda of helped a bit, even tho i have my phone's time set on 24 hour clock, but it wasn't clicking in my head. thank you
• Mar 25th 2013, 05:58 PM
zhengcl86
Re: Modular Arithmetic help!
so how would congruence equations come into play?

i have 2+n=3(mod7)

so would the answer be n = 6 (mod 7) ??
• Mar 26th 2013, 04:06 PM
Ant
Re: Modular Arithmetic help!
$2 + n = 3 \ (mod\7)$

Treat like a normal equation, and subtract 2 from both sides...

$n = 1 \ (mod\7)$

And you're done.

Of course, this isn't the unique way of writing it, in fact:

$n = 1\ (mod\7) = 8\ (mod\ 7) = 15 \ (mod \7) = 22\ (mod\ 7) ...$
• Mar 26th 2013, 04:50 PM
Plato
Re: Modular Arithmetic help!
Quote:

Originally Posted by zhengcl86
so how would congruence equations come into play?
i have 2+n=3(mod7)?

I have different solution for you.

If you can see that $n=1$ is clearly a solution here.

Thus $(\forall k\in\mathbb{Z})[1+7k]$ is also a solution.
• Mar 28th 2013, 07:53 AM
zhengcl86
Re: Modular Arithmetic help!
hmm that seems understandable,
and makes alot more sense now

how about fractions? n/2 = 4(mod7)
so n = 2(mod7)
n=2(mod7) n=9(mod7) n=16(mod7) n=23(mod 7)
would that be the solution?

then it comes regular equations like
3=(n-4)(mod7)
so 3n-12(mod7)
n=-3(mod7) n=5(mod7) n=12(mod7) n=19(mod7)

is my math correct? lol thanks in advance!
• Mar 28th 2013, 09:56 AM
Selinde
Re: Modular Arithmetic help!
For the first one, you get the idea, but you made a small mistake.

If you have
$n/2 \equiv 4 (\mbox{mod } 7)$
then, as you would do usually, multiply (not divide!) both sides by 2, and you get
$n \equiv 8 (\mbox{mod } 7)$
Now, as Ant explained, this is not the only answer. In fact, the "best" or most "standard" answer is the one where n is equivalent to some number between 0 and 7; in this case, that would be $n \equiv 1 (\mbox{mod } 7)$.

For the second equation, note that
$3 \equiv (n-4) (\mbox{mod } 7)$
is the same equation as
$n-4 \equiv 3 (\mbox{mod } 7)$.
So, we again can just solve it like we would any regular equation, by adding 4 to both sides:
$7 \equiv n (\mbox{mod } 7)$
So our answer is $n \equiv 7 (\mbox{mod } 7)$ (or better: $n \equiv 0 (\mbox{mod } 7)$).