Binomial Expansion Calculator

Expand (ax + b)ⁿ or (ax + by)ⁿ with the binomial theorem and Pascal’s triangle. Exact whole-number coefficients up to n = 30, plus any single term.

A whole number from −1000 to 1000, not 0.
A whole number from −1000 to 1000, not 0. For (x − 2)ⁿ enter b = −2.
A whole number from 0 to 30.
Counting from 1 at the highest power of x. Term r uses k = r − 1.

Results

(2x + 3)⁵ =
32x⁵ + 240x⁴ + 720x³ + 1,080x² + 810x + 243
Term 3 (k = 2)
720x³
C(5, 2) × 2³ × 3² = 10 × 8 × 9 = 720
Coefficients, highest power of x first
32, 240, 720, 1080, 810, 243
Row 5 of Pascal’s triangle, C(5, k)
1, 5, 10, 10, 5, 1
Sum of the coefficients, (a + b)ⁿ
3,125
Set x = 1 (and y = 1) to check: every term adds up to (a + b)ⁿ.
Number of terms
6
Term by term: C(n, k) × aⁿ⁻ᵏ × bᵏ
k = 0: C(5, 0) × 2⁵ × 3⁰ = 32 → 32x⁵ k = 1: C(5, 1) × 2⁴ × 3 = 240 → 240x⁴ k = 2: C(5, 2) × 2³ × 3² = 720 → 720x³ k = 3: C(5, 3) × 2² × 3³ = 1,080 → 1,080x² k = 4: C(5, 4) × 2 × 3⁴ = 810 → 810x k = 5: C(5, 5) × 2⁰ × 3⁵ = 243 → 243

How it’s calculated

The binomial theorem expands a power of a two-term sum without multiplying out the brackets. The coefficients C(n, k) = n! ÷ (k!(n − k)!) are the numbers in row n of Pascal’s triangle.

(ax + b)ⁿ = Σ C(n, k) · (ax)ⁿ⁻ᵏ · bᵏ, k = 0, 1, …, n term number r (counting from 1) uses k = r − 1
nPascal’s triangle row
21, 2, 1
31, 3, 3, 1
41, 4, 6, 4, 1
51, 5, 10, 10, 5, 1

Example: (2x + 3)⁵. With row 1, 5, 10, 10, 5, 1: 1·32x⁵ + 5·16·3x⁴ + 10·8·9x³ + 10·4·27x² + 5·2·81x + 243 = 32x⁵ + 240x⁴ + 720x³ + 1,080x² + 810x + 243. Check: the coefficients add up to (2 + 3)⁵ = 3,125.

All arithmetic uses exact whole numbers (no rounding), even when the coefficients have dozens of digits. A negative b makes the signs alternate.

Frequently asked questions

How do I find a single term without expanding everything?

Term r is C(n, r − 1)·(ax)ⁿ⁻⁽ʳ⁻¹⁾·(b)ʳ⁻¹. For the tenth term of (x + 2y)¹⁶ use k = 9: C(16, 9)·x⁷·(2y)⁹ = 11,440 × 512 x⁷y⁹ = 5,857,280x⁷y⁹.

How many terms does (a + b)ⁿ have?

n + 1. The powers of the first term go down from n to 0 while the powers of the second go up from 0 to n.

How do I expand (x − 2)⁴?

Enter a = 1, b = −2, n = 4. The signs alternate: x⁴ − 8x³ + 24x² − 32x + 16.

Why is the largest power limited to 30?

To keep the page fast and the output readable. The coefficients are exact at every size; C(30, 15) alone is 155,117,520.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator