Connect via MCP →

Enter Calculation

Used when Show = Row(s). Generates rows 0 through this value.

Formula

Formula: Pascal's Triangle Calculator
Show calculation steps (1)
  1. Triangle recurrence

    Triangle recurrence: Pascal's Triangle Calculator

    Build the triangle by adding the two entries above; edges are 1.

Advertisement

Results

Answer — C(4, 2)
6
binomial coefficient
Row (n) 4
Column (k) 2
Sum of row n (2^n) 16

What is Pascal's Triangle?

Pascal's Triangle is a triangular array of numbers where each entry is the sum of the two numbers directly above it. The edges are all 1, and the interior numbers grow from there. Every entry equals a binomial coefficient, written \(C(n, k)\) or "n choose k", which counts the number of ways to choose k items from a set of n. The triangle is 0-indexed: the very top is row 0 = {1}, row 1 = {1, 1}, row 2 = {1, 2, 1}, and so on.

Pascal's Triangle showing the first several rows with each number formed by adding the two numbers above it
Each entry of Pascal's Triangle is the sum of the two numbers directly above it.

How to use this calculator

Pick a mode under Show. Choose One Number to compute a single entry: enter the row index n and column index k (both starting at 0, with k between 0 and n). Choose Row(s) to generate the full triangle and enter the Number of rows — the tool prints every row from 0 up to that value, along with each row's sum.

The formula explained

The closed form is $$C(n,k) = \frac{n!}{k!\,(n-k)!}.$$ To avoid huge factorials, the calculator uses the multiplicative form \(C(n,k) = \prod_{i=1}^{k} \frac{n-k+i}{i}\) for \(i = 1..k\), looping over the smaller of \(k\) and \(n-k\) thanks to the symmetry \(C(n,k) = C(n,n-k)\). The triangle itself is built with the recurrence $$a(n,k) = a(n-1,k-1) + a(n-1,k),$$ which needs only additions.

Advertisement
Diagram relating a triangle entry to the binomial coefficient C(n,k) with row index n and position k
An entry at row n, position k equals the binomial coefficient \(C(n,k)\).

Worked example

For \(n = 4\), \(k = 2\): $$C(4,2) = \frac{4!}{2!\cdot 2!} = \frac{24}{4} = 6.$$ That matches the third number in row 4 of the triangle {1, 4, 6, 4, 1}. The sum of row 4 is \(2^4 = 16\).

Advertisement

Applications

Binomial expansion: the coefficients of \((x + y)^n\) are exactly row n. For example, $$(x + y)^4 = x^4 + 4x^3y + 6x^2y^2 + 4xy^3 + y^4.$$ Combinations: \(C(n,k)\) is the number of ways to choose k objects from n. Probability: with equally likely binary outcomes, row n sums to \(2^n\) total outcomes, and \(C(n,k)/2^n\) is the chance of exactly k successes — e.g. \(P(\text{exactly 1 head in 3 tosses}) = C(3,1)/2^3 = 3/8 = 37.5\%\).

FAQ

Is the triangle 0-indexed? Yes. Both the row n and column k start at 0, so the top single 1 is row 0, column 0.

What if k is greater than n? That point lies outside the triangle, so the value is 0 and the calculator flags a note.

Why does each row sum to a power of 2? Because the sum of all \(C(n,k)\) for \(k = 0..n\) equals \(2^n\), which is also the total number of subsets of an n-element set.

Last updated: