4
$\begingroup$

I am using Mathematica 10.4.1.0. When I specify the "Modulus" option to be a non-prime, the functions RowReduce and MatrixRank return the error

"Value of option Modulus -> (non-prime number) should be a prime number or zero".

I have tried a variety of matrices and Mathematica can process none of them, unless I choose "Modulus->(prime)".

I would like to easily find the row reduced form and the rank of small ($n<10$) square matrices, modulo a non-zero positive integer. Can the inbuilt functions be corrected, or is there an alternative easy way to accomplish these tasks?

EDIT: Perhaps a motivated Mathematica coder could produce a general row reduction package for matrices over Rings. I was able to cobble together something from the following sources.

This article goes through row reduction of matrices with elements from rings: Gaussian Elimination: Workhorse of Linear Algebra.

And this Mathematica package by John H. Matthews has an explicit Gaussian elimination algorithm with different pivoting options, see 0309Pivoting.nb within the package.

$\endgroup$
1
  • 1
    $\begingroup$ If you post a specific example that would be helpful. $\endgroup$ Apr 16, 2017 at 17:50

1 Answer 1

3
$\begingroup$

The problem is with division: $\mathbb{Z}/n \mathbb{Z}$ is not a field unless $n$ is prime. So, if you don't do division (which will leave your "pivots" not equal to $1$) there is no problem with non-prime modulus, otherwise, it's a bit problematic.

Edit you can easily implement row reduction over $\mathbb{Z}/n \mathbb{Z}$ yourself. It won't be super fast.

$\endgroup$
2
  • $\begingroup$ Thank you for the reply. However, I want to look at many matrices so I would like to automate these tasks. I tried an option 'Method -> "DivisionFreeRowReduction" ', but its not want I am looking for. I was hoping someone who knew Mathematica really well might know a quick way to edit these matrix operations in order to turn off the scaling at each step of the Gaussian elimination. However, it seems that this kind of access to the underlining code is unlikely. I guess I'll have to write some code after all :) $\endgroup$ Apr 16, 2017 at 13:28
  • 2
    $\begingroup$ @zornslemmings What do you propose to do if your modulus is 6, and your leading element in a row is 2? Before coding, you should specify what it is you are looking for. $\endgroup$
    – Igor Rivin
    Apr 16, 2017 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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