Modular Arithmetic Equation Calculator

Solve modular equations with instant steps and exports. Compare inverses, residues, powers, and linked systems. Use clean examples for reliable number theory practice today.

Calculator

Example Data Table

Calculation Input Expected Result Meaning
Linear congruence 14x ≡ 30 mod 100 x ≡ 45, 95 mod 100 Two solutions exist because gcd is 2.
Inverse 7 inverse mod 26 15 7 × 15 ≡ 1 mod 26.
Residue -25 mod 7 3 The least nonnegative remainder is 3.
Power 5^13 mod 23 21 Repeated squaring reduces each product.
Two congruences x ≡ 2 mod 3, x ≡ 3 mod 5 x ≡ 8 mod 15 The rules combine into one class.

Formula Used

Linear Congruence

A linear modular equation is written as ax ≡ b (mod n). Let d = gcd(a, n). A solution exists only when d divides b. Then reduce to (a/d)x ≡ (b/d) (mod n/d).

Modular Inverse

The inverse of a modulo n is a number u where au ≡ 1 (mod n). It exists only when gcd(a, n) = 1.

Residue Reduction

The least nonnegative residue is ((a % n) + n) % n. This handles negative integers safely.

Modular Power

The calculator uses repeated squaring. It repeatedly squares the base and reduces every product modulo n.

Two-Congruence System

For x ≡ r1 (mod m1) and x ≡ r2 (mod m2), a solution exists when r2 - r1 is divisible by gcd(m1, m2).

How to Use This Calculator

Select the calculation type first. Enter integers in the fields needed for that option. Use a, b, and n for a linear congruence. Use a and n for an inverse or residue. Use the exponent field for modular powers. Use the residue and modulus pairs for a two-rule system. Press the calculate button. The result appears below the header and above the form. Download the result table when you need a saved record.

Modular Arithmetic Equation Guide

What This Calculator Does

Modular arithmetic compares numbers by remainder. Two values are congruent when their difference is divisible by the modulus. This calculator focuses on that idea. It solves linear congruences, finds inverses, reduces residues, evaluates powers, and combines two congruences using the Chinese remainder method. It also gives each result with readable working, so students can follow the logic.

Why Modulus Matters

The modulus sets the repeating cycle. For modulus 7, every integer belongs to one of seven residue classes. Large numbers become easier because only the remainder matters. This is useful in clocks, calendars, coding theory, cryptography, random number checks, and contest mathematics. A correct modulus must be positive. A zero or negative modulus has no valid standard remainder system here.

Solving Linear Congruences

A linear congruence has the form ax congruent to b modulo n. It may have no solution, one reduced solution, or several related solutions. The key test is gcd(a, n) divides b. When the test passes, the equation is divided by that gcd. The reduced coefficient then needs a modular inverse. The calculator shows the base solution and all solutions within the original modulus.

Using Inverses and Powers

A modular inverse exists only when the number and modulus are coprime. The extended Euclidean algorithm finds that inverse. Modular powers are handled by repeated squaring. This keeps calculations controlled, because each multiplication is reduced by the modulus. The method is fast for normal educational inputs.

Working With Combined Congruences

The Chinese remainder option combines two remainder rules. It first checks whether their residues agree modulo the gcd of the moduli. If they do not agree, no common integer satisfies both rules. If they agree, the calculator returns the smallest nonnegative solution and the combined modulus.

Best Practice

Enter integers only. Use moderate sizes when your server has normal integer limits. Review the steps before using results in proofs. Export the table when you need a record for assignments, notes, or reports.

Interpreting Results

Results are shown as least nonnegative residues. Equivalent answers differ by a multiple of the final modulus. This keeps answers compact. It also makes comparison easier across examples, worksheets, and exported reports during careful later review.

FAQs

1. What is a modular arithmetic equation?

It is an equation based on remainders. The expression ax ≡ b (mod n) means ax and b leave the same remainder when divided by n.

2. When does a linear congruence have a solution?

The equation ax ≡ b (mod n) has a solution only when gcd(a, n) divides b. If this test fails, no integer satisfies the congruence.

3. What is a modular inverse?

A modular inverse of a modulo n is a value that makes a × inverse ≡ 1 (mod n). It exists only when a and n are coprime.

4. Can this calculator handle negative numbers?

Yes. The residue formula converts negative inputs into least nonnegative residues. For example, -25 mod 7 becomes 3, because both values are congruent modulo 7.

5. What does the power option calculate?

It calculates a^e mod n. The calculator uses repeated squaring, which reduces intermediate products after each multiplication and keeps the process efficient for common educational inputs.

6. What is the two-congruence system option?

It solves two remainder conditions together, such as x ≡ 2 mod 3 and x ≡ 3 mod 5. It returns one combined congruence when a common solution exists.

7. Why must the modulus be positive?

A positive modulus creates a standard remainder cycle. Zero cannot form a valid modular system, and negative moduli are avoided here to keep results consistent and easy to compare.

8. Can I export the answer?

Yes. After calculation, use the CSV or PDF button above the form. The exported file includes the result table, which helps with assignments, records, and reports.

Related Calculators

Paver Sand Bedding Calculator (depth-based)Paver Edge Restraint Length & Cost CalculatorPaver Sealer Quantity & Cost CalculatorExcavation Hauling Loads Calculator (truck loads)Soil Disposal Fee CalculatorSite Leveling Cost CalculatorCompaction Passes Time & Cost CalculatorPlate Compactor Rental Cost CalculatorGravel Volume Calculator (yards/tons)Gravel Weight Calculator (by material type)

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.