Results 1 to 8 of 8

Math Help - How do I calculate modulo?

  1. #1
    Junior Member
    Joined
    Nov 2009
    Posts
    37

    How do I calculate modulo?

    If I wanted to convert a list of numbers: 1, 4, 17, 29, 64, 1293 into modulo 3, modulo 5, and modulo 9.. How would I do that? I had never heard of modulo up until this point (except in programing, but even then I had never heard of different types of modulo)
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor Unknown008's Avatar
    Joined
    May 2010
    From
    Mauritius
    Posts
    1,260

    Re: How do I calculate modulo?

    I'm not sure what you are asking for exactly... do you want to find 1 modulo 3, 4 modulo 3, etc and then with 5 and and so on?

    Or find a certain number modulo 3 = 1?

    If it's the former,
    1 % 3 = 1
    (the remainder when 1 is divided by 3 is 1)
    4 % 3 = 1
    17 % 3 = 2

    As for the latter, you have the first one.
    to get 4, you need a number greater than 3, 5 is just what is needed.
    9 % 5 = 4

    % means modulo in programming
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Jun 2011
    Posts
    56

    Re: How do I calculate modulo?

    The modulo (as I learned it) is defined as 'the remainder after floored division of a number X by another number Y'.

    In mathematical form this is:
    \text{mod}(X,Y)=X-\text{floor}(\frac{X}{Y})\cdot Y
    in which 'floor' means round to the nearest integer in negative infinity direction.

    So let's pick one of your examples. You're saying that you want to convert a list of numbers into modulo 3. In this case X would be the number from your list, and Y would be 3.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor Also sprach Zarathustra's Avatar
    Joined
    Dec 2009
    From
    Russia
    Posts
    1,506
    Thanks
    1

    Re: How do I calculate modulo?

    Quote Originally Posted by corsica View Post
    The modulo (as I learned it) is defined as 'the remainder after floored division of a number X by another number Y'.

    In mathematical form this is:
    \text{mod}(X,Y)=X-\text{floor}(\frac{X}{Y})\cdot Y
    in which 'floor' means round to the nearest integer in negative infinity direction.

    So let's pick one of your examples. You're saying that you want to convert a list of numbers into modulo 3. In this case X would be the number from your list, and Y would be 3.
    Sorry... confused!
    Follow Math Help Forum on Facebook and Google+

  5. #5
    MHF Contributor Unknown008's Avatar
    Joined
    May 2010
    From
    Mauritius
    Posts
    1,260

    Re: How do I calculate modulo?

    Take 3 % 5.

    mod(3, 5) = 3 - floor(3/5)5

    3/5 = 0.6 => 0

    0*5 = 0

    3 - 0 = 3

    so 3 % 5 = 3

    (Or the remainder when 3 is divided by 5 is 3)
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Junior Member
    Joined
    Jun 2011
    Posts
    56

    Re: How do I calculate modulo?

    Quote Originally Posted by Also sprach Zarathustra View Post
    Sorry... confused!
    About which part?
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Junior Member
    Joined
    Jun 2011
    Posts
    56

    Re: How do I calculate modulo?

    Maybe it also helps to have a real-world example. Suppose you're navigating a ship with a compass. The compass bearing (the direction in which you're sailing) can range from 0 and 360 degrees. 0 degrees means that you're sailing northwards, 90 degrees means you're sailing eastwards, 180 degrees means you're sailing southwards, and 270 degrees means you're sailing westwards.

    Now suppose you have an initial compass bearing of 300 degrees, and then proceed to give your ship a 250 degrees turn. Adding these values together gives a new bearing of 550 degrees. However this value is not on your compass. To find the compass bearing you perform a modulo operation with 360 (because the compass has a range of 360 degrees). So your new bearing is:
    \text{mod}(550,360)=550-\text{floor}(\frac{550}{360})\cdot 360=550-\text{floor}(1.53)\cdot 360)=550-1\cdot 360=190
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor Also sprach Zarathustra's Avatar
    Joined
    Dec 2009
    From
    Russia
    Posts
    1,506
    Thanks
    1

    Re: How do I calculate modulo?

    Quote Originally Posted by corsica View Post
    Maybe it also helps to have a real-world example. Suppose you're navigating a ship with a compass. The compass bearing (the direction in which you're sailing) can range from 0 and 360 degrees. 0 degrees means that you're sailing northwards, 90 degrees means you're sailing eastwards, 180 degrees means you're sailing southwards, and 270 degrees means you're sailing westwards.

    Now suppose you have an initial compass bearing of 300 degrees, and then proceed to give your ship a 250 degrees turn. Adding these values together gives a new bearing of 550 degrees. However this value is not on your compass. To find the compass bearing you perform a modulo operation with 360 (because the compass has a range of 360 degrees). So your new bearing is:
    \text{mod}(550,360)=550-\text{floor}(\frac{550}{360})\cdot 360=550-\text{floor}(1.53)\cdot 360)=550-1\cdot 360=190
    Thank you for explaining me this use of mode, which I familiar with...

    Before
    Sorry... confused!
    I wrote something like this
    But, what if x=y=1
    , but it was a mistake, instead of mod in your post my eyes saw gcd...

    So I was confused, but not with your post #3.

    Anyway, thanks!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Modulo
    Posted in the Algebra Forum
    Replies: 2
    Last Post: May 7th 2010, 05:14 PM
  2. Modulo help
    Posted in the Discrete Math Forum
    Replies: 4
    Last Post: April 18th 2010, 09:13 AM
  3. Modulo of squares = modulo of roots
    Posted in the Discrete Math Forum
    Replies: 4
    Last Post: December 1st 2009, 09:04 AM
  4. Modulo 16
    Posted in the Algebra Forum
    Replies: 1
    Last Post: July 3rd 2009, 07:01 AM
  5. Modulo
    Posted in the Algebra Forum
    Replies: 11
    Last Post: May 5th 2009, 02:24 PM

Search Tags


/mathhelpforum @mathhelpforum