ForHosting KIT · Math

Polynomial LCM calculator

Get the smallest polynomial both inputs divide: x² − 3x + 2 and x² − 1 share x − 1, so their least common multiple is x³ − 2x² − x + 2, of degree 3. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
First text
1, -3, 2
Second text
1, 0, -1
You get
Gcd
1, -1
Product
1, -3, 1, 3, -2
Lcm
1, -2, -1, 2
Degree lcm
3

This polynomial LCM calculator computes the least common multiple of two polynomials from dense coefficient arrays written in descending degree order. It first finds their monic greatest common divisor with the Euclidean algorithm, multiplies the original polynomials, and divides that product by the shared factor. The result is normalized to a monic polynomial, so equivalent inputs with different nonzero scalar factors have a consistent answer. The response includes the input polynomials, GCD, raw product, LCM, readable polynomial forms, and the number of GCD steps. Everything runs deterministically without network access, randomness, or time-dependent behavior.

What the polynomial LCM means

The least common multiple of two nonzero polynomials is the lowest-degree polynomial divisible by both, considered up to multiplication by a nonzero constant. Because that constant is arbitrary, this calculator returns the monic representative, whose leading coefficient is one. Inputs are dense arrays ordered from the highest power to the constant term.

Thus [1, -3, 2] means x^2 - 3x + 2, while [1, -1] means x - 1. If the second polynomial already divides the first, their LCM is simply the monic form of the first. If the polynomials are coprime, their GCD is one and the LCM is the monic form of their product.

If exactly one input is zero, the result is the zero polynomial, following the standard convention that every nonzero polynomial divides zero. The pair [0] and [0] is rejected because the requested product-over-GCD construction would require gcd(0, 0), which is undefined for this contract. Leading zero coefficients are removed before any degree or arithmetic operation, so [0, 1, 2] and [1, 2] describe the same polynomial.

The response exposes coefficient arrays and readable strings for the GCD, product, and LCM, making the calculation useful both for code and for checking written algebra.

How product divided by GCD is calculated

The algorithm follows the identity lcm(a, b) = monic((a * b) / gcd(a, b)). It begins with a Euclidean GCD calculation on coefficient vectors. At each step, polynomial long division produces a remainder; the previous divisor and that remainder become the next pair.

Since a nonzero remainder has lower degree than its divisor, the process terminates within a bounded number of steps. The final nonzero divisor is scaled so its leading coefficient is one. Next, ordinary coefficient convolution forms the full product a times b.

A second polynomial long division divides this product by the monic GCD, removing exactly one copy of every shared factor. The quotient is finally made monic to produce a stable LCM representative. Returning the intermediate GCD and product is deliberate: callers can verify that the reported shared factor explains why the raw product contains unnecessary duplication, and that the LCM retains enough copies of every factor to be divisible by both inputs.

Floating-point arithmetic can leave tiny residual coefficients during division, so the implementation uses a fixed small zero tolerance and rounds only the exposed response to the requested precision. Inputs must contain finite numeric coefficients, degree is capped at sixty-four, and coefficient magnitude is bounded.

When to use a polynomial LCM calculator

Polynomial LCMs appear whenever several rational expressions need a common denominator. Factoring every denominator by hand is educational, but it becomes error-prone when factors repeat or arrive as expanded coefficient lists. Computing the LCM supplies a denominator containing each factor at the greatest multiplicity required by either expression, without duplicating factors already shared.

The same operation helps when solving polynomial congruences, comparing ideals in elementary algebra exercises, assembling common periods for linear recurrence operators, and testing computer-algebra code. Teachers can build answer keys that show not only the final LCM but also the GCD and product behind the identity. Students can compare an attempted factor-based answer with a coefficient-based result and see whether an extra common factor was mistakenly retained.

Use a factoring or polynomial-division capability when those intermediate forms are the actual goal.

Build common denominators

Find the smallest polynomial denominator divisible by both denominators before adding or comparing rational expressions.

Check algebra exercises

Verify a hand-computed LCM and inspect the GCD and raw product that justify removing one copy of shared factors.

How is the polynomial LCM computed?

The calculator finds a monic GCD with the Euclidean algorithm, multiplies the inputs, divides the product by that GCD, and normalizes the quotient to monic form.

How do I enter a polynomial?

Use a dense coefficient array in descending degree order. For example, [1, -3, 2] represents x^2 - 3x + 2.

Why is the answer monic?

Polynomial LCMs are unique only up to a nonzero constant factor. Making the leading coefficient one gives every equivalent result a consistent representation.

What if one polynomial already divides the other?

Then the least common multiple is simply the larger one, scaled so it starts with 1. If the two share no factor at all, the answer is their product, also scaled to start with 1.

What happens if one of the polynomials is zero?

With exactly one zero input you get the zero polynomial back, following the usual convention that any nonzero polynomial divides zero. Two zero inputs cannot be combined and are turned down.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/algebra/polynomial-lcm

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/algebra/polynomial-lcm \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":[1,-3,2],"b":[1,-1]}'
{
  "a": [
    1,
    -3,
    2
  ],
  "b": [
    1,
    -1
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.polynomial_lcm",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_degree64
max_abs_coefficient1000000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Use the browser calculator freely for study and quick checks, or call the API for $0.002 per successful request when software needs the same reproducible result.

How product divided by GCD is calculated

These constraints keep every loop finite and prevent malformed arrays, Infinity, or NaN from creating ambiguous JSON output.

When to use a polynomial LCM calculator

The free browser path and API execute the same pure solve function, so an example checked interactively can later become an automated request without a change in semantics. A successful API calculation costs $0.002; invalid input is rejected before a useful result is returned. This tool is intentionally focused: it does not factor polynomials into irreducibles, solve for roots, or return long-division working line by line.

Create deterministic test fixtures

Generate stable coefficient arrays and readable polynomial strings for polynomial-library unit tests and teaching software.

What happens when one polynomial is zero?

The LCM is returned as [0]. If both inputs are zero, the request is rejected because gcd(0, 0) is undefined in this product-over-GCD contract.

What does it cost?

The calculation is free in your browser. A successful API request costs $0.002; invalid inputs are not charged.

Read the full KIT documentation →