Modular division by modulo means multiplication by a modular inverse . This is defined uniquely for every numerator exactly when . For example, , so .
If is not invertible, solve the linear congruence directly. It has solutions exactly when divides , and then has solutions modulo . Thus gives ; division by two cannot select a unique residue. Cancellation instead reduces the modulus to .
New to topics? Read the docs here!