Utinzo

Pascal's Triangle Calculator

Generate up to 20 rows of Pascal's Triangle and display the nCr (combination) values for any selected row.

Did this tool work for you?

How to use this calculator

C(n,k) = C(n−1,k−1) + C(n−1,k)

Each entry is the sum of the two entries above it. Row n contains the binomial coefficients C(n,0), C(n,1), …, C(n,n).

  1. 1

    Enter the number of rows to generate (1–20).

  2. 2

    Enter the row number (0-indexed) for which you want the individual nCr values displayed.

  3. 3

    Each row of Pascal's Triangle is shown, with the selected row highlighted.

  4. 4

    The nCr (combination) values and row sum (2^n) are displayed below the triangle.

Frequently asked questions

How are rows numbered?

From 0. Row 0 is just 1, row 1 is 1 1, row 2 is 1 2 1, and row 5 is 1 5 10 10 5 1. Row n holds the values C(n, 0) through C(n, n), so it has n + 1 entries. The 0-indexed convention matches the formula for combinations.

How many rows can I generate?

From 1 to 20. Values outside that range are pulled to the nearest limit, so 30 gives 20 rows and 0 gives a single row (row 0). Decimals are rounded down. The 20th row displayed is row 19.

What if the highlighted row is beyond the rows I generated?

It is clamped to the last row that was generated. Asking for 5 rows and highlighting row 12 shows the nCr values for row 4, with the sum 16. Negative row numbers are treated as 0. The label always states the actual row used.

What does each entry mean?

Entry k in row n is the number of ways to choose k items from n, written C(n, k) or nCr and equal to n! ÷ (k!(n − k)!). Each entry is also the sum of the two directly above it. In row 5 the values are 1, 5, 10, 10, 5, 1, so C(5, 2) = 10.

Why does the row sum show 2 raised to the row number?

Adding all the entries in row n counts every subset of an n-element set, and there are 2ⁿ of them. Row 9 sums to 512 = 2⁹ and row 19 to 524288 = 2¹⁹. The sum line is computed from the highlighted row.

Are the numbers exact?

Yes. Rows are built by adding integers, and the largest entry in 20 rows is 92378 (twice, in row 19), far below the size where JavaScript starts losing precision. No rounding or formatting is involved.

How do I use it for binomial expansion?

Row n lists the coefficients of (x + y)ⁿ in order. For row 4 the coefficients are 1, 4, 6, 4, 1, so (x + y)⁴ = x⁴ + 4x³y + 6x²y² + 4xy³ + y⁴. For (x − y)ⁿ keep the same numbers and alternate their signs.

Can it give me a single value of C(n, k) for large n?

Only for n up to 19. The tool generates complete rows, not individual entries, and it stops at 20 rows. For a bigger n you need the factorial formula directly.

About pascal's triangle calculator

Pascal’s triangle calculator — rows, nCr values and row sums

Building the triangle

Every row starts and ends with 1, and every other entry is the sum of the two entries above it. Counting rows from 0, the entry in position k of row n equals C(n, k) = n! ÷ (k!(n − k)!). The calculator builds up to 20 rows, highlights the one you select, and lists its nCr values along with the sum of the row.

Rows 0 to 6, as the calculator prints them
RowEntriesSum
011
11 12
21 2 14
31 3 3 18
41 4 6 4 116
51 5 10 10 5 132
61 6 15 20 15 6 164

Worked example: counting coin flips

Row 5 gives the number of ways to get 0, 1, 2, 3, 4 or 5 heads in five coin flips: 1, 5, 10, 10, 5, 1. They total 32, which is 2⁵, the number of possible outcomes. So the chance of exactly two heads is 10 ÷ 32, or 31.25%. That is a direct reading of the C(5,2) = 10 entry produced by the tool.

Worked example: a larger row

Highlighting row 9 with 10 rows generated gives 1, 9, 36, 84, 126, 126, 84, 36, 9, 1, and a sum of 512 = 2⁹. At the other end of the range, row 19 has the middle pair 92378 and 92378, and its sum is 524288 = 2¹⁹. The two central entries are always equal in an odd-numbered row, because the triangle is symmetric.

Binomial expansion

The entries of row n are the coefficients of (x + y)ⁿ. Row 4 reads 1, 4, 6, 4, 1, giving x⁴ + 4x³y + 6x²y² + 4xy³ + y⁴. Row 3, 1 3 3 1, gives (x + y)³ = x³ + 3x²y + 3xy² + y³. When the binomial has a minus sign the magnitudes are unchanged and the signs alternate.

Input limits to remember

The number of rows is limited to 20, so the largest row you can reach is row 19, and the highlighted row is clamped into the generated range. Both inputs are rounded down to whole numbers. An empty field is read as 0, which gives one row and highlights row 0.

Pascal's Triangle Calculator – Utinzo

Learn more from an authoritative source:

Wikipedia
Related tools

Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →