Proving the inverse of a function

54 Views Asked by At

Given the following functions: $$ \begin{aligned} F(X)&=a(X \bmod b) + (X / b + X \bmod b) \bmod a \\ G(Y)&=b((Y \bmod a - Y/a) \bmod a) + Y/a \end{aligned} $$

Where $a$ and $b$ are some positive constant, and $X/b$ is quotient of $X$ divided by $b$ (same for $Y/a$), and $X$ is between $0$ and $(a \times b - 1)$.

I'm trying to prove $G$ is the inverse of $F$, meaning: $$ G(F(X)) = X $$

So I started with the following: $$ \begin{aligned} G(F(X)) &= G\bigl(a(X \bmod b) + (X / b + X \bmod b) \bmod a\bigr) \\ &= b\Biggl(\biggl(\bigl(a(X \bmod b) + (X / b + X \bmod b) \bmod a \bigr) \bmod a - \bigl(a(X \bmod b) + (X / b + X \bmod b) \bmod a \bigr)/a \biggr) \bmod a \Biggr) + \bigl(a(X \bmod b) + (X / b + X \bmod b) \bmod a\bigr)/a \\ &= b\Biggl(\biggl((X / b + X \bmod b) \bmod a - (X \bmod b) \biggr) \bmod a \Biggr) + (X \bmod b) \\ \end{aligned} $$

(Sorry for the bad formatting)

My math is a bit rusty, so I'm stuck at the above, how can I proceed further, or have I gone down the wrong route completely?

Thanks.

1

There are 1 best solutions below

1
On

Let $X=pb+q$ with $p=X/b$ and $q=X\bmod b$.

Then

$$Y=F(X)=aq + (p + q) \bmod a$$ and

$$G(Y)=b(((p + q) \bmod a - q) \bmod a) + q.$$

To achieve $G(Y)=X$, you should have

$$((p + q) \bmod a - q) \bmod a=p,$$ which cannot hold if $p\ge a$.