Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Value of (a + b)n
3,125
numeric result of the expansion
Number of terms 6
Term structure C(5,0)·a^5 + C(5,1)·a^4·b + C(5,2)·a^3·b^2 + C(5,3)·a^2·b^3 + C(5,4)·a·b^4 + C(5,5)·b^5

What is the Binomial Expansion Calculator?

This calculator applies the binomial theorem to expand and evaluate any expression of the form \((a + b)^{n}\), where n is a non-negative integer. It returns the numeric value of the whole expression, the number of terms in the expansion, and the symbolic structure of each term. It is a universal mathematics tool with no regional restrictions.

How to use it

Enter the first term a, the second term b, and the exponent n (0 to 20). Both a and b may be positive, negative, or fractional. Press calculate to see the result. Because the value is computed term by term using binomial coefficients, you can verify partial results by hand against the displayed term structure.

The formula explained

The binomial theorem states that \((a + b)^{n}\) equals the sum from k = 0 to n of \(C(n,k)\cdot a^{n-k}\cdot b^{k}\). The coefficient \(C(n,k) = \frac{n!}{k!(n-k)!}\) counts how many ways k objects can be chosen from n, and these coefficients form the rows of Pascal's triangle. There are always \(n + 1\) terms, and the powers of a decrease from n to 0 while the powers of b increase from 0 to n.

$$\left(a + b\right)^{n} = \sum_{k=0}^{n} \binom{n}{k}\, a^{\,n-k}\, b^{\,k}$$
Advertisement
Pascal's triangle as rows of numbers forming a triangle
Pascal's triangle: each row gives the binomial coefficients for that exponent n.
Annotated diagram of a single binomial expansion term showing binomial coefficient, a power and b power
Anatomy of a general term: the binomial coefficient times a^(n−k) times b^k.

Worked example

For \((1 + 2)^{3}\): the terms are \(C(3,0)\cdot 1^{3}\cdot 2^{0} = 1\), \(C(3,1)\cdot 1^{2}\cdot 2^{1} = 6\), \(C(3,2)\cdot 1^{1}\cdot 2^{2} = 12\), and \(C(3,3)\cdot 1^{0}\cdot 2^{3} = 8\). Summing gives

$$1 + 6 + 12 + 8 = 27,$$

which equals \(3^{3} = 27\), confirming the expansion.

Pascal's Triangle: Binomial Coefficients by Exponent

Each row \(n\) of Pascal's triangle lists the binomial coefficients \(\binom{n}{k}\) for \(k = 0, 1, 2, \dots, n\). These are exactly the numeric coefficients that appear in the expansion of \((a+b)^n\). Read across a row to get the coefficient of each term, starting from \(a^n b^0\) on the left and ending at \(a^0 b^n\) on the right.

\(n\) Binomial coefficients \(\binom{n}{0},\,\binom{n}{1},\,\dots,\,\binom{n}{n}\) Row sum \(2^n\)
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 1024

Each entry equals the sum of the two entries directly above it (for example, the middle of row 6 is \(10 + 10 = 20\)). The middle coefficient of row 6 can also be computed directly as \(\binom{6}{3} = \) 20, and the row total \(\sum_{k} \binom{n}{k} = 2^n\) confirms that an expansion of \((a+b)^n\) has \(n+1\) terms.

More Worked Examples

Each expansion uses \((a+b)^n = \sum_{k=0}^{n}\binom{n}{k}\,a^{\,n-k}\,b^{\,k}\) and pulls its coefficients straight from the matching row of Pascal's triangle.

Example 1: \((x-2)^4\) — alternating signs

Here \(a = x\), \(b = -2\), \(n = 4\). Row 4 of Pascal's triangle is \(1, 4, 6, 4, 1\). Because \(b\) is negative, the powers of \(-2\) make the signs alternate:

  1. \(\binom{4}{0}x^4(-2)^0 = 1\cdot x^4 \cdot 1 = x^4\)
  2. \(\binom{4}{1}x^3(-2)^1 = 4\cdot x^3 \cdot(-2) = -8x^3\)
  3. \(\binom{4}{2}x^2(-2)^2 = 6\cdot x^2 \cdot 4 = 24x^2\)
  4. \(\binom{4}{3}x^1(-2)^3 = 4\cdot x \cdot(-8) = -32x\)
  5. \(\binom{4}{4}x^0(-2)^4 = 1\cdot 1 \cdot 16 = 16\)

