Catalan Triangle Calculator

Term

Catalan triangle entry T(n, k)28
Catalan number C(n), the k = 0 entry42
Row sum (the next Catalan number)132
Entry above, T(n-1, k)9
How this was calculated
  1. Catalan triangle entries, also called ballot numbers, count lattice paths that never dip below the diagonal: T(n, k) refines the Catalan number C(n) by how high the path finishes.
  2. The formula is T(n, k) = (k + 1) / (n + 1) x C(2n - k, n - k), a binomial coefficient scaled by a simple fraction.
  3. For n = 5 and k = 2: C(8, 3) = 56, and multiplying by (2 + 1) / (5 + 1) gives T(5, 2) = 28.
  4. The k = 0 entry of the row is the Catalan number C(5) = 42, and the whole row sums to 132, the next Catalan number.

The Catalan Triangle Calculator builds the Catalan triangle row by row and returns the entry T(n, k) you ask for. Each entry is computed with T(n, k) = (k + 1)/(n + 1) x C(2n - k, n - k), a formula that counts lattice paths by their final height. For example, T(5, 2) = 28. The calculator also shows the structure behind the numbers: the k = 0 entry of every row is the Catalan number itself, so row 5 starts at 42. Row 4 reads 14, 14, 9, 4, 1 and sums to 42, and each row sums to the next Catalan number, with row 5 summing to 132.

This method is the accepted standard for the calculation because it applies the defining formula for the Catalan triangle directly, so every entry follows from the same rule rather than from a shortcut or an approximation. That makes the results consistent from row to row and easy to check by hand. This page shows the formula, step-by-step workings, worked examples and sources, so you can follow how each value is produced and confirm it yourself. Whether you need a single entry such as T(5, 2) = 28 or a full row like 14, 14, 9, 4, 1, the calculator gives the answer together with the reasoning behind it.

Worked examples

T(5, 2)

(5 · 2)

Catalan triangle entry T(n, k)28
Catalan number C(n), the k = 0 entry42
Row sum (the next Catalan number)132
Entry above, T(n-1, k)9

T(4, 1)

(4 · 1)

Catalan triangle entry T(n, k)14
Catalan number C(n), the k = 0 entry14
Row sum (the next Catalan number)42
Entry above, T(n-1, k)5

T(6, 3)

(6 · 3)

Catalan triangle entry T(n, k)48
Catalan number C(n), the k = 0 entry132
Row sum (the next Catalan number)429
Entry above, T(n-1, k)14

From Catalan numbers to the triangle

The Catalan numbers count a whole family of paths at once, but they do not tell you anything about where those paths finish. The Catalan triangle splits that single total into parts, sorting paths by the height at which they end. That is the refinement the triangle adds, and it is why a catalan triangle calculator is useful when final height matters as much as the overall count.

The entry in row n and position k is written T(n, k) = (k + 1)/(n + 1) x C(2n - k, n - k). Each such entry counts lattice paths by their final height. So instead of one number for row n, you get a row of numbers, one for each possible ending height. A path that stays low and a path that climbs high are counted in different positions even though both belong to the same row.

The connection to the Catalan numbers appears at the start of every row. The k = 0 entry of every row is the Catalan number itself: row 5 starts at 42. This makes sense because the k = 0 position collects the paths that end at height zero, and that count is exactly the Catalan number C(n). The rest of the row then accounts for the paths that end higher up.

Row 4 shows the full pattern: it reads 14, 14, 9, 4, 1 and sums to 42. Those five entries break the single Catalan value 42 into five groups by final height. Add them back together and you recover the Catalan number. The same structure holds one row down: row 5 sums to 132, which is the next Catalan number. Each row sums to the next Catalan number, so the triangle carries the Catalan sequence along its leading edge and in its row totals at the same time.

Individual entries can also be read on their own. For example, T(5, 2) = 28, the count of paths in row 5 that end at the height labeled by k = 2. That single value is invisible if you only know the row total of 132; the triangle is what makes it available. Reading a row from left to right, you move from the paths that end lowest to those that end highest, and the entries generally shrink as k grows. The leading entry stays the Catalan number, and the trailing entries pick up the paths that finish near the top.

Every row of the Catalan triangle adds up to a Catalan number, and its first entry is one too. The triangle takes that total and distributes it across final heights, so each cell answers a sharper question than the Catalan number alone.

Reading a row

The most reliable way to read a row of the Catalan triangle is to check it against the Catalan numbers you already know. Row 4 reads 14, 14, 9, 4, 1, and those five entries sum to 42. That total is the Catalan number for the next row's leading entry: row 5 begins at 42. So the row you are reading and the row below it are tied together by a single number, and you can use that link as a built-in error check whenever you work through a catalan triangle calculator.

Row 5 continues past its leading 42, and the second entry is 28 — the value of T(5, 2). Put the two rows side by side and the pattern becomes easy to follow: each row has one more entry than the row above it, the first entry is always the Catalan number itself, and the entries shrink as you move right.

The table below lays out both rows with their sums so the check is visible at a glance.

Row 5 sums to 132, which is the next Catalan number after 42. That is the general rule, not a coincidence of these two rows: each row sums to the next Catalan number. Reading down the left edge of the triangle gives you the Catalan sequence in order, and reading across any row gives you the entries whose total produces the next term in that sequence. Once you know a row's sum, you know the first entry of the row beneath it.

A practical habit when using the calculator: start at the left, confirm the leading entry matches the Catalan number you expect, then add across and compare your total to the leading entry of the next row. If the two agree, you have read the row correctly. If they do not, recheck the entries before trusting any single value. The formula behind each entry, T(n, k) = (k + 1)/(n + 1) x C(2n - k, n - k), counts lattice paths by their final height, so a misread entry usually means a miscounted path group rather than a broken rule.

  • Row 4: 14, 14, 9, 4, 1 — sums to 42.
  • Row 5 starts at 42 and sums to 132.
  • The k = 0 entry of every row is the Catalan number itself.
  • Each row sums to the next Catalan number.
RowEntriesSum
Row 414, 14, 9, 4, 142
Row 542, 28, ...132
Quick check: add the entries in a row, then look at the first entry of the row below. Row 4 sums to 42, and row 5 starts at 42. Row 5 sums to 132.

The ballot formula

The Catalan triangle gets its name because its entries count lattice paths grouped by where they end. The entry T(n, k) is defined by a single formula that combines an ordinary binomial coefficient with a small correction factor: T(n, k) = (k + 1)/(n + 1) x C(2n - k, n - k). Read from the inside out, the binomial coefficient C(2n - k, n - k) counts a raw set of paths, and the factor (k + 1)/(n + 1) trims that raw count down to the paths that stay within the allowed boundary and finish at the height labeled k. That is why the factor looks like a ratio of small integers rather than anything exotic: it is doing the boundary bookkeeping.

The best way to see the formula work is to run it by hand on a specific cell. Take n = 5 and k = 2. The binomial coefficient becomes C(2 x 5 - 2, 5 - 2), which is C(8, 3). The correction factor is (2 + 1)/(5 + 1), or 3/6, which reduces to 1/2. Applying the factor to the binomial coefficient gives T(5, 2) = 28. So the second entry of row 5 is 28, and you can check it against the row itself: row 5 begins with the Catalan number 42 at k = 0, and 28 is the value that follows.

The k = 0 case is worth pausing on, because it shows the formula collapsing into something familiar. When k = 0, the factor (k + 1)/(n + 1) becomes 1/(n + 1), and the binomial coefficient becomes C(2n, n). The product is the standard Catalan number, which is exactly why the k = 0 entry of every row is the Catalan number itself. Row 5 starts at 42 for that reason, and the same rule holds for every other row. A catalan triangle calculator simply evaluates this expression for each cell you ask about, so you never have to reduce the fraction or expand the binomial coefficient by hand.

The rows also carry a second, independent check on the arithmetic. Row 4 reads 14, 14, 9, 4, 1, and those five entries sum to 42. That is not a coincidence: each row sums to the next Catalan number, so the total for row 4 equals the leading entry of row 5. Row 5 in turn sums to 132. If you compute a row with the formula and the entries do not add up to the expected Catalan number, you know a step went wrong somewhere, which makes the row sum a useful sanity check alongside the formula itself.

T(5, 2) = (2 + 1)/(5 + 1) x C(8, 3) = (1/2) x 56 = 28.

