Matrix Modulo Calculator

Work with matrices modulo n, any size, any modulus. Validate inputs, auto-normalize negatives, and detect non-invertibility during computation. Perform addition, subtraction, multiplication, powers, determinant, inverse with steps. Copy, share, and export results as CSV files. Download polished PDFs with steps, explanations, and tables included.

Calculator
For Power, supply non-negative integer k.
Formulas Used
  • Modular reduction: for any integer a, a (mod n) is the remainder 0…n−1.
  • Add/Subtract: (A ± B) (mod n) has entries aij ± bij reduced modulo n.
  • Multiply: (A×B)ij = Σk aikbkj, then reduce each entry modulo n.
  • Power: Ak via repeated squaring with all intermediate entries reduced modulo n.
  • Determinant: computed as the integer determinant (Bareiss algorithm), then reduced modulo n.
  • Inverse (mod n): A is invertible modulo n iff gcd(det(A), n) = 1. Inverse is found by Gauss–Jordan elimination over ℤ/nℤ when pivots are invertible modulo n.
How to Use
  1. Enter the modulus n (e.g., 26 for Hill-cipher style arithmetic).
  2. Pick an operation. For powers, set the integer exponent k.
  3. Paste matrix rows in the textareas. Separate numbers by spaces or commas.
  4. Use Matrix B only for +, −, ×. Dimensions must be compatible.
  5. Click Calculate. Results are reduced into 0…n−1 automatically.
  6. Export the result using Download CSV or Download PDF.
Example Data
A (3×3)
6 24 1
13 16 10
20 17 15
B (3×3)
3 12 17
5 9 2
8 4 11

With modulus 26, A is invertible because gcd(det(A), 26) = 1.

FAQs

Use one row per line. Separate entries by spaces or commas. All rows must have the same number of entries.

Over ℤ/nℤ, a matrix is invertible only if its determinant is coprime with n. If gcd(det(A), n) ≠ 1, an inverse modulo n does not exist.

Yes. Multiplication requires columns of A equal rows of B. Only powers, determinant, and inverse require square matrices.

All entries are reduced to the range 0…n−1 using a safe remainder function, so negatives wrap correctly under the chosen modulus.

We use the fraction-free Bareiss algorithm to compute the exact integer determinant, and then reduce it modulo n for the final value.

Yes. Use the PDF button; it captures the result table and any step logs shown for inverses, packaging them into a neatly formatted PDF.
Result
No matrix to display yet, or the chosen operation returned no matrix.

Tip: For composite moduli, invertibility is stricter than in fields. If an inverse fails, try a different modulus or matrix.

Related Calculators

Proportion and Ratio Calculatorsquare root calculator with stepsnegative square root calculatorfraction square root calculatorsquare root division calculatordecimal to square root calculatorderivative of square root calculatorharmonic mean calculatorbinomial distribution mean calculatordiscrete random variable mean calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.