# Inverse of Mod Function

## Homework Statement

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).

## Homework 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?

## The Attempt at a Solution

f(x) = {2x+1, 0 <= x <= 2}
{2x-6, 3 <= x <= 6}

Related Calculus and Beyond Homework Help News on Phys.org
matt grime
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?

HallsofIvy
Homework Helper
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.

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

mod is not a function.
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.

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.
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.

I was wondering, though, since (a)mod(n) can be written in terms of the floor function, thus $$a - n Floor[\frac{n}{a}],$$ and therefore, can't we describe the floor function as an invertible function? I know that $$Floor[x] = -1/2 + x + \frac{ArcTan(Cot(\pi x))}{\pi}$$. 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: