ForHosting KIT · Math

Box method calculator

(2 + 3x) times (4 + 5x) fills four boxes with 8, 10x, 12x and 15x², and the two middle boxes combine into the x term of the product. Enter each binomial's two coefficients and see every partial product, so no cross term is lost. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

You send the two coefficients of each binomial, constant term first, and get back the four partial products laid out as box cells together with the expanded polynomial coefficients. It is the distributive property made visible — every cross term accounted for, nothing dropped — and it returns in one deterministic call what a student would otherwise write out by hand.

What the box method actually does

Multiplying (a0 + a1·x) by (b0 + b1·x) means applying the distributive property twice, and the classic failure mode is forgetting one of the cross terms. The box method multiplication layout prevents that by drawing a two-by-two grid: the terms of one binomial label the rows, the terms of the other label the columns, and each cell holds the product of its row and column labels. The four cells are a0·b0, a0·b1·x, a1·b0·x and a1·b1·x².

Add them, combine the two like terms in x, and the expanded polynomial falls out. Because the input is just two pairs of numbers, there is nothing to parse, no expression syntax to learn, and no ambiguity about sign: negative coefficients are simply negative numbers.

Input format and output shape

Send a and b, each an array of exactly two finite numbers in constant-term-first order: [2, 3] means 2 + 3x. All emitted numbers are rounded to six decimals so the output is byte-stable across machines.

Where it fits in practice

The capability is aimed at education and at lightweight symbolic plumbing. Tutoring apps and homework checkers use it to render the full grid for a student's exercise, comparing each cell against the student's own work instead of only the final answer. Content pipelines use it to generate worked examples in bulk, because the expression strings in each cell are already formatted for display.

Developers wiring small math tools use it as a safe, side-effect-free multiply for degree-one factors — for instance when expanding factored form back into standard form before evaluation.

Render a worked example

Show the full two-by-two box with each cell's multiplication for an algebra lesson or answer key.

Check student homework cell by cell

Compare each of the four partial products against a student's grid to find exactly which term went wrong.

Expand factored form programmatically

Turn two degree-one factors into standard-form coefficients inside a pipeline without a CAS dependency.

Can coefficients be negative or fractional?

Yes. Any finite number works — negatives, decimals and zero are all valid coefficients.

Does it handle trinomials or higher degrees?

No. The box method here is the classic two-by-two case for two binomials. For higher-degree products use a general polynomial multiplication capability.

Is the result deterministic?

Yes. It is a pure function with no randomness or clock, and all numbers are rounded to six decimals so output is stable across machines.

In which order do I enter the coefficients?

Constant term first, then the number in front of x. Entering 2 and 3 means 2 + 3x, and entering 4 and 5 means 4 + 5x. Negative coefficients are simply typed as negative numbers.

How does the box method stop me from missing a term?

Each of the four cells holds the product of one row label and one column label, so both cross terms, here 10x and 12x, are always on the grid before you combine them into a single x term.

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/math/box-method

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/math/box-method \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":[2,3],"b":[4,5]}'
{
  "a": [
    2,
    3
  ],
  "b": [
    4,
    5
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.box_method",
  "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.

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.

The box method API multiplies two binomials the way algebra classes teach it: as the area of a rectangle split into four cells. The same code runs free in your browser on this page and costs $0.002 per request when you automate it through the API.

What the box method actually does

This endpoint performs exactly that construction from raw coefficients and returns both views — the individual box cells so you can show the working, and the combined coefficients so you can use the result programmatically.

Input format and output shape

The response has three parts. binomials echoes the two binomials as interpreted, so a client can confirm what was understood. box carries the grid itself: row and column labels plus a terms array with one entry per cell, each entry naming the cell, showing the multiplication as a readable expression, giving its numeric value and noting the degree of x it contributes to. product.coefficients is the expanded result, again constant term first: the constant cell, the sum of the two linear cells, and the quadratic cell. Any coefficient that is missing, not a number, or not finite — NaN, Infinity, a string, a null — is rejected with an invalid_input error and no result.

Where it fits in practice

It runs as a pure function on our edge with no state and no network access, so results are identical on every call and every region, and the free browser version on this page executes the very same module the paid API does. The price is $0.002 per request, with no per-term or per-size surcharge.

What does it cost?

$0.002 per request via the API. It is also free to run in your browser on this page — the same module executes in both places.

What input does it expect?

Two arrays, a and b, each with exactly two finite numbers, constant term first: [2, 3] is the binomial 2 + 3x.

What happens with NaN, Infinity or a string?

The request is rejected with an invalid_input error naming the offending binomial, and nothing is charged.

Read the full KIT documentation →