# Mathematica: Matrix product Modulus an integer

1. Feb 26, 2010

### zplot

I need to multiply 2 matrix in Mathematica but modulus an Integer.

The "Modulus->n" option cannot be used with "Dot" function. You can use Modulus-> n with "Inverse" or even "Det" but not with "Dot". It is something strange.

How should I do it, then? Any idea?
Thank you.

2. Feb 26, 2010

### Staff: Mentor

Well, it is crude but you can do

Inverse[Inverse[A,Modulus->n],Modulus->n]

3. Feb 27, 2010

### zplot

Sorry DaleSpam but I don't catch you. I need the product of A and B modulus->n.

4. Feb 27, 2010

### Staff: Mentor

Inverse[Inverse[A.B,Modulus->n],Modulus->n] would that work? If not then you can always use Inner which is a generalization of Dot where you are allowed to specify your multiplication operator.

5. Feb 28, 2010

### zplot

Thank you DaleSpam but it would not work. I will see how could I use Inner.
Thanks a lot

6. Mar 11, 2010

### iluvphysics

You can use this code:

matrixa = {{4, 3}, {1, 2}};
matrixb = {18, 11};
modulo = 26;
som = matrixa.matrixb
Mod[som, modulo]

7. Mar 11, 2010

### zplot

I am sorry but (a.b Mod m) is not iqual to (a Mod m).(b Mod m) being a and b matrix

thank you very much