๐Ÿ‡บ๐Ÿ‡ธ USC
Math & Conversion
๐Ÿ”บ

Binomial Expansion Calculator

Expand (a + b)n with the binomial theorem, term by term

The binomial theorem expands (a + b)n as the sum of the terms C(n, k) · an−k · bk for k = 0 to n, where C(n, k) = n! ÷ (k!(n − k)!) is the k-th number in row n of Pascal's triangle. For example, (2x + 3)5 = 32x5 + 240x4 + 720x3 + 1,080x2 + 810x + 243. This calculator expands any (ax + by)n up to n = 30 with exact coefficients.

โœ…

Last updated October 2026

Method: The binomial theorem (a + b)n = Σ C(n, k) an−k bk, with every C(n, k) built from Pascal's rule C(n, k) = C(n − 1, k − 1) + C(n − 1, k) in exact big-integer arithmetic. Decimal and fractional coefficients are converted to exact fractions, so no coefficient is ever rounded.

Included: The full expansion of (axp + byq)n for n from 0 to 30; whole-number, decimal and fractional coefficients; negative or higher powers on each variable; a term finder by position or by power; middle terms; the sum and alternating sum of the coefficients; every term step by step; and Pascal's triangle.

Not included: Negative or fractional exponents n (the infinite binomial series), trinomials and other multinomials, letter coefficients with unknown values, and radicals.

๐Ÿ”บ Enter your binomial

First term (a ยท x)
Second term (b ยท y)

Coefficients accept whole numbers, decimals and fractions (3, โˆ’2, 0.5, 3/4). Leave a variable blank for a constant term, and use a negative power for terms like 2/x (coefficient 2, variable x, power โˆ’1).

Try:

๐Ÿ”บ Expansion of (2x + 3)5

32x5 + 240x4 + 720x3 + 1,080x2 + 810x + 243
Terms in the expansion
6
Sum of C(n, k) = 2โฟ
32
Sum of coefficients (a + b)โฟ
3,125
Middle terms
T3 = 720x3
T4 = 1,080x2

๐ŸŽฏ Find a specific term

Term 3 (r = 2)
Tr+1 = C(n, r) ยท anโˆ’r ยท br = C(5, 2) ยท 23 ยท 32
= 10 ร— 8 ร— 9 = 720
T3 = 720x3

Positions count from 1, so term k uses r = k โˆ’ 1 in the general term C(n, r) anโˆ’r br.

๐Ÿงฎ Every term, step by step

kC(n, r)anโˆ’rbrCoefficientTerm
113213232x5
25163240240x4
31089720720x3
4104271,0801,080x2
55281810810x
611243243243

Highlighted rows are the middle terms. Largest coefficient in absolute value: 1,080 at position 4.

โœ”๏ธ Quick checks

Sum of all coefficients = (a + b)โฟ
3,125
Alternating sum = (a โˆ’ b)โฟ
โˆ’1
Sum of binomial coefficients in row 5
25 = 32
Largest binomial coefficient in row 5
C(5, 2) = 10

๐Ÿ”ข Pascal's triangle, rows 0 to 5

1
11
121
1331
14641
15101051

Each entry is the sum of the two entries above it. Row n lists C(n, 0) to C(n, n), the binomial coefficients of (x + y)n; your row is highlighted.

Everything is computed in your browser with exact integer and fraction arithmetic, so no coefficient is ever rounded. The general term is C(n, r) anโˆ’r br with C(n, r) = n! รท (r! (n โˆ’ r)!).

Binomial theorem, expansion and Pascal's triangle explained

A binomial expansion calculator rewrites a power such as (2x + 3)5 as a sum of terms. Instead of multiplying five copies of (2x + 3), the binomial theorem jumps straight to the answer and can produce any single term on its own.

The binomial theorem formula

For any numbers or expressions a and b and any whole number n:

(a + b)n = Σk=0..n C(n, k) · an−k · bk C(n, k) = n! ÷ (k! × (n − k)!) general term: Tr+1 = C(n, r) · an−r · br

Three facts follow at once. The expansion has n + 1 terms. In every term the exponents of a and b add up to n, with the power of a falling from n to 0 as the power of b rises from 0 to n. And the coefficients are symmetric, C(n, k) = C(n, n − k), so the second half of each row mirrors the first. When a and b carry their own numbers, as in (2x + 3), those numbers are raised to the same powers and multiplied into each coefficient.

Worked example 1: expanding (2x + 3)5

Here a = 2x, b = 3 and n = 5. Row 5 of Pascal's triangle supplies the binomial coefficients 1, 5, 10, 10, 5, 1, and each term multiplies one of them by a power of 2 and a power of 3:

