Linear Combination of GCD Calculator

Find Bézout coefficients and gcd steps instantly. Check target values with general integer solution sets. Download clean reports for classroom or exam revision today.

Calculator

Leave blank to use the gcd.
GCD, coefficients, steps, target solution, CSV, PDF
Extended Euclidean algorithm

Example Data Table

a b Target c gcd(a,b) Bézout x Bézout y Result Meaning
252 198 18 18 4 -5 252 × 4 + 198 × -5 = 18
99 78 12 3 -11 14 Scale the pair by 4 for the target.
391 299 23 23 -3 4 391 × -3 + 299 × 4 = 23
1287 462 21 33 -5 14 No integer solution because 33 does not divide 21.

Formula Used

The calculator uses Bézout’s identity:

gcd(a, b) = ax + by

Here, a and b are integers. The values x and y are integer coefficients found by the extended Euclidean algorithm.

For a target equation:

aX + bY = c

A solution exists only when:

gcd(a, b) divides c

If one solution is X0 and Y0, then all integer solutions are:

X = X0 + (b / gcd(a,b))n

Y = Y0 - (a / gcd(a,b))n

How to Use This Calculator

  1. Enter the first integer in the field marked a.
  2. Enter the second integer in the field marked b.
  3. Enter a target value c if you want to solve ax + by = c.
  4. Leave the target blank if you only need the gcd combination.
  5. Enter a parameter n to test one general solution pair.
  6. Press the calculate button.
  7. Read the result shown above the form.
  8. Download the CSV or PDF report when needed.

Understanding Linear Combination of GCD

A linear combination of gcd shows how two integers build their greatest common divisor. Bézout’s identity says that, for integers a and b, there are integers x and y where ax + by equals gcd(a,b). This fact is central in number theory. It also supports modular inverses, Diophantine equations, cryptography exercises, and divisibility proofs.

Why coefficients matter

The coefficients x and y are not random. They come from reversing the Euclidean algorithm. Each division step writes a remainder using earlier remainders. When the process reaches the gcd, the tool substitutes backward and returns one valid pair. Different valid pairs exist, because adding b divided by the gcd to x and subtracting a divided by the gcd from y keeps the same value.

Practical uses

Linear combinations help solve equations such as ax + by = c. A solution exists only when the gcd of a and b divides c. If that condition is true, one Bézout pair can be scaled by c divided by the gcd. The calculator also shows the general integer solution. This helps learners see every possible pair instead of only one answer.

Learning with steps

The Euclidean table is useful for checking work. It shows each quotient, dividend, divisor, and remainder. These rows explain why the gcd is correct. The coefficient table then connects the final divisor with the original inputs. This makes the answer transparent and easier to verify.

Good input habits

Use integers, including negative values when needed. Very large values may be limited by the server integer range. For classroom work, choose values with several division steps. They make the method easier to observe. For equation solving, enter a target value. Then compare the sample solution with the general form. This gives a complete view of the relationship between divisibility, gcd, and integer equations.

Accuracy notes

The result line should always multiply back to the displayed gcd. If the target equation is solved, the scaled pair should multiply back to the target. When no solution appears, the divisibility test failed. That failure is not an error. It means the requested value cannot be created from the two inputs using integer coefficients. It also prevents misleading decimal answers in exact arithmetic work.

FAQs

What is a linear combination of gcd?

It is an expression ax + by that equals gcd(a,b). The integers x and y are called Bézout coefficients.

Can the calculator use negative numbers?

Yes. You can enter negative integers. The calculator adjusts coefficient signs so the identity uses your original inputs.

What does Bézout coefficient mean?

A Bézout coefficient is an integer multiplier. It shows how each input contributes to the greatest common divisor.

When is ax + by = c solvable?

The equation is solvable in integers only when gcd(a,b) divides c exactly. Otherwise, no integer pair works.

Why are there many solutions?

Once one solution exists, adding a fixed step to one coefficient and subtracting a related step from the other keeps the same target.

What is the extended Euclidean algorithm?

It is a method that finds the gcd and also tracks coefficients that express the gcd as a linear combination.

Can this find modular inverses?

Yes. When the gcd is 1, the calculator can show modular inverse values derived from the Bézout coefficients.

What does the parameter n do?

The parameter n selects one sample pair from the full general solution set for the target equation.

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.