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: Inverse of Mod Function

  1. Feb 22, 2007 #1
    1. The problem statement, all variables and given/known data
    Let S be the subset of the integers {0, 1, 2, 3, 4, 5, 6}, and let f be the function from S to S defined by f(x) = (4x+3) mod 7. Find a formula for f<superscript>-1 (the inverse of f, I don't know how to type that).

    2. Relevant equations
    I know that the mod function is defined by floor function (a - n floor(n\a). But I'm still unable to create an inverse function with one inverse function for all values. I made a piecewise function that works for those values, but I feel like there should be a better method. Does anybody know an inverse rule for either floor or modulus?

    3. The attempt at a solution
    f(x) = {2x+1, 0 <= x <= 2}
    {2x-6, 3 <= x <= 6}
  2. jcsd
  3. Feb 22, 2007 #2

    matt grime

    User Avatar
    Science Advisor
    Homework Helper

    The 'mod' function? There is no such thing.

    mod is not a function.

    Just do it as for any other function:

    y=4x+3, hence x= (y-3)/4, so what is division by 4 in mod 7 arithmetic?
  4. Feb 22, 2007 #3


    User Avatar
    Science Advisor

    The first thing you should do is calculate the actual values of f:
    f(0)= 4(0)+ 3= 3. f(1)= 4(1)+ 3= 7= 0 mod 7. f(2)= 4(2)+ 3= 11= 4 mod 7.
    f(3)= 4(3)+ 3= 15= 1 mod y. f(4)= 4(4)+ 3= 19= 5 mod 7. f(5)= 4(5)+ 3= 23= 2 mod 7. f(6)= 4(6)+ 3= 27= 6 mod 7

    So you want f-1(0)= 1, f-1(1)= 3, f-1(2)= 5, f-1(3)= 0, f-1(4)= 2, f-1(5)= 4, f-1(6)= 6.

    Yes, that's exactly what your function gives. Good work! That is, by the way, a single "function" and I have no problem with it. However, you might remember that -6 is 1 in mod 7. Since the first formula was given "mod 7" why not do the same with this:
    f-1(x)= 2x+ 1 (mod 7) or f-1(x)= 2x- 6 (mod 7)
    They are exactly the same.
  5. Feb 22, 2007 #4
    My apologies... mod "operator" (or modulo operator); I was just asking if there was an inverse operator that I could use so I could switch the x and y variables and solve for x instead of switching the values around and making an entirely new function.

    Thanks a lot! I'm not sure that putting the (mod 7)'s in there like that truly give any more information, although I see how it looks more related to the beginning function, and I see how your solution and mine are equivalent. I'm not sure what I'll end up submitting. Thanks again.
  6. Dec 14, 2008 #5
    I was wondering, though, since (a)mod(n) can be written in terms of the floor function, thus [tex] a - n Floor[\frac{n}{a}],[/tex] and therefore, can't we describe the floor function as an invertible function? I know that [tex]Floor[x] = -1/2 + x + \frac{ArcTan(Cot(\pi x))}{\pi} [/tex]. Thus, can't we inverse this formula? Furthermore, there is another idea that works on any function, but deals with sets. In general, given a function f: A → B and a subset S of B, then f-1(S) = {x ∈ A | f(x) ∈ S}. In the case of the floor function, if n is an integer, then floor-1({n}) = [n, n + 1). Note that these are sets, not numbers.

    Please let me know as I am saying these things right off of the top of my head.
    Last edited: Dec 14, 2008
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook