{
  "id": "binomial-distribution",
  "version": "4067d6214ce3",
  "status": "published",
  "name": "Binomial Distribution Calculator",
  "question": "Binomial distribution: how likely is k?",
  "summary": "Computes exact binomial probabilities P(X = k), P(X < k), P(X ≤ k), P(X > k), and P(X ≥ k) for n trials with success probability p, with the mean and standard deviation.",
  "category": "statistics",
  "subcategory": "distributions",
  "url": "https://www.acalculator.org/statistics/binomial-distribution-calculator",
  "markdown": "https://www.acalculator.org/statistics/binomial-distribution-calculator.md",
  "kind": "function",
  "method": "P(X = k) = C(n, k) × pᵏ × (1 − p)ⁿ⁻ᵏ; P(X ≤ k) = Σ P(X = j) for j = 0 … k; mean = np; variance = np(1 − p).",
  "assumptions": [
    "The n trials are independent, and each has the same probability p of success.",
    "Every probability is summed exactly from the decimal p you type, then rounded once, so tiny tails keep full precision."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "n": {
        "title": "Number of trials (n)",
        "description": "How many independent trials, from 1 to 1,000.",
        "type": "integer",
        "minimum": 1,
        "maximum": 1000
      },
      "p": {
        "title": "Probability of success (p)",
        "description": "The chance of a success on each trial, from 0 to 1.",
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "k": {
        "title": "Number of successes (k)",
        "description": "The number of successes to find the probability of, from 0 to n.",
        "type": "integer",
        "minimum": 0,
        "maximum": 1000
      }
    }
  },
  "outputs": {
    "exactly": {
      "label": "P(X = k)",
      "description": "The probability of exactly k successes.",
      "format": "number"
    },
    "below": {
      "label": "P(X < k)",
      "description": "The probability of fewer than k successes.",
      "format": "number"
    },
    "atMost": {
      "label": "P(X ≤ k)",
      "description": "The probability of k or fewer successes.",
      "format": "number"
    },
    "above": {
      "label": "P(X > k)",
      "description": "The probability of more than k successes.",
      "format": "number"
    },
    "atLeast": {
      "label": "P(X ≥ k)",
      "description": "The probability of k or more successes.",
      "format": "number"
    },
    "mean": {
      "label": "Mean (np)",
      "description": "The expected number of successes: n × p.",
      "format": "number"
    },
    "variance": {
      "label": "Variance np(1 − p)",
      "description": "The variance of the number of successes: n × p × (1 − p).",
      "format": "number"
    },
    "sd": {
      "label": "Standard deviation",
      "description": "The square root of the variance: √(n × p × (1 − p)).",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "n": 10,
      "p": 0.5,
      "k": 5
    },
    "outputs": {
      "exactly": 0.24609375,
      "below": 0.376953125,
      "atMost": 0.623046875,
      "above": 0.376953125,
      "atLeast": 0.623046875,
      "mean": 5,
      "variance": 2.5,
      "sd": 1.5811388300841898
    },
    "text": "With 10 trials and p = 0.5, the chance of exactly 5 successes is 0.246094, and of at most 5 is 0.623047."
  },
  "examples": [
    {
      "given": {
        "n": 10,
        "p": 0.5,
        "k": 5
      },
      "expect": {
        "exactly": 0.24609375,
        "below": 0.376953125,
        "atMost": 0.623046875,
        "above": 0.376953125,
        "mean": 5,
        "sd": 1.5811388300841898
      },
      "source": "hand calculation in content.mdx: C(10, 5) ÷ 2¹⁰ = 252 ÷ 1024; NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.6.18 Binomial Distribution. https://www.itl.nist.gov/div898/handbook/eda/section3/eda366i.htm"
    },
    {
      "given": {
        "n": 20,
        "p": 0.41,
        "k": 12
      },
      "expect": {
        "atMost": 0.9737849203664835,
        "mean": 8.2,
        "variance": 4.838,
        "sd": 2.199545407578575
      },
      "source": "OpenStax, Introductory Statistics 2e, §4.3 Binomial Distribution. https://openstax.org/books/introductory-statistics-2e/pages/4-3-binomial-distribution, Example 4.13 (P(x ≤ 12) = 0.9738, mean 8.2, standard deviation 2.20)"
    },
    {
      "given": {
        "n": 200,
        "p": 0.015,
        "k": 8
      },
      "expect": {
        "atMost": 0.9964957133771917,
        "mean": 3
      },
      "source": "OpenStax, Introductory Statistics 2e, §4.3 Binomial Distribution. https://openstax.org/books/introductory-statistics-2e/pages/4-3-binomial-distribution, Example 4.15 (P(x ≤ 8) = 0.9965, mean 3)"
    },
    {
      "given": {
        "n": 1000,
        "p": 0.001,
        "k": 10
      },
      "expect": {
        "atLeast": 1.0742833868464872e-7,
        "exactly": 9.782838349942049e-8
      },
      "source": "hand calculation in content.mdx: 1 − P(X ≤ 9), in exact whole numbers over 1000¹⁰⁰⁰; NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.6.18 Binomial Distribution. https://www.itl.nist.gov/div898/handbook/eda/section3/eda366i.htm"
    },
    {
      "given": {
        "n": 5,
        "p": 0.1,
        "k": 0
      },
      "expect": {
        "exactly": 0.59049,
        "below": 0,
        "atLeast": 1,
        "above": 0.40951
      },
      "source": "hand calculation in content.mdx: 0.9⁵ = 0.59049; NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.6.18 Binomial Distribution. https://www.itl.nist.gov/div898/handbook/eda/section3/eda366i.htm"
    },
    {
      "given": {
        "n": 4,
        "p": 0.3,
        "k": 7
      },
      "expect": {
        "exactly": 0,
        "atMost": 1,
        "atLeast": 0
      },
      "source": "hand calculation in content.mdx: at most 4 successes in 4 trials; NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.6.18 Binomial Distribution. https://www.itl.nist.gov/div898/handbook/eda/section3/eda366i.htm"
    }
  ],
  "sources": [
    "NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.6.18 Binomial Distribution. https://www.itl.nist.gov/div898/handbook/eda/section3/eda366i.htm",
    "OpenStax, Introductory Statistics 2e, §4.3 Binomial Distribution. https://openstax.org/books/introductory-statistics-2e/pages/4-3-binomial-distribution"
  ],
  "related": [
    "probability",
    "dice-probability",
    "normal-distribution",
    "combination"
  ],
  "changelog": []
}
