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
Run — free
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.
What you can do with it
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.
FAQ
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.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
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]}'const res = await fetch("https://api.kit.forhosting.com/math/box-method", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": [
2,
3
],
"b": [
4,
5
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/box-method",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": [
2,
3
],
"b": [
4,
5
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/box-method", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":[2,3],"b":[4,5]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":[2,3],"b":[4,5]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/box-method", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": [
2,
3
],
"b": [
4,
5
]
}Example response
{
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
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.
Technical questions
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.