Ballot problems

The classic ballot problem asks a simple question: if two candidates are counted vote by vote, what is the chance that one candidate stays strictly ahead of the other from the first ballot to the last? The Catalan triangle turns out to be a natural tool for this kind of question, because its entries count lattice paths by their final height. That path-counting view is exactly what a ballot count looks like when you trace it across a grid, so a catalan triangle calculator can take you from a row of triangle values straight to the ballot probabilities behind them.

The connection runs through the triangle's defining formula. The entry T(n, k) = (k + 1)/(n + 1) × C(2n - k, n - k) counts lattice paths by their final height, where n sets the row and k sets the position within it. In ballot terms, think of a count that moves one step right for each vote for the first candidate and one step up for each vote for the second. The paths counted by the triangle are the possible sequences of those steps, and the final height records how the count ends. The k = 0 entry of every row is the Catalan number itself, and row 5 starts at 42. Those are the paths that never rise above the starting line, which is the shape a candidate's lead takes when it must never slip behind.

Concrete rows make the idea easier to follow. Row 4 reads 14, 14, 9, 4, 1 and sums to 42, and each row sums to the next Catalan number, so row 5 sums to 132. The individual entries separate the paths by where they finish, while the row total collects every ending into one Catalan-sized count. For ballot work, that split is useful: the total tells you how many orderings are possible, and the separate entries tell you how many of them end at each height. One entry you can check by hand is T(5, 2) = 28, the number of paths in row 5 that finish at that position.

To turn counts into probabilities, compare the number of favorable orderings with the total number of orderings. The triangle supplies the favorable counts through its entries and the total through its row sum, which is the next Catalan number. Because the formula counts paths by final height, you can ask sharper questions than a single overall probability: how many counts end with the first candidate ahead, how many stay level, or how many finish a given distance apart. A catalan triangle calculator does the arithmetic for you, so you can read a row, pick the entries that match your ballot condition, and compare them against the row total without working through the formula by hand.

Row 4 reads 14, 14, 9, 4, 1 and sums to 42, the Catalan number that starts row 5. Row 5 sums to 132, the next Catalan number — so each row total gives you the full set of orderings to compare against.

FAQs

What is the Catalan triangle?

The Catalan triangle is a triangle of ballot numbers that refines the Catalan numbers by final path height. Each entry corresponds to paths ending at a particular height. For example, T(5, 2) = 28. So instead of one Catalan number per row, the triangle breaks that total into parts by height.

What is T(4, 1)?

T(4, 1) = 14. This is the entry at row 4, position 1 in the Catalan triangle. It counts the lattice paths in that row that end at height 1 while never dipping below the axis. The value comes directly from the triangle's ballot-number definition.

How does the triangle relate to Catalan numbers?

The first entry of row n is C(n), the nth Catalan number, and the entire row sums to C(n + 1). For instance, row 5 sums to 132, which is C(6). This shows how the triangle refines Catalan numbers: each row partitions the next Catalan number into ballot counts by final height.

What do the entries count?

Each entry counts lattice paths from (0, 0) to a point at height k that never dip below the axis. Equivalently, these are ballot counts. The height k sets which entry you read, so the triangle organizes paths by where they end while staying nonnegative throughout.

What is the ballot problem?

The ballot problem is the classic question of how often one candidate leads another throughout an election count. The entries of the Catalan triangle answer it, which is why they are called ballot numbers. Each count reflects paths that stay above the axis, matching one candidate never falling behind.

Where can I look up the triangle?

The triangle is catalogued in the OEIS under Catalan's triangle, also called the ballot triangle. The OEIS entry gives the sequence of entries and lets you compare values across rows, making it a convenient reference for checking results from this calculator.

Sources

Related calculators

Catalan Number Calculator
The Catalan numbers — C(2n, n) divided by (n + 1) — counting bracketings, binary trees, polygon triangulations and lattice paths that never cross the diagonal.
Stirling Numbers Calculator
Stirling numbers of the second kind S(n, k) - the ways to partition n items into k groups - with the Bell number.
Bernoulli Number Calculator
Exact Bernoulli numbers B(n) as fractions by the Akiyama-Tanigawa algorithm, with the decimal value, numerator and denominator.