Position C(5, r) 25−r 3r Coefficient Term
1 (r = 0)13213232x5
2 (r = 1)5163240240x4
3 (r = 2)1089720720x3
4 (r = 3)104271,0801,080x2
5 (r = 4)5281810810x
6 (r = 5)11243243243

So (2x + 3)5 = 32x5 + 240x4 + 720x3 + 1,080x2 + 810x + 243. Two quick checks confirm it: the coefficients add up to 3,125, which is (2 + 3)5, and the outer terms are simply (2x)5 and 35. With n = 5 there are two middle terms, 720x3 and 1,080x2, and 1,080 is the largest coefficient.

Worked example 2: (x − 2y)4 and alternating signs

A minus sign belongs to the second term, so b = −2y. Its powers alternate in sign, (−2)0 = 1, (−2)1 = −2, then 4, −8 and 16, and they multiply row 4 of Pascal's triangle (1, 4, 6, 4, 1):

(x − 2y)4 = x4 − 8x3y + 24x2y2 − 32xy3 + 16y4

Every term keeps total degree 4 (x3y, x2y2, xy3), and the signs alternate because only odd powers of −2 are negative. The coefficients add up to (1 − 2)4 = 1, while the alternating sum 1 + 8 + 24 + 32 + 16 equals (1 + 2)4 = 81. Those two numbers are the fastest way to catch a dropped sign.

Finding one term without expanding everything

Exams often ask for a single term. Use the general term Tr+1 = C(n, r) an−r br and remember that position k means r = k − 1:

  • The 4th term of (3x − 2)7: r = 3, so T4 = C(7, 3)(3x)4(−2)3 = 35 × 81 × (−8) × x4 = −22,680x4.
  • The coefficient of x5 in (2x + 3)8: x5 needs 8 − r = 5, so r = 3 and the coefficient is C(8, 3) × 25 × 33 = 56 × 32 × 27 = 48,384.
  • The term independent of x in (x2 + 2/x)6: the general term holds x2(6−r) · x−r = x12−3r. Setting 12 − 3r = 0 gives r = 4, so the constant term is T5 = C(6, 4) × 24 = 15 × 16 = 240.

The calculator's term finder covers both question types: By position returns Tk with every factor shown, and By power searches for the term that contains a chosen power of a variable. For the last example, enter coefficient 2, variable x and power −1 as the second term.

Pascal's triangle: where the coefficients come from

Pascal's triangle starts with a 1 at the top; every other entry is the sum of the two entries above it. Row n, counted from 0, holds C(n, 0) through C(n, n), the coefficients of (a + b)n. These are rows 0 to 10, each with its sum:

Row n Binomial coefficients C(n, 0) to C(n, n) Sum (2n)
011
11 12
21 2 14
31 3 3 18
41 4 6 4 116
51 5 10 10 5 132
61 6 15 20 15 6 164
71 7 21 35 35 21 7 1128
81 8 28 56 70 56 28 8 1256
91 9 36 84 126 126 84 36 9 1512
101 10 45 120 210 252 210 120 45 10 11,024

Reading the triangle gives expansions instantly: row 6 means (x + 1)6 = x6 + 6x5 + 15x4 + 20x3 + 15x2 + 6x + 1. The calculator draws rows 0 to 15 as a triangle and lists the full row n for larger exponents.

The largest coefficient and the middle term

Binomial coefficients rise toward the middle of each row and fall again, so the middle term always carries the largest one. As n grows, that central coefficient gets enormous while taking a shrinking share of the row total:

n Terms Largest C(n, k) Row sum 2n Share of the sum
56103231.25%
10112521,02424.61%
15166,43532,76819.64%
2021184,7561,048,57617.62%
25265,200,30033,554,43215.50%
3031155,117,5201,073,741,82414.45%

For odd n the largest value appears twice, in the two middle terms (C(15, 7) = C(15, 8) = 6,435). Once a and b differ, the largest coefficient of the full expansion moves toward the side of the bigger number: in (2x + 3)5 it is the 4th term, where 3 carries the higher power. At n = 30 the middle coefficient already has nine digits, which is why the calculator uses exact integers instead of ordinary floating-point numbers.

Sum of the coefficients and other quick checks

Substituting 1 for every variable turns any expansion into a single number, which gives free checks on hand work:

  • Sum of all coefficients = (a + b)n. (2x + 3)5 gives 3,125; (3x − 2)7 gives exactly 1, even though its terms run from 2,187x7 down to −128.
  • Alternating sum = (a − b)n. For (3x − 2)7 this is 57 = 78,125.
  • Sum of row n of Pascal's triangle = 2n. Row 10 adds up to 1,024.
  • First and last terms are always an and bn.

