# Polynomial division check

`polynomial-division-check` · version 1.0.0 · Numbers & math · free, no key needed

Check a claimed polynomial division A = BQ + R over exact rationals: remainder degree, quotient degree, coefficients.

**Use when you need to: check a polynomial long division result · verify quotient and remainder of polynomial division · is this synthetic division correct.**

## Decide before calling

Read the [versioned contract](/v1/tools/polynomial-division-check/versions/1.0.0) and the supported scope below. Reuse `polynomial-division-check@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `polynomial-division-check@1.0.0` for check a polynomial long division result. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- check a polynomial long division result
- verify quotient and remainder of polynomial division
- is this synthetic division correct
- check that a polynomial divides another exactly
- validate remainder degree is less than divisor degree
- verify a = b times q plus r for polynomials

## Not supported

- performing the division (supply the claimed quotient and remainder)
- division over finite fields or integers modulo m
- multivariate or pseudo-division conventions
- floating-point coefficients

## Behavior

- Polynomials are canonical ascending coefficient arrays (entry k = coefficient of x^k, last entry nonzero, [] = zero) of exact rational strings (<= 40 characters), degree <= 64. Euclidean division over Q: A = BQ + R with R = 0 or deg R < deg B (Cohen 1993, s3.1.3; reference_version cohen-gtm138-1993-ch3).
- Divisor [] is not_computable. remainder may be omitted, which claims R = 0 (exact divisibility).
- Order: (1) R = 0 or deg R < deg B (remainder_degree_violation); (2) deg Q = deg A - deg B when deg A >= deg B, else Q = 0 (quotient_degree_violation, "-infinity" denotes the zero polynomial); (3) A = BQ + R compared from degree 0 upward (identity_mismatch, lowest disagreeing coefficient). first_discrepancy is {check, factor_index: null, degree, lhs, relation, rhs}.
- dividend_degree, divisor_degree, quotient_degree and remainder_degree are always returned (null for a zero or omitted polynomial).

## Input

- `dividend` (array of string, required): max items 65; each max length 40; each pattern `^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\.[0-9]+)?$`
- `divisor` (array of string, required): max items 65; each max length 40; each pattern `^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\.[0-9]+)?$`
- `quotient` (array of string, required): max items 65; each max length 40; each pattern `^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\.[0-9]+)?$`
- `remainder` (array of string, optional): max items 65; each max length 40; each pattern `^-?(0|[1-9][0-9]*)(/[1-9][0-9]*|\.[0-9]+)?$`

## Output

- `valid` (boolean, required)
- `reason` (one of "remainder_degree_violation", "quotient_degree_violation", "identity_mismatch", null, required)
- `first_discrepancy` (object or null, required)
- `dividend_degree` (integer or null, required): min 0
- `divisor_degree` (integer, required): min 0
- `quotient_degree` (integer or null, required): min 0
- `remainder_degree` (integer or null, required): min 0
- `reference_version` (constant "cohen-gtm138-1993-ch3", required)

## Limits

- max degree: 64
- max number chars: 40

## Example

Request input:

```json
{
  "dividend": [
    "-4",
    "0",
    "-2",
    "1"
  ],
  "divisor": [
    "-3",
    "1"
  ],
  "quotient": [
    "3",
    "1",
    "1"
  ],
  "remainder": [
    "5"
  ]
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "reason": null,
    "first_discrepancy": null,
    "dividend_degree": 3,
    "divisor_degree": 1,
    "quotient_degree": 2,
    "remainder_degree": 0,
    "reference_version": "cohen-gtm138-1993-ch3"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "polynomial-division-check",
  "version": "1.0.0",
  "input": {
    "dividend": [
      "-4",
      "0",
      "-2",
      "1"
    ],
    "divisor": [
      "-3",
      "1"
    ],
    "quotient": [
      "3",
      "1",
      "1"
    ],
    "remainder": [
      "5"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/polynomial-division-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"dividend":["-4","0","-2","1"],"divisor":["-3","1"],"quotient":["3","1","1"],"remainder":["5"]}'
```

The machine-readable contract is at [/v1/tools/polynomial-division-check/versions/1.0.0](/v1/tools/polynomial-division-check/versions/1.0.0).

### CLI

```sh
node cli.mjs run polynomial-division-check 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Linear residual check](/tools/linear-residual-check): Check a claimed residual r = b - A x (per component and/or its max norm) exactly for an approximate solution x.
- [Lp primal feasibility check](/tools/lp-primal-feasibility-check): Check that a claimed LP point satisfies x >= 0 and Ax <= b exactly; report the first violated bound or row.
- [Polynomial identity check](/tools/polynomial-identity-check): Check a polynomial identity over exact rationals by expanding both sides; report the lowest disagreeing coefficient.
- [Polynomial factorization check](/tools/polynomial-factorization-check): Check a claimed factorization c * prod f_i^e_i of a rational polynomial: monic distinct factors, degrees, coefficients.
- [Rational expression check](/tools/rational-expression-check): Check a claimed exact rational value of an integer/fraction expression; reports the true value and the difference.
- [Regression coefficients check](/tools/regression-coefficients-check): Check claimed least-squares regression coefficients against exact samples; reports rank and the first mismatch.
