ForHosting KIT · Math

Square of a binomial

Expand the square of a binomial in one step: (2x + 3)² becomes 4x² + 12x + 9, giving you the leading, middle and constant coefficients a², 2ab and b². 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
A
2
B
3
You get
Leading
4
Linear
12
Constant
9
Binomial
(2x + 3)^2

The square of a binomial is the first named special product every algebra student memorizes: the square of a sum is the first square plus twice the product plus the second square. Written on a linear binomial, that identity is (ax plus b) squared equals a squared times x squared plus two a b times x plus b squared, and the three numbers on the right are the quadratic coefficients of a perfect-square trinomial. Students search for this expansion by the classroom name square of a binomial rather than by the general binomial theorem, and they need those three coefficients instantly for homework, worksheet keys, and auto-graders. This capability accepts the two finite coefficients a and b, applies the identity with no symbolic engine, and returns the leading, linear, and constant coefficients together with compact display strings.

What the square of a binomial is and how the identity expands

In school algebra the square of a binomial is a named special product, not a general power. The two textbook families are (x plus y) squared equals x squared plus two x y plus y squared, and (x minus y) squared equals x squared minus two x y plus y squared. Allowing a non-unit leading coefficient, the same idea is (a x plus b) squared equals a squared x squared plus two a b x plus b squared.

Matching those three terms with a generic quadratic A x squared plus B x plus C therefore gives three locked coefficients: the leading term is a squared, the linear term is twice a times b, and the constant term is b squared. Those three multiplications are the entire algorithm.

Classic checks include a equals one and b equals three, which yields x squared plus six x plus nine; a equals two and b equals three, which yields four x squared plus twelve x plus nine; and a equals three and b equals negative two, which yields nine x squared minus twelve x plus four. A negative second coefficient is how the minus family is requested; there is no separate sign flag, because (a x minus b) is already (a x plus negative b).

Zero is legal on either side: if b is zero the expansion is a squared x squared, and if a is zero the expansion is the constant b squared. The identity is exact on ordinary textbook integers and is rounded to twelve decimal places only so nearby floating values compare byte for byte across runtimes.

This is not the binomial theorem for a free exponent n, and it is not a test that asks whether a given trinomial already is a square; it is the one-way expansion from two binomial coefficients to three quadratic coefficients.

The two numbers you enter and the three you get

On success the body echoes the cleaned coefficients a and b; returns leading equal to a squared, linear equal to two a b, and constant equal to b squared; and adds a binomial string such as (2x + 3) caret two plus an expanded string such as 4x caret two plus 12x plus 9. A formula string restates the identity so a client can print the rule next to the numbers.

Example: a equals two, b equals three yields leading four, linear twelve, constant nine, binomial (2x + 3)^2, and expanded 4x^2 + 12x + 9. Example of a minus family: a equals one, b equals negative five yields leading one, linear negative ten, constant twenty-five, binomial (x - 5)^2, and expanded x^2 - 10x + 25. Keep requests small, pin leading linear and constant in tests, and you get a reproducible trinomial for homework, LMS plugins, and edge workers without standing up a computer-algebra system.

Where a square-of-a-binomial expander earns its keep

Classrooms and tutoring platforms use a square of a binomial calculator so learners can confirm the middle-term identity without mixing it up with a general binomial expansion of (a plus b) to the n, and without running the inverse test that asks whether a finished trinomial happens to be a square. Exam-prep generators need a deterministic oracle that expands (2x plus 3) squared to four, twelve, nine and that rejects a non-finite coefficient instead of returning NaN that a buggy grader might treat as success.

Engineering notebooks that build a repeated-root characteristic polynomial or a perfect-square residual sometimes need the same two-coefficient expansion without pulling a computer-algebra system. Failed validation does not consume balance. Keep the two coefficients finite, pin the three quadratic coefficients in tests for the textbook identities you care about, and you get a reproducible expansion for homework, LMS plugins, and automation scripts.

Classroom and homework checks

Let students submit a and b for (ax+b)² and verify the returned leading, linear, and constant coefficients against the special-product identity they wrote by hand.

Exam and LMS auto-grading

Mark square-of-a-binomial items with a deterministic oracle that expands to a², 2ab, and b² and rejects a non-finite coefficient instead of inventing a trinomial.

Worksheet generators and notebooks

Build drills around (ax+b)² or assemble a repeated-root quadratic from two binomial coefficients without importing a full computer-algebra library.

What identity does the square of a binomial use?

The perfect-square trinomial identity (ax+b)² = a²x² + 2abx + b². A negative b is how you request (ax−b)²; there is no separate sign field.

What happens if a coefficient is missing or not a finite number?

NaN, plus or minus Infinity, empty strings, and non-numeric values are rejected and are not billed.

How is this different from binomial expansion or a perfect square trinomial checker?

A general binomial expander handles (a+b)^n for any n. A perfect-square-trinomial checker starts from ax²+bx+c and asks whether it factors as a square. This tool only expands (ax+b)² from the two binomial coefficients.

How do I expand a binomial with a minus sign, like (3x − 2)²?

Enter the second coefficient as a negative number. With 3 and −2 you get 9x² − 12x + 4: the middle term turns negative while both squares stay positive, so no separate sign option is needed.

What happens if one of the coefficients is zero?

Zero is allowed on either side. With the constant at zero the result is just a²x², and with the coefficient of x at zero the whole expansion collapses to the constant b².

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/square-of-a-binomial

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/square-of-a-binomial \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":2,"b":3}'
{
  "a": 2,
  "b": 3
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.square_of_a_binomial",
  "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.

Any coefficient that is not a finite number is rejected with invalid_input.

Input contract, response shape, and error behaviour

POST a JSON body with two required finite numbers: a, the coefficient of x in the binomial a x plus b, and b, the constant term of that binomial. Each field may arrive as a JSON number, a numeric string, or a simple fraction such as three slash four; the aliases A or first or p, and B or second or q, are accepted so scripts can reuse existing payloads, including the p and q that the inverse perfect-square-trinomial checker returns. Missing fields, empty strings, NaN, and plus or minus Infinity fail with invalid_input naming the field. Those failures are not billed. Pair the response with your own graphing code if you need a sketch of the parabola that just touches the axis; this endpoint expands the square and returns the three quadratic coefficients only.

Where a square-of-a-binomial expander earns its keep

Worksheet and LMS plugins that ask students to write the three quadratic coefficients can call this endpoint first, hide the numbers from the student, and then compare the submitted trinomial against leading, linear, and constant.

How do I expand the square of a binomial (ax + b)²?

Send finite numbers a and b. The API returns leading = a², linear = 2ab, and constant = b², plus display strings for (ax+b)² and the expanded trinomial.

What does the square of a binomial calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →