Enter A, B and n of the expression (Ax+B)ⁿ to expand. The formula below is linked to the input fields, so you can also edit the formula directly. Use "Find" to choose between expanding every term and finding just one term.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and figures
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Expand \((Ax+B)^{n}\) (\(n\) from 0 to 12) with the binomial theorem and see the result in descending powers of \(x\) right away
- If you only need the coefficient of \(x^{3}\), give the power of \(x\) (or the position of the term) and find just that one term
- When you find one term, the value of the binomial coefficient \({}_n\mathrm{C}_k\) and the steps using \(\dfrac{n!}{k!\,(n-k)!}\) are shown too
- Pascal's triangle is drawn down to row \(n\), with the row you used highlighted
- \(A\) and \(B\) can be decimals, negative numbers or fractions such as 3/4. Coefficients are calculated exactly, as simplified fractions
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
Repeat a trial \(n\) times, where the chance \(p\) is the same every time and one result does not affect another. The probability that something happens exactly \(k\) times is \({}_n\mathrm{C}_k p^{k}(1-p)^{n-k}\). This is exactly one term of \((p + (1-p))^n\) expanded with the binomial theorem, and this kind of probability distribution is called the binomial distribution.
For example, if a production line always has a 3% defect rate and you sample 10 items, the chance of no defects at all is the \(k = 0\) term, \(0.97^{10} \approx 0.737\), or about 74%. Put the other way, checking 10 items finds a defect about 26% of the time. The same idea underlies deciding how many items to inspect, estimating the margin of error of a poll, and judging whether a new drug works.
When both parents have the gene pair \(\mathrm{Aa}\), their children's genotypes appear in the ratio \(\mathrm{AA} : \mathrm{Aa} : \mathrm{aa} = 1 : 2 : 1\). The 1, 2, 1 comes from each parent passing on \(\mathrm{A}\) or \(\mathrm{a}\) with probability \(\dfrac{1}{2}\) each: \(\left(\dfrac{1}{2}\mathrm{A} + \dfrac{1}{2}\mathrm{a}\right)^{2} = \dfrac{1}{4}\left(\mathrm{AA} + 2\,\mathrm{Aa} + \mathrm{aa}\right)\). These are the binomial coefficients, the same numbers as row \(n = 2\) of Pascal's triangle.
With more traits, or when you break it down by the number of children, it gets too hard to track by hand. The binomial theorem handles questions like "the chance that exactly 2 of 4 siblings have a trait" in one step. Plant and animal breeders and genetic counselors estimate expected ratios this way.
Money growing at an annual rate \(r\) for \(n\) years is multiplied by \((1+r)^{n}\). Expanding this with the binomial theorem gives \(1 + nr + {}_n\mathrm{C}_2 r^{2} + \cdots\). The first part, \(1 + nr\), is simple interest, and the rest is "interest on interest".
For example, at 1% a year for 10 years, \(1.01^{10} = 1.10462\cdots\), but the first three terms alone, \(1 + 0.1 + 0.0045\), give 1.1045, almost the same value. The later terms get smaller and smaller, so this is handy for a rough mental estimate. Interest rates, inflation rates and population growth rates, anything that grows by the same percentage each year, all take this form.
In design and measurement, you often need to know quickly how much a result changes when something changes slightly. Expand with the binomial theorem and drop the small squared and higher terms, and you get the approximation \((1+x)^{n} \approx 1 + nx\).
For example, if each edge of a cube gets 1% longer, the volume becomes \((1+0.01)^{3} = 1.030301\) times as large, an increase of about 3%. The approximation gives \(1 + 3 \times 0.01 = 1.03\), almost the same answer. The rule of thumb "a 1% error in length means about a 3% error in volume" is used directly when setting part tolerances and estimating measurement errors.
When you freely decide "yes or no" for each of \(n\) options, the total number of combinations is \(2^{n}\). This is the binomial theorem with \(a = b = 1\), \(\sum_{k=0}^{n} {}_n\mathrm{C}_k = 2^{n}\), and it is also the sum of each row of Pascal's triangle.
For example, a pizza with 5 available toppings can be ordered \(2^{5} = 32\) ways, including a plain cheese pizza with no toppings. The row also gives the breakdown: exactly 2 toppings can be ordered in \({}_5\mathrm{C}_2 = 10\) ways. This idea is used whenever you count choices, such as menu combinations, survey answer patterns and software test cases.
Formulas and figures
Symbols and terms
Symbols
| \({}_n\mathrm{C}_k\) | n C k, or n choose k | The number of ways to choose \(k\) things from \(n\) (the number of combinations). In the binomial theorem it becomes a coefficient of the expansion, so it is also called a binomial coefficient. \(\mathrm{C}\) is the first letter of "combination". It is also written \(\binom{n}{k}\), nCk or C(n, k). |
| \(n!\) | n factorial | The product of every whole number from 1 to \(n\) (\(4! = 4 \times 3 \times 2 \times 1 = 24\)). It looks like an exclamation mark, but it is the math symbol for "factorial". By definition, \(0! = 1\). |
| \(a,\ b\) | a, b | The two terms inside the parentheses in the binomial theorem. "Binomial" means "two terms", and these are the two. By custom, letters from the start of the alphabet, \(a,\ b,\ c\), stand for fixed values. |
| \(n\) | n | How many copies of the same parentheses are multiplied (the exponent). The letter \(n\), from "number", is often used for a count. On this page it is a whole number from 0 to 12. |
| \(k\) | k | A counter for "how many \(b\)s were chosen". It runs from 0 to \(n\). The term with \(k = 0\) is the 1st term, which is why we say "the \((k+1)\)th term". The letter \(k\) is a common choice for a whole-number counter. |
| \(\displaystyle\sum\) | sigma | The symbol for "add them all up". It is the capital Greek letter sigma, which matches S for "sum". \(\sum_{k=0}^{n}\) means "add up the expression after it, with \(k\) going from 0 to \(n\)". |
| \(T_{k+1}\) | T sub k plus 1 | The term in position \(k+1\) from the start when the expansion is written in descending powers. \(T\) is the first letter of "term". It is called the general term. |
| \(A,\ B\) | capital A, capital B | The letters used in this calculator's input fields. In \((Ax+B)^n\), \(A\) is the coefficient of \(x\) and \(B\) is the constant term without \(x\). In the binomial theorem, \(a = Ax\) and \(b = B\). |
| \(x\) | x | A letter whose value is not fixed (a variable). This calculator expands expressions of the form \((Ax+B)^n\), so the answer is a polynomial in \(x\). |
Terms
| binomial theorem | The theorem that the coefficients in the expansion of \((a+b)^n\) are the numbers of combinations \({}_n\mathrm{C}_k\). In the US it is usually taught in Algebra 2 or Precalculus. |
| binomial coefficient | The coefficient \({}_n\mathrm{C}_k\) that appears in the binomial theorem. It is the same as the number of combinations, but this name is used when you think of it as a coefficient of an expansion. |
| combination | A way of choosing some items from a group without caring about order. The number of ways to choose \(k\) of \(n\) is written \({}_n\mathrm{C}_k\). Unlike a permutation, where order matters, the same set of items counts as one way. |
| factorial | The product of every whole number from 1 up to that number. \(5! = 5 \times 4 \times 3 \times 2 \times 1 = 120\). It is used to calculate the number of combinations. |
| general term | A single formula that describes every term of an expansion by its position. In the binomial theorem, the \((k+1)\)th term \({}_n\mathrm{C}_k a^{n-k} b^{k}\) is the general term. To find one term, put values into it. |
| expansion | Multiplying out an expression with parentheses to write it as a sum of terms without parentheses. It is the exact opposite of factoring. |
| descending powers | Writing the terms of an expression from the highest power of the variable down, as in \(x^3 + 2x^2 - x + 5\). Answers are usually written in this order (also called standard form). |
| Pascal's triangle | The binomial coefficients arranged row by row in a triangle. Both ends are 1, and each number inside is the sum of the two numbers above it. It is named after the French mathematician Blaise Pascal, but it was known centuries earlier in Persia, India and China, where it is called Yang Hui's triangle. |
| polynomial | An expression that adds up terms made of a coefficient times a power of \(x\), such as \(2x^3 - x + 5\). The result of an expansion with the binomial theorem is a polynomial too. |
| term | Each piece of an expression separated by plus and minus signs. \(x^3 - 2x + 3\) has three terms: \(x^3\), \(-2x\) and \(3\). |
| coefficient | The number in front of a variable. In \(3x^2\), the coefficient is 3. When no number is written, as in \(x^2\), the coefficient is 1. |
| exponent | The small 3 written at the upper right of \(x^3\). It shows how many times the same thing is multiplied (\(x^3 = x \times x \times x\)). Also called the power. |
| constant term | A term with no \(x\), only a number, like the 5 in \(x^2 + 3x + 5\). In this calculator, \(B\) inside the parentheses and the last term of the expansion are constant terms. |
| binomial distribution | The probability distribution of the number of successes \(k\) when the same trial is repeated \(n\) times. Its probabilities \({}_n\mathrm{C}_k p^{k}(1-p)^{n-k}\) are exactly the terms of \((p + (1-p))^n\) expanded with the binomial theorem, which is where the name "binomial" comes from. |
| general binomial theorem | The binomial theorem extended to fractional and negative exponents. The result is an expression with infinitely many terms (an infinite series). This calculator handles only whole-number exponents of 0 or more. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back over these topics is the quickest way forward.
| Multiplying out expressions (Grade 8 to Algebra 1) |
|
| Powers and the laws of exponents (Grade 8 to Algebra 1) |
|
| Working with negative numbers (Grades 6–7) |
|
| Combinations and factorials (Algebra 2 or Precalculus) |
|
| Sigma notation (Precalculus) |
|
| Working with fractions (Grades 5–6) |
|
How to calculate it in Excel
| Coefficient of x, A | 2 |
| Constant term B | 3 |
| Exponent n | 5 |
| Coefficient for k=0 (x to the n−0) | =IFERROR(COMBIN($B$3,0)*$B$1^($B$3-0)*$B$2^0,0) |
| Coefficient for k=1 (x to the n−1) | =IFERROR(COMBIN($B$3,1)*$B$1^($B$3-1)*$B$2^1,0) |
| Coefficient for k=2 (x to the n−2) | =IFERROR(COMBIN($B$3,2)*$B$1^($B$3-2)*$B$2^2,0) |
| Coefficient for k=3 (x to the n−3) | =IFERROR(COMBIN($B$3,3)*$B$1^($B$3-3)*$B$2^3,0) |
| Coefficient for k=4 (x to the n−4) | =IFERROR(COMBIN($B$3,4)*$B$1^($B$3-4)*$B$2^4,0) |
| Coefficient for k=5 (x to the n−5) | =IFERROR(COMBIN($B$3,5)*$B$1^($B$3-5)*$B$2^5,0) |
| Coefficient for k=6 (x to the n−6) | =IFERROR(COMBIN($B$3,6)*$B$1^($B$3-6)*$B$2^6,0) |
| Coefficient of x, A | 2 |
| Constant term B | 3 |
| Exponent n | 5 |
| Term number (from the start) | 3 |
| k (term number minus 1) | =B4-1 |
| Power of x (n−k) | =B3-B5 |
| Binomial coefficient nCk | =COMBIN(B3,B5) |
| Coefficient of the term | =B7*B1^B6*B2^B5 |
| n | 5 |
| k | 2 |
| Binomial coefficient nCk | =COMBIN(B1,B2) |
| Check with factorials | =FACT(B1)/(FACT(B2)*FACT(B1-B2)) |
| Row n = 0 | 1 | |||||
| Row n = 1 | 1 | 1 | ||||
| Row n = 2 | 1 | =B2+C2 | 1 | |||
| Row n = 3 | 1 | =B3+C3 | =C3+D3 | 1 | ||
| Row n = 4 | 1 | =B4+C4 | =C4+D4 | =D4+E4 | 1 | |
| Row n = 5 | 1 | =B5+C5 | =C5+D5 | =D5+E5 | =E5+F5 | 1 |
COMBIN(n, k) is the binomial coefficient nCk, FACT(n) is n factorial, and "^" is a power.
The first table expands (2x+3)⁵. From k=0 down, it shows 32, 240, 720, 1080, 810, 243 (the row for k is the coefficient of x to the power n−k). Change A, B and n, and you get the coefficients of your own expression. When n is less than 6, rows for terms that do not exist show 0 (IFERROR turns them into 0). When n is 7 or more, copy the last row down and change the 6 in the formula to 7, 8 and so on.
The second table finds only the 3rd term: k is 2, the power of x is 3, the binomial coefficient is 10, and the coefficient of the term is 720.
The third table is the number of ways to choose 2 of 5, and both formulas give 10.
In the fourth table, only the 1s at both ends are typed in. Each number inside is a formula that adds the two cells just above it. Row n = 5 shows 1, 5, 10, 10, 5, 1.
How to calculate it in Google Sheets
| Coefficient of x, A | 2 |
| Constant term B | 3 |
| Exponent n | 5 |
| Coefficient for k=0 (x to the n−0) | =IFERROR(COMBIN($B$3,0)*$B$1^($B$3-0)*$B$2^0,0) |
| Coefficient for k=1 (x to the n−1) | =IFERROR(COMBIN($B$3,1)*$B$1^($B$3-1)*$B$2^1,0) |
| Coefficient for k=2 (x to the n−2) | =IFERROR(COMBIN($B$3,2)*$B$1^($B$3-2)*$B$2^2,0) |
| Coefficient for k=3 (x to the n−3) | =IFERROR(COMBIN($B$3,3)*$B$1^($B$3-3)*$B$2^3,0) |
| Coefficient for k=4 (x to the n−4) | =IFERROR(COMBIN($B$3,4)*$B$1^($B$3-4)*$B$2^4,0) |
| Coefficient for k=5 (x to the n−5) | =IFERROR(COMBIN($B$3,5)*$B$1^($B$3-5)*$B$2^5,0) |
| Coefficient for k=6 (x to the n−6) | =IFERROR(COMBIN($B$3,6)*$B$1^($B$3-6)*$B$2^6,0) |
| Coefficient of x, A | 2 |
| Constant term B | 3 |
| Exponent n | 5 |
| Term number (from the start) | 3 |
| k (term number minus 1) | =B4-1 |
| Power of x (n−k) | =B3-B5 |
| Binomial coefficient nCk | =COMBIN(B3,B5) |
| Coefficient of the term | =B7*B1^B6*B2^B5 |
| n | 5 |
| k | 2 |
| Binomial coefficient nCk | =COMBIN(B1,B2) |
| Check with factorials | =FACT(B1)/(FACT(B2)*FACT(B1-B2)) |
| Row n = 0 | 1 | |||||
| Row n = 1 | 1 | 1 | ||||
| Row n = 2 | 1 | =B2+C2 | 1 | |||
| Row n = 3 | 1 | =B3+C3 | =C3+D3 | 1 | ||
| Row n = 4 | 1 | =B4+C4 | =C4+D4 | =D4+E4 | 1 | |
| Row n = 5 | 1 | =B5+C5 | =C5+D5 | =D5+E5 | =E5+F5 | 1 |
How to calculate it in Python
from fractions import Fraction
from math import comb
# Expand (Ax + B) to the power n (a fraction such as 3/4 can be written Fraction(3, 4))
coef_x = Fraction(2) # coefficient of x, A
const = Fraction(3) # constant term B
power = 5 # exponent n
# k goes from 0 to n. The power of x is n - k, and the coefficient is nCk × A^(n-k) × B^k
for k in range(power + 1):
exponent = power - k
coefficient = comb(power, k) * coef_x ** exponent * const ** k
print(f"Coefficient of x^{exponent}: {coefficient}")
# Find only the coefficient of x^3 (k = n - 3)
target = 3
k = power - target
coefficient = comb(power, k) * coef_x ** target * const ** k
print(f"Binomial coefficient: {comb(power, k)}")
print(f"Coefficient of x^{target}: {coefficient}")
How to write it in LaTeX and other math languages (copy and paste)
(a+b)ⁿ = ₙC₀aⁿ + ₙC₁aⁿ⁻¹b + ⋯ + ₙCₙbⁿ
(a+b)^{n} = \sum_{k=0}^{n} {}_{n}\mathrm{C}_{k}\, a^{n-k} b^{k}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msup>
<mrow><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo></mrow>
<mi>n</mi>
</msup>
<mo>=</mo>
<munderover>
<mo>∑</mo>
<mrow><mi>k</mi><mo>=</mo><mn>0</mn></mrow>
<mi>n</mi>
</munderover>
<mmultiscripts><mi mathvariant="normal">C</mi><mi>k</mi><none/><mprescripts/><mi>n</mi><none/></mmultiscripts>
<msup><mi>a</mi><mrow><mi>n</mi><mo>−</mo><mi>k</mi></mrow></msup>
<msup><mi>b</mi><mi>k</mi></msup>
</mrow>
</math>
(a+b)^n = sum_(k=0)^n C(n,k) a^(n-k) b^k
Sum[Binomial[n, k] a^(n - k) b^k, {k, 0, n}]
sum(binomial(n, k)*a^(n-k)*b^k, k = 0 .. n);
symsum(nchoosek(n, k)*a^(n-k)*b^k, k, 0, n)
(a+b)^n = ∑_(k=0)^n C(n,k) a^(n-k) b^k
Tₖ₊₁ = ₙCₖ aⁿ⁻ᵏ bᵏ
T_{k+1} = {}_{n}\mathrm{C}_{k}\, a^{n-k} b^{k}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>T</mi><mrow><mi>k</mi><mo>+</mo><mn>1</mn></mrow></msub>
<mo>=</mo>
<mmultiscripts><mi mathvariant="normal">C</mi><mi>k</mi><none/><mprescripts/><mi>n</mi><none/></mmultiscripts>
<msup><mi>a</mi><mrow><mi>n</mi><mo>−</mo><mi>k</mi></mrow></msup>
<msup><mi>b</mi><mi>k</mi></msup>
</mrow>
</math>
T_(k+1) = C(n,k) a^(n-k) b^k
Binomial[n, k] a^(n - k) b^k
T := binomial(n, k)*a^(n-k)*b^k;
T = nchoosek(n, k)*a^(n-k)*b^k;
T_(k+1) = C(n,k) a^(n-k) b^k
ₙCₖ = n! ÷ (k!(n−k)!)
{}_{n}\mathrm{C}_{k} = \frac{n!}{k!\,(n-k)!}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mmultiscripts><mi mathvariant="normal">C</mi><mi>k</mi><none/><mprescripts/><mi>n</mi><none/></mmultiscripts>
<mo>=</mo>
<mfrac>
<mrow><mi>n</mi><mo>!</mo></mrow>
<mrow><mi>k</mi><mo>!</mo><mo>(</mo><mi>n</mi><mo>−</mo><mi>k</mi><mo>)</mo><mo>!</mo></mrow>
</mfrac>
</mrow>
</math>
C(n,k) = (n!)/(k!(n-k)!)
Binomial[n, k]
binomial(n, k);
nchoosek(n, k)
C(n,k) = n!/(k!(n-k)!)
ₙ₋₁Cₖ₋₁ + ₙ₋₁Cₖ = ₙCₖ
{}_{n-1}\mathrm{C}_{k-1} + {}_{n-1}\mathrm{C}_{k} = {}_{n}\mathrm{C}_{k}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mmultiscripts><mi mathvariant="normal">C</mi><mrow><mi>k</mi><mo>−</mo><mn>1</mn></mrow><none/><mprescripts/><mrow><mi>n</mi><mo>−</mo><mn>1</mn></mrow><none/></mmultiscripts>
<mo>+</mo>
<mmultiscripts><mi mathvariant="normal">C</mi><mi>k</mi><none/><mprescripts/><mrow><mi>n</mi><mo>−</mo><mn>1</mn></mrow><none/></mmultiscripts>
<mo>=</mo>
<mmultiscripts><mi mathvariant="normal">C</mi><mi>k</mi><none/><mprescripts/><mi>n</mi><none/></mmultiscripts>
</mrow>
</math>
C(n-1,k-1) + C(n-1,k) = C(n,k)
Binomial[n - 1, k - 1] + Binomial[n - 1, k] == Binomial[n, k]
binomial(n-1, k-1) + binomial(n-1, k) = binomial(n, k);
nchoosek(n-1, k-1) + nchoosek(n-1, k)
C(n-1,k-1) + C(n-1,k) = C(n,k)
How to have ChatGPT do the calculation
You are an algebra calculation assistant. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). Use the binomial theorem to expand (2x+3)^5. Show each of the following: 1. The general term (the (k+1)th term) 2. The binomial coefficients 5Ck for k = 0 to 5 3. The expanded expression (in descending powers of x, with each coefficient as a simplified fraction or a whole number) 4. The coefficient of x^3, and how you found it (how you chose k) In Python, calculate exactly with math.comb and fractions.Fraction from the standard library, and show the formulas you used and the numbers from the execution result.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
