{
  "id": "binomial-expansion",
  "version": "f1bcf7966aef",
  "status": "published",
  "name": "Binomial Expansion Calculator",
  "question": "What is the binomial expansion?",
  "summary": "Expands a typed binomial power such as (x + 2)^5 or (3x − y)^4 by the binomial theorem, with every term and the binomial coefficients in exact fractions.",
  "category": "math",
  "subcategory": "algebra",
  "url": "https://www.acalculator.org/math/binomial-expansion-calculator",
  "markdown": "https://www.acalculator.org/math/binomial-expansion-calculator.md",
  "kind": "function",
  "method": "(a + b)^n = Σ C(n, k) a^(n−k) b^k, k = 0 to n, with C(n, k) = n! ÷ (k!(n − k)!).",
  "assumptions": [
    "The bracket holds two terms that are not like terms. Coefficients are exact fractions: 0.5 is 1/2.",
    "n is a whole number from 0 to 30."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "e": {
        "title": "Binomial power",
        "description": "A binomial in brackets to a whole power from 0 to 30, such as (x + 2)^5.",
        "type": "string",
        "maxLength": 80
      },
      "r": {
        "title": "Show term number",
        "description": "Optional: which term to show on its own, 1 to n + 1.",
        "type": "integer",
        "minimum": 1,
        "maximum": 31
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Expansion",
      "description": "The binomial power multiplied out.",
      "format": "math"
    },
    "term": {
      "label": "Chosen term",
      "description": "Term number r: C(n, r − 1) a^(n − r + 1) b^(r − 1).",
      "format": "text"
    },
    "coefficients": {
      "label": "Binomial coefficients",
      "description": "C(n, 0) to C(n, n): row n of Pascal’s triangle.",
      "format": "text"
    },
    "count": {
      "label": "Number of terms",
      "description": "The expansion has n + 1 terms.",
      "format": "integer"
    },
    "steps": {
      "label": "Each term",
      "description": "Term k + 1 = C(n, k) × a^(n − k) × b^k for k = 0 to n.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "e": "(x + 2)^5"
    },
    "outputs": {
      "result": "x^5 + 10x^4 + 40x^3 + 80x^2 + 80x + 32",
      "coefficients": "1, 5, 10, 10, 5, 1",
      "count": 6,
      "steps": "Term 1: C(5, 0) × x⁵ × 2⁰ = x⁵; Term 2: C(5, 1) × x⁴ × 2¹ = 10x⁴; Term 3: C(5, 2) × x³ × 2² = 40x³; Term 4: C(5, 3) × x² × 2³ = 80x²; Term 5: C(5, 4) × x¹ × 2⁴ = 80x; Term 6: C(5, 5) × x⁰ × 2⁵ = 32"
    },
    "text": "(x + 2)^5 = x^5 + 10x^4 + 40x^3 + 80x^2 + 80x + 32."
  },
  "examples": [
    {
      "given": {
        "e": "(x + 2)^5"
      },
      "expect": {
        "result": "x^5 + 10x^4 + 40x^3 + 80x^2 + 80x + 32",
        "coefficients": "1, 5, 10, 10, 5, 1",
        "count": 6
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §13.6 Binomial Theorem ((x + y)^n = Σ C(n, k) x^(n−k) y^k), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-6-binomial-theorem; hand calculation in content.mdx: 1, 5×2, 10×4, 10×8, 5×16, 32"
    },
    {
      "given": {
        "e": "(3x - y)^4",
        "r": 2
      },
      "expect": {
        "result": "81x^4 - 108x^3 y + 54x^2 y^2 - 12x y^3 + y^4",
        "term": "−108x³ y"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §13.6 Binomial Theorem, Example 2b ((3x − y)⁴ = 81x⁴ − 108x³y + 54x²y² − 12xy³ + y⁴), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-6-binomial-theorem"
    },
    {
      "given": {
        "e": "(x + 2y)^16",
        "r": 10
      },
      "expect": {
        "term": "5857280x⁷ y⁹",
        "count": 17
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §13.6 Binomial Theorem, Example 3 (the tenth term of (x + 2y)¹⁶ is 5,857,280x⁷y⁹), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-6-binomial-theorem"
    },
    {
      "given": {
        "e": "(1 - x)^3"
      },
      "expect": {
        "result": "-x^3 + 3x^2 - 3x + 1",
        "steps": "Term 1: C(3, 0) × 1³ × (−x)⁰ = 1; Term 2: C(3, 1) × 1² × (−x)¹ = −3x; Term 3: C(3, 2) × 1¹ × (−x)² = 3x²; Term 4: C(3, 3) × 1⁰ × (−x)³ = −x³"
      },
      "source": "hand calculation in content.mdx: a = 1, b = −x; 1, −3x, 3x², −x³"
    }
  ],
  "sources": [
    "OpenStax, Algebra and Trigonometry 2e, §13.6 Binomial Theorem (C(n, r) = n! ÷ (r!(n − r)!); (x + y)^n = Σ C(n, k) x^(n−k) y^k; the (r + 1)th term is C(n, r) x^(n−r) y^r; Example 2b: (3x − y)^4 = 81x^4 − 108x^3y + 54x^2y^2 − 12xy^3 + y^4; Example 3: the tenth term of (x + 2y)^16 is 5,857,280x^7y^9). https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-6-binomial-theorem (retrieved 2026-10-05)"
  ],
  "related": [
    "binomial-theorem",
    "polynomial",
    "factorial",
    "combine-like-terms"
  ],
  "changelog": []
}
