1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Can i do modulus on a TI-83? How can i compute a negative modulus?

  1. Jan 11, 2012 #1
    I am studying Integer Modulo in my Cryptography and Data Security class. We are dealing with mainly modulo 26 [the alphabet] right now. I understand if it is addition or multiplication you just take the remainder of the result divided by, lets say 26 in this circumstance.

    ie: (5+25)mod26 = 4
    ie: (5*6)mod26 = 4

    But i'm not quite understanding how to do mod26 when there results a negative number.
    ie: the shift cipher is (x-k)mod26
    which usually results in a negative because k is usually > x
    so say, if i had -7mod26
    how would i go about this?

    Also is there any way to calculate this sort of problem on my calculator to check my work? I have a TI-83.

    Thanks so much guys.
  2. jcsd
  3. Jan 11, 2012 #2
    Not sure if this is what you mean, but hopefully this is helpful:

    you can reduce any number by the modulus. If you had 123 mod 26, this is congruent to 97 which is congruent to 71 congruent to 45 congruent to 19 congruent to -7 and so on. If you want the smallest positive value, its 19 in this case.

    Basically, if you have a negative value, simply add a multiple of the modulus to it until you get the smallest positive value that is less than the modulus itself.

    Not sure about your calculator in particular though (so im sorry if you already knew this and it is thus irrelevant)
  4. Jan 11, 2012 #3
    Just to clarify, youre saying -7mod8 would be 1? [-7+8] = 1 < 8, the answer is one?
    and -21mod8 would be 3 because [-21 + 24] = 3 < 8?

    Thanks so much this really did help a LOT. I dont think theres a way to do mod on the calculator everywhere i look says you must program it yourself.
  5. Jan 11, 2012 #4
    That's correct!!
  6. Jan 11, 2012 #5
    Wow, thats extremely simple and a lot more clear than how my prof explained it. You wouldn't have an equivalently elegant way of explaining modular division [reciprocals] would you? The only way he told us how to do, say 5(-1)mod26 {where 5(-1) is representing the reciprocal of 5), is to use the euclidean algorithm, in which he didnt explain well either. If this is too exhaustive to explain, then dont worry about it! I've been trying to find some good explanations online.
  7. Jan 11, 2012 #6


    User Avatar
    Gold Member

    For a Ti-83, the best you are going to get is
    Code (Text):

    x fPart(y/x)
    for [itex]y \!\mod x[/itex]
  8. Jan 11, 2012 #7
    great, ill take note of that function of my calculator.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook