{
  "id": "binomial-theorem",
  "version": "426b335b0cd8",
  "status": "published",
  "name": "Binomial Theorem Calculator",
  "question": "What is the binomial theorem result?",
  "summary": "Expands (a + b)^n by the binomial theorem, with the binomial coefficients, every term C(n, k) a^(n−k) b^k, and any one term on its own, in exact fractions.",
  "category": "math",
  "subcategory": "algebra",
  "url": "https://www.acalculator.org/math/binomial-theorem-calculator",
  "markdown": "https://www.acalculator.org/math/binomial-theorem-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)!); term k + 1 is C(n, k) a^(n−k) b^k.",
  "assumptions": [
    "a and b are single 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": {
      "a": {
        "title": "First term a",
        "description": "First term a: one term, such as 3x, −y, 2 or x^2/2.",
        "type": "string",
        "maxLength": 40
      },
      "b": {
        "title": "Second term b",
        "description": "Second term b: one term, such as 3x, −y, 2 or x^2/2.",
        "type": "string",
        "maxLength": 40
      },
      "n": {
        "title": "Power n",
        "description": "The whole-number power, 0 to 30.",
        "type": "integer",
        "minimum": 0,
        "maximum": 30
      },
      "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": "(a + b)^n",
      "description": "The expansion, every term added.",
      "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": {
      "a": "x",
      "b": "y",
      "n": 5
    },
    "outputs": {
      "result": "x^5 + 5x^4 y + 10x^3 y^2 + 10x^2 y^3 + 5x y^4 + y^5",
      "coefficients": "1, 5, 10, 10, 5, 1",
      "count": 6,
      "steps": "Term 1: C(5, 0) × x⁵ × y⁰ = x⁵; Term 2: C(5, 1) × x⁴ × y¹ = 5x⁴ y; Term 3: C(5, 2) × x³ × y² = 10x³ y²; Term 4: C(5, 3) × x² × y³ = 10x² y³; Term 5: C(5, 4) × x¹ × y⁴ = 5x y⁴; Term 6: C(5, 5) × x⁰ × y⁵ = y⁵"
    },
    "text": "The expansion has 6 terms: x^5 + 5x^4 y + 10x^3 y^2 + 10x^2 y^3 + 5x y^4 + y^5."
  },
  "examples": [
    {
      "given": {
        "a": "x",
        "b": "y",
        "n": 5
      },
      "expect": {
        "result": "x^5 + 5x^4 y + 10x^3 y^2 + 10x^2 y^3 + 5x y^4 + y^5",
        "coefficients": "1, 5, 10, 10, 5, 1",
        "count": 6
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §13.6 Binomial Theorem, Example 2a ((x + y)⁵ = x⁵ + 5x⁴y + 10x³y² + 10x²y³ + 5xy⁴ + y⁵), https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-6-binomial-theorem"
    },
    {
      "given": {
        "a": "3x",
        "b": "-y",
        "n": 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": {
        "a": "x",
        "b": "2y",
        "n": 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": {
        "a": "x",
        "b": "0.5",
        "n": 3
      },
      "expect": {
        "result": "x^3 + 3x^2/2 + 3x/4 + 1/8",
        "steps": "Term 1: C(3, 0) × x³ × (1/2)⁰ = x³; Term 2: C(3, 1) × x² × (1/2)¹ = 3x²/2; Term 3: C(3, 2) × x¹ × (1/2)² = 3x/4; Term 4: C(3, 3) × x⁰ × (1/2)³ = 1/8"
      },
      "source": "hand calculation in content.mdx: 1, 3, 3, 1 times x³, x²/2, x/4, 1/8"
    }
  ],
  "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 1: C(5, 3) = 10; Example 2: (x + y)^5 and (3x − 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": [
    "polynomial",
    "factorial",
    "combine-like-terms"
  ],
  "changelog": []
}
