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
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).
๐บ Expansion of (2x + 3)5
๐ฏ Find a specific term
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
| k | C(n, r) | anโr | br | Coefficient | Term |
|---|---|---|---|---|---|
| 1 | 1 | 32 | 1 | 32 | 32x5 |
| 2 | 5 | 16 | 3 | 240 | 240x4 |
| 3 | 10 | 8 | 9 | 720 | 720x3 |
| 4 | 10 | 4 | 27 | 1,080 | 1,080x2 |
| 5 | 5 | 2 | 81 | 810 | 810x |
| 6 | 1 | 1 | 243 | 243 | 243 |
Highlighted rows are the middle terms. Largest coefficient in absolute value: 1,080 at position 4.
โ๏ธ Quick checks
๐ข Pascal's triangle, rows 0 to 5
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.
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) | 1 | 32 | 1 | 32 | 32x5 |
| 2 (r = 1) | 5 | 16 | 3 | 240 | 240x4 |
| 3 (r = 2) | 10 | 8 | 9 | 720 | 720x3 |
| 4 (r = 3) | 10 | 4 | 27 | 1,080 | 1,080x2 |
| 5 (r = 4) | 5 | 2 | 81 | 810 | 810x |
| 6 (r = 5) | 1 | 1 | 243 | 243 | 243 |
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) |
|---|---|---|
| 0 | 1 | 1 |
| 1 | 1 1 | 2 |
| 2 | 1 2 1 | 4 |
| 3 | 1 3 3 1 | 8 |
| 4 | 1 4 6 4 1 | 16 |
| 5 | 1 5 10 10 5 1 | 32 |
| 6 | 1 6 15 20 15 6 1 | 64 |
| 7 | 1 7 21 35 35 21 7 1 | 128 |
| 8 | 1 8 28 56 70 56 28 8 1 | 256 |
| 9 | 1 9 36 84 126 126 84 36 9 1 | 512 |
| 10 | 1 10 45 120 210 252 210 120 45 10 1 | 1,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 |
|---|---|---|---|---|
| 5 | 6 | 10 | 32 | 31.25% |
| 10 | 11 | 252 | 1,024 | 24.61% |
| 15 | 16 | 6,435 | 32,768 | 19.64% |
| 20 | 21 | 184,756 | 1,048,576 | 17.62% |
| 25 | 26 | 5,200,300 | 33,554,432 | 15.50% |
| 30 | 31 | 155,117,520 | 1,073,741,824 | 14.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
- For C(n, k) and nPr on their own, use the Permutation & Combination Calculator.
- For the factorials inside every binomial coefficient, use the Factorial Calculator.
- To multiply out polynomials with more than two terms, use the Polynomial Calculator.
- For binomial probabilities such as 3 heads in 10 flips, use the Probability Calculator.
Sources
- National Institute of Standards and Technology (NIST): Digital Library of Mathematical Functions, §1.2 Elementary Algebra: binomial coefficients (eq. 1.2.1), the binomial theorem (eq. 1.2.2) and the row sum 2n (eq. 1.2.3).
- NIST: Digital Library of Mathematical Functions, §26.3 Lattice Paths: Binomial Coefficients, including the recurrence behind Pascal's triangle (eq. 26.3.5).
- OEIS Foundation: A007318, Pascal's triangle read by rows, and A000984, central binomial coefficients.
- Every expansion, coefficient and table entry on this page was computed with exact integer arithmetic and checked against the calculator.
โ ๏ธ 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.
❓ 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.