Combining: \((x-2)^4 = x^4 - 8x^3 + 24x^2 - 32x + 16\).

Example 2: \((2+3)^5\) — fully numeric

Here \(a = 2\), \(b = 3\), \(n = 5\), and row 5 is \(1, 5, 10, 10, 5, 1\):

  1. \(\binom{5}{0}2^5 3^0 = 1\cdot 32\cdot 1 = 32\)
  2. \(\binom{5}{1}2^4 3^1 = 5\cdot 16\cdot 3 = 240\)
  3. \(\binom{5}{2}2^3 3^2 = 10\cdot 8\cdot 9 = 720\)
  4. \(\binom{5}{3}2^2 3^3 = 10\cdot 4\cdot 27 = 1080\)
  5. \(\binom{5}{4}2^1 3^4 = 5\cdot 2\cdot 81 = 810\)
  6. \(\binom{5}{5}2^0 3^5 = 1\cdot 1\cdot 243 = 243\)

Summing the terms: \(32 + 240 + 720 + 1080 + 810 + 243 = \) 3125. As a check, \((2+3)^5 = 5^5 = 3125\).

Example 3: \(\left(1+\tfrac{1}{2}\right)^3\) — fractional base

Here \(a = 1\), \(b = \tfrac{1}{2}\), \(n = 3\), with row 3 equal to \(1, 3, 3, 1\):

  1. \(\binom{3}{0}1^3\left(\tfrac{1}{2}\right)^0 = 1\cdot 1\cdot 1 = 1\)
  2. \(\binom{3}{1}1^2\left(\tfrac{1}{2}\right)^1 = 3\cdot 1\cdot\tfrac{1}{2} = \tfrac{3}{2}\)
  3. \(\binom{3}{2}1^1\left(\tfrac{1}{2}\right)^2 = 3\cdot 1\cdot\tfrac{1}{4} = \tfrac{3}{4}\)
  4. \(\binom{3}{3}1^0\left(\tfrac{1}{2}\right)^3 = 1\cdot 1\cdot\tfrac{1}{8} = \tfrac{1}{8}\)

Adding the terms: \(1 + \tfrac{3}{2} + \tfrac{3}{4} + \tfrac{1}{8} = \tfrac{8+12+6+1}{8} = \tfrac{27}{8} = \) 3.375. This matches \(\left(\tfrac{3}{2}\right)^3 = \tfrac{27}{8}\).

Advertisement

Key Terms & Definitions

Binomial coefficient \(\binom{n}{k}\)
The number multiplying each term of the expansion, read "n choose k." It counts how many ways to choose \(k\) items from \(n\) and is computed as \(\binom{n}{k} = \dfrac{n!}{k!\,(n-k)!}\). For example, \(\binom{5}{2} = \) 10.
Exponent \(n\)
The whole-number power to which the binomial \((a+b)\) is raised. It sets the highest power and determines that the expansion has exactly \(n+1\) terms.
Term
One additive piece of the expanded result, of the form \(\binom{n}{k}\,a^{\,n-k}\,b^{\,k}\). The exponents on \(a\) and \(b\) in a single term always add up to \(n\).
Base terms \(a\) and \(b\)
The two quantities being added inside the parentheses. They may be numbers, variables, fractions, or negative values; in \((x-2)^4\), for instance, \(a = x\) and \(b = -2\).
Factorial \(n!\)
The product of all positive integers up to \(n\): \(n! = n\times(n-1)\times\cdots\times 2\times 1\), with \(0! = 1\) by definition. For example, \(5! = \) 120. Factorials underlie the formula for every binomial coefficient.
Pascal's triangle
A triangular array in which row \(n\) lists the coefficients \(\binom{n}{0}, \binom{n}{1}, \dots, \binom{n}{n}\). Each interior entry is the sum of the two entries above it, giving a quick way to read off binomial coefficients without computing factorials.

FAQ

Can n be a fraction or negative? This calculator handles only non-negative integer exponents, which give a finite expansion of \(n + 1\) terms.

Can a and b be negative? Yes. For example \((a - b)^{n}\) is entered as a positive a and a negative b, producing alternating signs.

What is the maximum exponent? n is capped at 20 to keep results numerically stable and easy to read.

Last updated: