Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Modulus of negative numbers

  • 10-05-2008 10:37pm
    #1
    Closed Accounts Posts: 12,382 ✭✭✭✭


    Hello

    I really hope someone can help me with this.

    I am reading lecture notes and it says the following -

    -12 mod 11 = 10
    -1 mod 11 = 10

    When I do -12 mod 11 and -1 mod 11 on my calculator I get -1 for both.

    Is there a trick or something extra I am missing here?

    Note I am dealing with finite fields.

    Any help greatly appreciated.

    Thanks


Comments

  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    I think the answer has something to do with 22 - 10 = 11, where 22 is a multiple of 11 which is greater than 12.

    Why doesn't the % (in C) and a calculator give the correct answer?


  • Closed Accounts Posts: 6,081 ✭✭✭LeixlipRed


    When it says = 10 it means 10(mod 11). -12 = (-2)(11) + 10 and -1 = (-1)(11) + 10. Not sure you understand modular arithmetic fully to be honest. Or maybe that's not the question you're asking?


  • Closed Accounts Posts: 31 bobzi


    Hi dublindude,

    when working with modular arithmetic in a finite field the remainder should always be non-negative so:
    -12 = -2*11+10 => -12 mod 11 = 10
    -1 = -1*11+10 => -1 mod 11 = 10


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    Thank you for the replies.
    bobzi wrote:
    when working with modular arithmetic in a finite field the remainder should always be non-negative so:
    -12 = -2*11+10 => -12 mod 11 = 10
    -1 = -1*11+10 => -1 mod 11 = 10

    Is this the same as saying if the answer is a minus, just add the modulus to it?

    For example, -12 mod 11 = -1. -1 + 11 = 10.

    Or is that just coincidence?


  • Closed Accounts Posts: 31 bobzi


    yeah that'll work


  • Advertisement
  • Closed Accounts Posts: 6,081 ✭✭✭LeixlipRed


    dublindude wrote: »
    Thank you for the replies.



    Is this the same as saying if the answer is a minus, just add the modulus to it?

    For example, -12 mod 11 = -1. -1 + 11 = 10.

    Or is that just coincidence?

    That's the whole idea basically.

    a is congruent to b (mod n) where a= kn + b. ie some multiple of your modulus plus the remainder. So if a number is outside your "window", i.e. from 0 to n-1 then to bring it inside you can add or subtract multiples of n.


  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    Thanks guys! :)


Advertisement