Introduction
A binomial is a sum of two terms, such as (x + y), (x − y), or the more general form used here, (ax + by). When you raise a binomial to a whole-number power, the result is a polynomial with a very regular structure. The powers of x step downward one at a time, the powers of y step upward one at a time, and the numeric multipliers follow a combinatorial pattern. The binomial theorem lets you compute that pattern directly instead of multiplying the binomial by itself over and over.
This calculator expands (ax + by)n where a and b are real numbers, including decimals, and n is a non-negative integer. The output includes a readable expanded expression and a table listing every term index k, the resulting coefficient, and the variable part for that term. Because the calculation runs entirely in your browser, you can try examples quickly without sending anything to a server.
In many courses the topic first appears with small cases such as (x + y)2 or (x + y)3. The same theorem, however, also handles higher powers, non-unit coefficients, and negative coefficients. That is why a tool like this is useful for checking sign changes, comparing patterns from Pascal’s triangle, and seeing how the coefficient and exponent rules interact in one place.
How to use
- Enter Coefficient a, the multiplier on x.
- Enter Coefficient b, the multiplier on y.
- Enter Exponent n as a whole number: 0, 1, 2, 3, and so on.
- Select Expand (ax + by)n.
- Read the expanded expression and the term table. Use Copy terms if you want the results on your clipboard.
If you want the standard classroom form (x + y)n, set a = 1 and b = 1. If you want (2x − 3y)n, enter a = 2 and b = −3. Decimal coefficients are also allowed, so examples such as (0.5x + 1.25y)n work as well.
A quick self-check helps when you are learning. When n = 0, the expansion should be 1. When n = 1, the output should match the original binomial ax + by. Those edge cases are simple, but they reveal whether your setup makes sense before you move on to larger exponents.
The binomial theorem states that for a non-negative integer n:
Formula: (a+b)^n = ∑ k = 0 n (n / k) a^n−k b^k
For this calculator, substitute a → ax and b → by. Each term in the expansion becomes:
Formula: (n / k) a^n−k b^k x^n−k y^k
The factor (n choose k) is the binomial coefficient. It also appears in Pascal’s triangle, and it counts the number of ways to choose k copies of the by term from the n factors in a product such as (ax + by)(ax + by)…. That counting interpretation is the reason the algebraic pattern is so reliable.
One especially useful symmetry is (n choose k) = (n choose n − k). That symmetry explains why Pascal’s triangle reads the same from left to right and right to left. Even when a and b are not equal, the term positions still follow that mirrored combinatorial structure.
Worked example
Example: expand (2x + 3y)4. Here a = 2, b = 3, and n = 4. The calculator evaluates each term for k = 0 through k = 4.
- k = 0: (4 choose 0) · 24 · 30 · x4 · y0 = 16x4
- k = 1: (4 choose 1) · 23 · 31 · x3 · y = 96x3y
- k = 2: (4 choose 2) · 22 · 32 · x2 · y2 = 216x2y2
- k = 3: (4 choose 3) · 21 · 33 · x · y3 = 216xy3
- k = 4: (4 choose 4) · 20 · 34 · y4 = 81y4
So the expansion is 16x^4 + 96x^3y + 216x^2y^2 + 216xy^3 + 81y^4. If you repeat the same example with a negative coefficient, such as (2x − 3y)4, the odd powers of b produce negative terms and the even powers produce positive terms. That alternating sign pattern is exactly the kind of detail this calculator helps you verify.
A second sanity check is substitution. If you set x = 1 and y = 1, then the original expression becomes (2 + 3)4 = 625. If the expansion is correct, the expanded polynomial should also evaluate to 625 at those same values.
Interpreting the output
After you submit the form, the calculator shows a result summary, a term table, and the full expression. The table is useful when you want to inspect the expansion step by step, while the single-line expression is more convenient if you want something easy to copy into notes or homework.
- Term table: each row corresponds to one value of k. The coefficient combines (n choose k), an−k, and bk. The term column shows the matching powers of x and y.
- Expanded expression: this joins all nonzero terms with the correct plus and minus signs, using caret notation such as x^4 for powers.
Terms whose computed coefficients are effectively zero are omitted from the display. That mainly matters when one of the numeric coefficients is zero. For example, if a = 0, every term involving x disappears and only the final y term survives. If b = 0, the opposite happens and only the first term remains.
Display formatting is rounded for readability. Very large values or very small nonzero values may appear in scientific notation. That does not change the underlying mathematics; it only keeps the result compact enough to read.
Pascal’s triangle reference
The first few rows of Pascal’s triangle give the binomial coefficients for expansions of (x + y)n. This calculator computes the coefficients directly, which is more flexible for general inputs, but the pattern is the same. If you are studying the theorem, try setting a = 1 and b = 1 and compare the calculator output to the rows below.
Two patterns are worth keeping in mind. First, the outer edges are always 1. Second, every interior number equals the sum of the two numbers above it. A related check is that the sum of the coefficients in row n is 2n. So if you expand (x + y)n and then substitute x = 1 and y = 1, the result should be 2n.
Once you see that pattern, the rest of the expansion becomes easier to remember. The exponents move in opposite directions, the coefficients come from counting choices, and the sign behavior follows the sign of b raised to the power k. Those three ideas explain nearly every term in the table you see below the calculator.
Yes. Enter a negative value for b. For example, to expand (x − y)5, set a = 1, b = −1, and n = 5. The signs in the resulting expression will alternate according to the odd and even powers of b.
Scientific notation is used when the number is very large or very small and a long decimal would be harder to read. The value has not changed; only the display format has changed.
Students use binomial expansion to practice algebraic manipulation, recognize coefficient patterns, connect algebra with counting, and support later work in probability and calculus. This page is designed to make those links visible by pairing a full expression with a term-by-term breakdown.