Advanced maths

Robinson Schensted insertion calculator with inverse tableau recovery

Apply classical Robinson–Schensted row insertion to a permutation or recover it from a valid pair of standard tableaux.

Your numbers

Select classical forward row insertion or exact inverse recovery.
Use an integer within the calculator’s stated finite bounds.
Rows strictly increase, columns strictly increase, and the shape has weakly decreasing row lengths.
Must be a standard tableau with exactly the same shape and label range as P.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Apply classical Robinson–Schensted row insertion to a permutation or recover it from a valid pair of standard tableaux.

THE FORMULARS(w)=(P,Q), with row insertion of each w_k and its insertion time k recorded in Q.

A worked example

Permutation 3,1,4,2 gives insertion tableau rows [1,2],[3,4] and recording tableau rows [1,3],[2,4], with shape (2,2).

Good to know

Permutations of 1–40 or pairs of standard straight-shape tableaux with equal shape and entries 1…n. Classical row insertion and reverse insertion, complete bump traces and round-trip certificate. No repeated-letter or generalized RSK variants.

A permutation becomes two matching tableaux

The Robinson–Schensted correspondence transforms a permutation into an insertion tableau P and a recording tableau Q of the same shape. Both are standard tableaux: rows and columns strictly increase, and the labels 1 through n occur exactly once. Together they retain enough information to recover the original permutation.

P contains the values arranged by the insertion process, while Q records when each new cell appeared. Neither tableau alone generally determines the permutation. The shape captures useful subsequence information, but it is only part of the output and should not be mistaken for a count of all tableaux with that shape.

Row insertion for 3,1,4,2Permutation: 3, 1, 4, 2P: valuesQ: insertion times12341324Shape (2,2): LIS = 2, LDS = 2
Scroll across to see the full diagram.
The insertion and recording tableaux both have shape (2,2), but their entries record different aspects of the process.

Compare this with the Standard Young tableaux calculator from partition shape. Transform a submitted permutation into its insertion and recording tableaux, or invert a valid tableau pair back to that permutation. Counting fillings of a given shape does not perform this bijection.

Follow the first-greater bumping rule

To insert a value, scan the first row for its leftmost entry greater than that value. Replace that entry and carry the displaced value to the next row. If no larger entry exists, append the carried value at the row’s end and stop; this creates exactly one new cell.

Repeat the same instruction in each successive row reached by a bump. Because the input values are distinct, the resulting rows and columns stay strictly increasing. The recording tableau puts the current insertion step in the newly created cell, so it has the same growing shape without copying P’s rearranged values.

Prepare the selected input mode

Insertion mode accepts a permutation of 1 through n, with no gaps or repeated labels and at most forty entries. Inverse mode accepts two standard tableaux as rows of integers. Their row lengths must weakly decrease, the shapes must match, and both must contain the same complete label range.

Only the fields belonging to the chosen mode define the calculation. The interface keeps a complete example for each mode so switching is easy, but an inverse calculation does not infer a missing recording tableau. A valid insertion tableau paired with an invalid or differently shaped recording tableau is rejected rather than completed by a guess.

Work through permutation 3,1,4,2

Insert 3 to start a one-cell tableau. Inserting 1 replaces 3 in the first row and bumps 3 into a second row. Inserting 4 appends to the first row. Finally, inserting 2 bumps 4 from the first row and appends it after 3 in the second row.

The final P rows are [1,2] and [3,4]. The cells were created at steps 1 and 3 along the first row, and at steps 2 and 4 along the second, so Q has rows [1,3] and [2,4]. The listed bump paths show where values moved, not merely the final sorted entries.

Reverse insertion recovers the word

Find the cell containing the largest recording label and remove that cell from both tableaux. Carry its P value upward: in the preceding row, replace the rightmost entry smaller than the carried value and carry the replaced entry further upward. The value finally leaving the first row is the last permutation entry.

Repeat with recording labels n−1 down to 1 to recover the entire permutation backward. The maximum label lies in a removable corner because Q is standard. After reconstruction, the calculator reinserts the recovered permutation and checks both tableaux exactly, providing a round-trip certificate rather than trusting the reverse procedure alone.

Read subsequence lengths from the shape

Schensted’s theorem identifies the first row length with the longest increasing subsequence length, and the first column length with the longest decreasing subsequence length. For shape (2,2), both lengths are two. These are subsequences preserving order in the input, not necessarily adjacent substrings.

An increasing permutation produces a single row, while a decreasing permutation produces a single column. Those extreme cases are useful checks on the bumping convention. This page reports the two lengths from the shape; it does not enumerate every longest subsequence or claim that the tableau entries themselves form one particular longest subsequence in input order.

Keep the correspondence convention precise

This calculator uses classical row insertion for distinct permutation values. Other correspondences allow repeated letters, matrices, different bump comparisons or other tableau conventions. Those extensions can produce semistandard rather than standard tableaux, so their input rules and inverse procedures cannot be mixed with the strict rules used here.

The step trace is intentionally bounded by the forty-entry limit and records each bump position and inserted value. It illustrates a deterministic exact bijection, not a numerical optimization. Multiple permutations can share a shape or even the same insertion tableau, but the complete standard pair under this convention identifies exactly one permutation.

A few questions, answered

Do P and Q contain the same information?

No. P records inserted values, while Q records creation times; both are needed for unique inverse recovery.

May a permutation repeat a value?

Not on this page. Inputs must be a permutation of 1…n; repeated-letter RSK conventions are outside scope.

What does the first row length mean?

It equals the longest increasing subsequence length under classical Schensted row insertion.

How is inverse recovery verified?

The recovered permutation is inserted again, and both resulting tableaux must exactly match the supplied pair.

Find your calculator

Start typing to explore the library.