Binomial Expansion Calculator Formula

Understand the math behind the binomial expansion calculator. Each variable explained with a worked example.

Formulas Used

Total

total = pow(a + b, n)

Coeff

coeff = n >= k ? factorial(n) / (factorial(k) * factorial(n - k)) : 0

Term Val

term_val = n >= k ? (factorial(n) / (factorial(k) * factorial(n - k))) * pow(a, n - k) * pow(b, k) : 0

Variables

VariableDescriptionDefault
aValue of a2
bValue of b3
nExponent n4
kTerm k (0-indexed)2

How It Works

Binomial Expansion

Binomial Theorem

(a + b)^n = sum of C(n,k) × a^(n-k) × b^k for k = 0 to n

Individual Term

The k-th term (0-indexed): C(n,k) × a^(n-k) × b^k

Example: (2 + 3)⁴ = 5⁴ = 625

  • k=0: C(4,0)×2⁴×3⁰ = 1×16×1 = 16
  • k=1: C(4,1)×2³×3¹ = 4×8×3 = 96
  • k=2: C(4,2)×2²×3² = 6×4×9 = 216
  • k=3: C(4,3)×2¹×3³ = 4×2×27 = 216
  • k=4: C(4,4)×2⁰×3⁴ = 1×1×81 = 81
  • Total: 16 + 96 + 216 + 216 + 81 = 625
  • Worked Example

    Find the k=2 term of (2+3)^4.

    a = 2b = 3n = 4k = 2
    1. 01C(4,2) = 6
    2. 02a^(4-2) = 2² = 4
    3. 03b^2 = 3² = 9
    4. 04Term value = 6 × 4 × 9 = 216
    5. 05(2+3)⁴ = 5⁴ = 625

    Ready to run the numbers?

    Open Binomial Expansion Calculator