ForHosting KIT · Math

Binomial expansion calculator

(a + b)^4 expands to a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4: enter the power and see every term with its coefficient and exponents, ready to compare with your own working. 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
Exponent n
4
You get
First text
a
Second text
b
Term count
5
Coefficients
1, 4, 6, 4, 1

The binomial theorem expands a quantity of the form a plus b raised to a non-negative integer power into a finite sum of monomials. Each term carries a binomial coefficient C of n choose k, the remaining power of a, and the rising power of b, so students and pipelines can see not only the simplified polynomial string but also the structured coefficient and exponent data behind every summand.

What the binomial theorem returns and how to choose n

Write the expression as open parenthesis a plus b close parenthesis to the power n, where n is a non-negative integer. The theorem states that the expansion equals the sum from k equals zero to n of C of n choose k times a to the power n minus k times b to the power k.

For n equals zero the expansion is the single constant one; for n equals one it is simply a plus b; for larger n you get n plus one terms whose coefficients are the familiar Pascal row. Negative integers are invalid input because this product is the classical finite expansion taught in algebra courses, not the infinite generalized binomial series for real exponents. Non-integers are also rejected so the response never pretends to finish an infinite series.

Optional fields a and b rename the two summands for display, so you can expand x plus y or p plus q without changing the mathematics.

Homework and exam verification

Students and graders expand (a+b)^n for small n, compare coefficients and powers term by term, and get a clear error when a negative exponent is submitted by mistake.

Can I rename a and b?

Yes. Optional fields a and b accept short identifiers (for example a: "x", b: "y") so the expansion displays as (x + y)^n with matching term strings.

Is the binomial expansion calculator free?

The browser tool runs free on your device.

What happens if n is negative?

A negative or fractional exponent is refused, because it would lead to an infinite series rather than a finite expansion. Only whole powers from 0 upward are expanded, so the result is always complete.

How many terms does (a + b)^n have?

Always n + 1. For the fourth power you get five terms, a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4, with the coefficients 1, 4, 6, 4, 1 from Pascal's triangle.

What is the highest power I can expand?

Powers up to 200, which covers every classroom exercise. Each coefficient is computed exactly, and you see every term with its own powers of a and b, not only the joined polynomial.

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/binomial-expansion

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/binomial-expansion \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":4}'
{
  "n": 4
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.binomial_expansion",
  "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.

This capability computes that expansion deterministically with exact integer arithmetic, rejects negative integer exponents with a clear invalid input error, and returns JSON that homework checkers, tutoring apps, and lightweight algebra services can pin in tests without installing a computer-algebra system.

What the binomial theorem returns and how to choose n

Send the required field n as a JSON integer or an integer string; aliases power and exponent are accepted when documented. The engine caps n at two hundred for Worker isolate safety while still covering every classroom exercise and most symbolic pipelines. Identical inputs always produce identical JSON because the path is pure arithmetic with no network, no random seed, and no wall clock.

Reading terms, coefficients, powers, and the expansion string

The expansion field joins those terms with plus and minus signs into a single readable polynomial, and identity restates open parenthesis a plus b close parenthesis to the n equals that expansion for quick display in UIs. Use coefficients alone when you only need Pascal-row numbers; use terms when grading software must check exponents separately from coefficients; use expansion when a human or report needs a single line. On success the response echoes n, the display names a and b, term_count equal to n plus one, and a coefficients array listing C of n choose zero through C of n choose n. The terms array is the structured heart of the contract: each entry includes the index k, the binomial coefficient, power_a equal to n minus k, power_b equal to k, and a short term string such as four a cubed b for the middle of n equals four. Large coefficients that exceed safe JSON integers are emitted as decimal strings so exactness is preserved without floating-point drift. The method label is always binomial_theorem so downstream code can branch without sniffing shapes. Missing n, non-integer n, n above the cap, and negative n all fail with invalid_input and are not charged. Custom a and b must be short identifiers so display strings stay safe for HTML and SDK demos.

API usage, pricing, classroom workflows, and practical limits

Call the free in-browser binomial expansion calculator for homework checks, lecture demos, and quick mental-math verification without installing Maxima, SymPy, or a local CAS. Degree and coefficient magnitude grow with n, so keep exponents within the published cap and prefer classroom-scale inputs for grading oracles. Authors shipping SDKs can map the terms array directly into UI tables that show coefficient, power of a, and power of b columns—the same shape students see on paper when they apply the binomial theorem by hand. Send a JSON body with the required non-negative integer n and optional string fields a and b for summand names. Use the prepaid API when a tutoring platform, coding-assessment sandbox, curriculum generator, or algebra pipeline needs a stable contract under KIT balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with a Pascal triangle generator when you want rows without powers, or with polynomial tools when the next step is synthetic division of the expanded result.

Tutoring and curriculum generators

Lesson builders produce worked binomial expansions with structured JSON for flashcards, step sheets, and auto-graded drills without embedding a full computer-algebra stack.

Lightweight symbolic pipelines

Scripts that need exact binomial coefficients and monomial powers call a stable prepaid endpoint instead of reimplementing C(n,k) in every language.

How do I expand (a+b)^n with this calculator?

Send JSON with n set to a non-negative integer (for example n: 4). The response includes each term's coefficient, power_a, power_b, and a full expansion string.

What happens if n is negative?

The request fails with invalid_input. This capability implements the classical finite binomial expansion for non-negative integers only; negative exponents are rejected and not charged.

How are large coefficients returned?

Coefficients use exact integer arithmetic. Values within safe JSON integers are numbers; larger values are decimal strings so no precision is lost.

Read the full KIT documentation →