TransWikia.com

How to ask Mathematica to solve a simple modular equation

Mathematica Asked by Daniel Asimov on July 10, 2021

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 $-5dots 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.)

2 Answers

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)

Correct answer by Roman on July 10, 2021

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

Answered by Greg Martin on July 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP