Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How can I express $((a-b)/c) \bmod m$ in terms of $a \bmod m$, $b \bmod m$ and $c \bmod m$?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Assuming the division is without remainder and that $c$ is relatively prime to $m$, you can just evaluate $(a-b)c^{-1}$ in $\mathbf Z/m\mathbf Z$. If $c$ is not relatively prime with $m$, you cannot deduce the value of $(a-b)/c$ modulo $m$ from the images of $a,b,c$ in $\mathbf Z/m\mathbf Z$ alone.

share|improve this answer
    
if c is 2 and m is 10^9 + 7, then can I express that in a simple form? Also, what is meant by evaluating in Z/mZ? –  Jatin Feb 2 '13 at 8:18
1  
Since that $m$ is odd, it is relatively prime with $2$, and by inspection the inverse of $2$ modulo $m$ is $2^{-1}=5\times10^8+4\in \mathbf Z/m\mathbf Z$. Evaluation in $\mathbf Z/m\mathbf Z$ means computing modulo $m$, so in this case the result is $(500000004\times((a\bmod m)-(b\bmod m)) \bmod m$. –  Marc van Leeuwen Feb 2 '13 at 11:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.