What it does
This calculator expands (a·x + b)ⁿ for any whole numbers a and b and any power n from 0 to 30. It lists every term with its exact coefficient, the matching row of Pascal's triangle, and any single term you ask for. Big coefficients are worked out with exact whole-number arithmetic, so even (2x + 3)³⁰ comes out to the last digit.
How it's calculated: the binomial theorem
There are n + 1 terms. Term number k + 1 is C(n, k) · aⁿ⁻ᵏ · bᵏ · xⁿ⁻ᵏ. The numbers C(n, k) are the binomial coefficients. They form row n of Pascal's triangle, where each number is the sum of the two above it: C(n, k) = C(n − 1, k − 1) + C(n − 1, k).
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
Worked example
Expand (2x + 3)³. Row 3 of Pascal's triangle is 1, 3, 3, 1.
Check: put x = 1. The left side is 5³ = 125, and the right side is 8 + 36 + 54 + 27 = 125. In general the coefficients add up to (a + b)ⁿ.
Where binomial expansions show up
The same coefficients count outcomes in probability. Expanding (p + q)ⁿ, with p the chance of success and q = 1 − p, gives each term as the probability of exactly k successes in n tries: the binomial distribution. They also appear in compound growth, polynomial approximations such as (1 + x)ⁿ ≈ 1 + nx for small x, and in counting paths on a grid.
Finding one term
To find the 3rd term of (x − 2)⁶, use k = 2: C(6, 2) · 1⁴ · (−2)² · x⁴ = 15 · 4 · x⁴ = 60x⁴. The signs alternate when b is negative, because (−2)ᵏ is negative for odd k.
Limitations
- a and b must be whole numbers from −1,000,000 to 1,000,000, and n a whole number from 0 to 30. For fractional or negative powers the series never ends, so it isn't covered here.
- Terms are written from the highest power of x down. Some textbooks write (b + a·x)ⁿ starting from the constant, which reverses the term numbers.