How to use this calculator

Enter the first term as a coefficient, a variable letter and the power on that variable, then the second term the same way, then the exponent n. Coefficients accept whole numbers, decimals and fractions (3, −2, 0.5, 3/4). Leave a variable blank for a constant term, and use a negative power for terms like 2/x. The result card shows the expansion, the number of terms, the sum of the coefficients, 2n and the middle term or terms. Below it you can find any term by position or by power, read every term step by step with C(n, r), an−r and br in separate columns, and see Pascal's triangle with your row highlighted.

Who this calculator is for

Algebra 2 and precalculus students check expansions and term questions, and the step-by-step columns show where a homework answer went wrong. Statistics students meet the same coefficients in the binomial distribution: the number of ways to get 3 heads in 10 coin flips is C(10, 3) = 120. Calculus students use binomial expansions when they approximate powers or derive series, and teachers use the calculator to build answer keys with fractional or negative coefficients.

Key terms

  • Binomial: a sum or difference of two terms, such as 2x + 3 or x − 2y.
  • Binomial coefficient C(n, k): n! ÷ (k!(n − k)!), read "n choose k" and written nCr on calculators.
  • General term: Tr+1 = C(n, r) an−r br, the formula for any single term.
  • Middle term: the central term (n even) or pair of terms (n odd), carrying the largest binomial coefficient.
  • Constant term: the term in which the variable's exponent is zero.
  • Pascal's triangle: the triangular table of binomial coefficients in which each entry is the sum of the two above it.

What changes the expansion

  • The exponent n sets the number of terms (n + 1) and the row of Pascal's triangle.
  • The coefficients a and b scale each term by an−r br, which shifts the largest coefficient toward the bigger of the two.
  • A negative b makes the signs alternate; a negative a does the same, starting with the sign of an.
  • Powers on the variables change only the exponents: (x2 + 1)4 has the coefficients of (x + 1)4 on x8, x6, x4, x2 and 1.
  • Fractions stay exact: (x/2 + 3)4 begins with (1/16)x4, and its coefficients sum to (7/2)4 = 2,401/16.

Tips and limitations

When expanding by hand, step from one coefficient to the next with the ratio Tr+1 ÷ Tr = (n − r + 1)/r × b/a: in (2x + 3)5, 32 × 7.5 = 240, 240 × 3 = 720, 720 × 1.5 = 1,080. Use the symmetry of Pascal's triangle to halve the work, and finish with the sum check.

The theorem as used here needs a whole-number exponent: negative and fractional exponents lead to Newton's infinite binomial series, and three or more terms, such as (x + y + z)n, need the multinomial theorem. Coefficients must be numbers, and n is capped at 30 for readability, not precision.

Related calculators

Sources

โš ๏ธ Common mistakes & edge cases

Writing (a + b)n as an + bn

(x + 3)2 is x2 + 6x + 9, not x2 + 9. Every term between the first and the last is missing from that shortcut, and those middle terms carry the largest coefficients.

Forgetting to raise the coefficient

In (2x + 3)5 the first term is (2x)5 = 32x5, not 2x5. The number in front of the variable is part of a and gets the same power.

Dropping the minus sign

For (x − 2y)4, b is −2y, so odd powers of b are negative. Writing every term with a plus sign gives a sum of 81 instead of the correct 1.

Off by one in the term number

The k-th term uses r = k − 1. Plugging r = 4 into (3x − 2)7 gives the 5th term, 15,120x3, not the 4th term, −22,680x4.

Using the wrong row of Pascal's triangle

Rows are counted from 0, so the coefficients of the 5th power come from row 5 (1, 5, 10, 10, 5, 1), which is the sixth line of the triangle.

Same variable in both terms

(2x + 3x)3 is not a true binomial: it is (5x)3 = 125x3, and the calculator combines the like terms to show exactly that.

Note: Coefficients are exact fractions. Decimal approximations appear only as a reading aid next to fractional coefficients.

❓ Frequently asked questions

What is the binomial theorem?

The binomial theorem gives the expansion of any power of a sum: (a + b)^n = C(n, 0)a^n + C(n, 1)a^(nโˆ’1)b + C(n, 2)a^(nโˆ’2)b^2 + โ€ฆ + C(n, n)b^n. Each term has the form C(n, k) a^(nโˆ’k) b^k, where C(n, k) = n! รท (k!(n โˆ’ k)!) is a binomial coefficient. The powers of a fall from n to 0 while those of b rise from 0 to n.

