Home / Learn / Maths / Binomial expansionTool #L95 (formerly #1192)

Binomial expansion

Expand (ax + b)ⁿ with exact coefficients, read them off Pascal's triangle, find the general term T(r+1) and the middle term(s), and drop balls through a Galton board to watch the same numbers turn into chances.

Keep it one tap away for everyday use.

Bookmark Binomial expansion?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Set a, b, n
  2. Pascal
  3. Term
  4. Galton
Nothing is uploadedWorks offline once open

Expand (ax + b)ⁿ

Pascal's triangle

Each number is the sum of the two above it. Row n (blue) gives the coefficients C(n, r) of (x + y)ⁿ.

The general term

Galton board

Each ball bounces left or right at every row of pegs, with even chances. The number of rights is the slot it lands in, so the slots fill in the proportions C(n, k)/2ⁿ: a binomial distribution.

Try this

  • Set a = 1 and b = 1: the coefficients are exactly the blue row of the triangle.
  • Make b negative: the signs alternate.
  • Try n odd and n even: an even n has one middle term, an odd n has two.
  • Drop 1000 balls: the pile takes the shape of the blue row, the bell shape of the binomial distribution.

Check yourself

Fresh numbers every time. Type a number or a fraction such as 3/4; nothing is saved or sent.

    What it shows

    The binomial theorem tells you how to multiply out (ax + b)ⁿ without doing it by hand n times. Each term is a number from Pascal’s triangle times a power of ax times a power of b:

    (ax + b)ⁿ = C(n, 0)(ax)ⁿ + C(n, 1)(ax)ⁿ⁻¹ b + C(n, 2)(ax)ⁿ⁻² b² + … + C(n, n) bⁿ

    This page expands (ax + b)ⁿ for whole numbers a and b from −20 to 20 and n from 0 to 12, with exact coefficients however large they get. It highlights row n of Pascal’s triangle, builds the general term T(r+1) = C(n, r)(ax)ⁿ⁻ʳ bʳ for any r you pick, names the middle term (or the two middle terms when n is odd), and adds up the coefficients. A Galton board underneath drops balls left or right at each peg, so you can see the same row of numbers turn into the chances of the binomial distribution.

    It follows the binomial theorem in Class 11 maths, which builds on permutations and combinations and leads to probability in Class 12. For counting C(n, r) and arrangements on their own, use the combinatorics calculator; afterwards, the probability distribution explorer draws the binomial distribution for any p, and the probability tree shows how chances multiply along branches.

    How to use it

    1. Type a and b (whole numbers; b may be negative) and slide n.
    2. Read the expansion. The blue row of the triangle is C(n, 0) to C(n, n).
    3. Slide r to build any term T(r+1) step by step: the C(n, r), the power of ax and the power of b.
    4. Read the facts: number of terms, the middle term(s), the sum of the coefficients and the term with no x.
    5. Press Drop 100 balls or Drop 1000, and Empty to start again. The orange lines are the expected shares C(n, k)/2ⁿ.

    Worked example

    Expand (2x − 3)⁵. Row 5 of Pascal’s triangle is 1, 5, 10, 10, 5, 1. Term by term: 1 × 32x⁵, 5 × 16x⁴ × (−3) = −240x⁴, 10 × 8x³ × 9 = 720x³, 10 × 4x² × (−27) = −1080x², 5 × 2x × 81 = 810x and 1 × (−243). So

    (2x − 3)⁵ = 32x⁵ − 240x⁴ + 720x³ − 1080x² + 810x − 243.

    There are 6 terms; n = 5 is odd, so the middle terms are T₃ = 720x³ and T₄ = −1080x². Putting x = 1 gives the sum of the coefficients: (2 − 3)⁵ = −1.

    Why a Galton board?

    Each ball meets n pegs and goes left or right with equal chance. To land in slot k it must go right exactly k times, and there are C(n, k) ways to choose which pegs, out of 2ⁿ equally likely paths. So the chance is C(n, k)/2ⁿ: the same row of Pascal’s triangle, divided by its sum. With many balls the pile takes the bell shape of the binomial distribution.

    Check yourself

    Five questions with fresh numbers: a value of C(n, r), a coefficient from the general term, the middle term, the sum of the coefficients and a Galton-board chance. Nothing is saved.

    FAQ

    Why does a negative b make the signs alternate? The term with bʳ is negative when r is odd and positive when r is even.

    How many terms are there? Always n + 1, from r = 0 to r = n.

    Is this from my textbook? It covers the standard school topic with its own examples. It is an independent study aid.

    Where the numbers come from

    • Standard binomial theorem: (x + y)ⁿ = Σ C(n, r) xⁿ⁻ʳ yʳ, Pascal's rule C(n, r) = C(n − 1, r − 1) + C(n − 1, r), and the binomial distribution C(n, k)/2ⁿ for a fair Galton board. Written for fibub; no textbook text, figures or exercises are used.
    • Coefficients checked against sympy's expand and binomial for several (ax + b)ⁿ, including negative b and n up to 12.

    Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

    Last updated 2026-11-09.

    Change log for Binomial expansion

    1. Add #1192 Binomial expansion with Pascal Details on GitHub

    Every change to fibub

    Related tools

    Combinatorics calculator #T385 Count exactly, with every digit: permutations and combinations with or without repetition, multinomial coefficients (arrangements of a word), Stirling numbers of both kinds, Lah numbers, Bell and Catalan numbers, integer partitions and derangements, with tables you can download. Probability distribution explorer #T391 Pick a distribution (normal, t, chi-squared, F, beta, gamma, Weibull, binomial, Poisson and 26 more), set its parameters and see the curve with the probability between two values shaded, the quantiles, mean, variance, skewness and kurtosis, and draw seeded random samples. Matches scipy.stats. Probability tree #L94 Set P(A), P(B | A) and P(B | A′) with sliders and see the tree, the four path probabilities, P(B) by total probability, P(A | B) by Bayes' theorem and an independence check. 1000 dots show the same numbers as people, which makes it clear why a positive result on a test for something rare is often a false alarm. Power set builder #L232 Type a set of up to 6 elements and see every subset, from ∅ to the whole set, sorted by size with C(n, k) in each group. Switch elements in and out to build one subset and follow its path down a yes/no tree that shows why a set with n elements has 2ⁿ subsets. Counting machine #L234 Seat people in a row, pick a team or shuffle the letters of a word and see every arrangement listed for small cases. nPr and nCr are worked side by side with your numbers, and repeated letters (BANANA, MISSISSIPPI) are handled with n!/(p! q!). GP explorer #L235 Slide the first term and the common ratio of a geometric progression and watch the terms as bars and the running sum settle on a/(1 − r) when |r| < 1. AM ≥ GM is drawn in a semicircle, and compound interest and depreciation are shown as the GPs they are. Random variable builder #L311 Build a probability distribution table (or pick coins, dice, drawing without replacement or a binomial with sliders) and get the mean, E(X²), variance and standard deviation with every step, a bar chart with μ and μ ± σ, and a simulation that runs the experiment 10 to 10 000 times so you can watch the average settle on the mean.