# How to ask Mathematica to solve a simple modular equation

What's the most straightforward way to ask Mathematica to find all solutions of an equation like

$$3x + 2y + 4z = 0 \pmod {11}$$

(for instance), where either $$x$$, $$y$$, $$z$$ can be considered to be integers in the range $$-5\dots 5$$, or equivalently they belong to the ring $$Z/(11Z)$$ of integers modulo $$11$$?

(I've tried a number of obvious things with no success.)

Solve[Mod[3 x + 2 y + 4 z, 11] == 0 &&
-5 <= x <= 5 && -5 <= y <= 5 && -5 <= z <= 5, Integers]

(*    {{x -> -5, y -> -5, z -> -2},
{x -> -5, y -> -4, z -> 3},
{x -> -5, y -> -3, z -> -3},
...
{x -> 5, y -> 5, z -> 2}}    *)

(121 solutions)

Solve[3 x + 2 y + 4 z == 0, Modulus -> 11] produces {{z -> 2 x + 5 y}} (as residue classes modulo 11).

• Yes, multiplying 3x + 2y + 4z = 0 by 3 (in the field Z/11Z) gives -2x + 6y + z = 0, or in other words z = 2x + 5y. Commented Feb 22, 2021 at 6:25
• Which is the set of solutions! Just like linear algebra over the field of real numbers, we have two free variables x and y, and the value of z is uniquely determined by them. In my opinion, this is a much better form than listing the 121 solutions one by one. Commented Feb 22, 2021 at 6:48
• I agree, this is much better than what I proposed. Commented Feb 22, 2021 at 12:38
• I personally prefer Reduce[] for this: Reduce[3 x + 2 y + 4 z == 0, {x, y, z}, Modulus -> 11]. This highlights the fact that there is a parametric solution. Commented Feb 22, 2021 at 16:14