How do you expand a binomial like (x + 1)^n?

When both coefficients are 1, the expansion is simply row n of Pascal's triangle attached to falling powers of x. Row 6 is 1, 6, 15, 20, 15, 6, 1, so (x + 1)^6 = x^6 + 6x^5 + 15x^4 + 20x^3 + 15x^2 + 6x + 1. With other coefficients, multiply each binomial coefficient by the matching powers of a and b, as in (2x + 3)^5 = 32x^5 + 240x^4 + 720x^3 + 1,080x^2 + 810x + 243.

How do I find the kth term of a binomial expansion?

Use the general term with r = k โˆ’ 1: T(k) = C(n, k โˆ’ 1) ร— a^(n โˆ’ k + 1) ร— b^(k โˆ’ 1). For the 3rd term of (x + 2)^6, r = 2, so T(3) = C(6, 2) ร— x^4 ร— 2^2 = 15 ร— 4 ร— x^4 = 60x^4. The shift between position k and index r is the most common source of wrong answers.

How do I find the coefficient of x^m in a binomial expansion?

Write the exponent of x in the general term and set it equal to m. In (2x โˆ’ 1)^7 the general term is C(7, r)(2x)^(7 โˆ’ r)(โˆ’1)^r, so x^3 needs 7 โˆ’ r = 3, which gives r = 4. The coefficient is C(7, 4) ร— 2^3 ร— (โˆ’1)^4 = 35 ร— 8 = 280. The calculator's By power finder does this search for you.

What is the middle term of a binomial expansion?

An expansion of (a + b)^n has n + 1 terms. If n is even there is one middle term, at position n/2 + 1; if n is odd there are two, at positions (n + 1)/2 and (n + 3)/2. For (x + y)^8 the middle term is the 5th, C(8, 4)x^4y^4 = 70x^4y^4. Its binomial coefficient is the largest in that row of Pascal's triangle.

How is Pascal's triangle related to the binomial theorem?

Row n of Pascal's triangle lists the binomial coefficients C(n, 0) through C(n, n), which are exactly the coefficients of (a + b)^n. Each entry is the sum of the two entries above it, which is the identity C(n, k) = C(n โˆ’ 1, k โˆ’ 1) + C(n โˆ’ 1, k). Rows are counted from 0, so row 5 (1, 5, 10, 10, 5, 1) belongs to the fifth power.

What is the sum of the coefficients in a binomial expansion?

Set every variable to 1 and the expansion collapses to (a + b)^n, so the coefficients of (ax + by)^n always add up to (a + b)^n. For (2x + 3)^5 that is 5^5 = 3,125, and for (x โˆ’ 2y)^4 it is (1 โˆ’ 2)^4 = 1. The plain binomial coefficients in row n add up to 2^n, and the alternating sum of the expansion equals (a โˆ’ b)^n.

How many terms are in the expansion of (a + b)^n?

There are n + 1 terms, one for each value of k from 0 to n, so (a + b)^30 has 31 terms. The count is smaller only when terms combine or vanish: if both parts use the same variable with the same power, all terms merge into one, and a zero coefficient removes every term containing it.

What does n choose k mean?

n choose k, written C(n, k) or nCr, is the number of ways to pick k items from n when order does not matter, computed as n! รท (k!(n โˆ’ k)!). For example C(8, 3) = 40,320 รท (6 ร— 120) = 56. In an expansion it counts the ways to take b from k of the n factors, which is why it becomes the coefficient.

Can the binomial theorem be used with negative or fractional exponents?

Yes, but the result is an infinite series rather than a finite expansion. Newton's generalized binomial series gives (1 + x)^(โˆ’1) = 1 โˆ’ x + x^2 โˆ’ x^3 + โ€ฆ, which converges only for โˆ’1 < x < 1. This calculator handles whole-number exponents from 0 to 30, where the expansion is finite and every coefficient can be shown exactly.

๐Ÿ’ก Good to know

Each coefficient counts choices

Expanding (a + b)n means picking a or b from each of the n factors. C(n, k) counts the ways to pick b exactly k times, which is why the same numbers count committees, card hands and coin-flip outcomes.

From coefficients to probabilities

Divide row n by 2n and you get the probabilities of 0 to n heads in n fair coin flips. Exactly 3 heads in 10 flips has probability 120 ÷ 1,024 = 11.72%.

Symmetry halves the work

Because C(n, k) = C(n, n − k), each row of Pascal's triangle reads the same in both directions. Compute up to the middle, then mirror the rest.

Related Calculators