# Robinson–Schensted–Knuth correspondence

In mathematics, the Robinson–Schensted–Knuth correspondence, also referred to as the RSK correspondence or RSK algorithm, is a combinatorial bijection between matrices A with non-negative integer entries and pairs (P,Q) of semistandard Young tableaux of equal shape, whose size equals the sum of the entries of A. More precisely the weight of P is given by the column sums of A, and the weight of Q by its row sums. It is a generalization of the Robinson–Schensted correspondence, in the sense that taking A to be a permutation matrix, the pair (P,Q) will be the pair of standard tableaux associated to the permutation under the Robinson–Schensted correspondence.
The Robinson–Schensted–Knuth correspondence extends many of the remarkable properties of the Robinson–Schensted correspondence, notably its symmetry: transposition of the matrix A results in interchange of the tableaux P,Q.

## The Robinson–Schensted–Knuth correspondence
### Introduction

The Robinson–Schensted correspondence is a bijective mapping between permutations and pairs of standard Young tableaux, both having the same shape. This bijection can be constructed using an algorithm called Schensted insertion, starting with an empty tableau and successively inserting the values σ$_1$, ..., σ$_n$ of the permutation σ at the numbers 1, 2, ..., n; these form the second line when σ is given in two-line notation:
$\sigma ={\begin{pmatrix}1&2&\ldots &n\\\sigma _{1}&\sigma _{2}&\ldots &\sigma _{n}\end{pmatrix}}$.
The first standard tableau P is the result of successive insertions; the other standard tableau Q records the successive shapes of the intermediate tableaux during the construction of P.
The Schensted insertion easily generalizes to the case where σ has repeated entries; in that case the correspondence will produce a semistandard tableau P rather than a standard tableau, but Q will still be a standard tableau. The definition of the RSK correspondence reestablishes symmetry between the P and Q tableaux by producing a semistandard tableau for Q as well.

### Two-line arrays

The two-line array (or generalized permutation) w$_A$ corresponding to a matrix A is defined as
    $w_{A}={\begin{pmatrix}i_{1}&i_{2}&\ldots &i_{m}\\j_{1}&j_{2}&\ldots &j_{m}\end{pmatrix}}$
in which for any pair (i,j) that indexes an entry A$_{i,j}$ of A, there are A$_{i,j}$ columns equal to ${\tbinom {i}{j}}$, and all columns are in lexicographic order, which means that
* $i_{1}\leq i_{2}\leq i_{3}\cdots \leq i_{m}$, and
* if $i_{r}=i_{s}\,$ and $r\leq s$ then $j_{r}\leq j_{s}$.

#### Example

The two-line array corresponding to
    $A={\begin{pmatrix}1&0&2\\0&2&0\\1&1&0\end{pmatrix}}$
is
    $w_{A}={\begin{pmatrix}1&1&1&2&2&3&3\\1&3&3&2&2&1&2\end{pmatrix}}$

### Definition of the correspondence

By applying the Schensted insertion algorithm to the bottom line of this two-line array, one obtains a pair consisting of a semistandard tableau P and a standard tableau Q$_0$, where the latter can be turned into a semistandard tableau Q by replacing each entry b of Q$_0$ by the b-th entry of the top line of w$_A$. One thus obtains a bijection from matrices A to ordered pairs, (P,Q) of semistandard Young tableaux of the same shape, in which the set of entries of P is that of the second line of w$_A$, and the set of entries of Q is that of the first line of w$_A$. The number of entries j in P is therefore equal to the sum of the entries in column j of A, and the number of entries i in Q is equal to the sum of the entries in row i of A.

#### Example

In the above example, the result of applying the Schensted insertion to successively insert 1,3,3,2,2,1,2 into an initially empty tableau results in a tableau P, and an additional standard tableau Q$_0$ recoding the successive shapes, given by
    $P\quad =\quad {\begin{matrix}1&1&2&2\\2&3\\3\end{matrix}},\qquad Q_{0}\quad =\quad {\begin{matrix}1&2&3&7\\4&5\\6\end{matrix}},$
and after replacing the entries 1,2,3,4,5,6,7 in Q$_0$ successively by 1,1,1,2,2,3,3 one obtains the pair of semistandard tableaux
    $P\quad =\quad {\begin{matrix}1&1&2&2\\2&3\\3\end{matrix}},\qquad Q\quad =\quad {\begin{matrix}1&1&1&3\\2&2\\3\end{matrix}}.$

#### Direct definition of the RSK correspondence

The above definition uses the Schensted algorithm, which produces a standard recording tableau Q$_0$, and modifies it to take into account the first line of the two-line array and produce a semistandard recording tableau; this makes the relation to the Robinson–Schensted correspondence evident. It is natural however to simplify the construction by modifying the shape recording part of the algorithm to directly take into account the first line of the two-line array; it is in this form that the algorithm for the RSK correspondence is usually described. This simply means that after every Schensted insertion step, the tableau Q is extended by adding, as entry of the new square, the b-th entry i$_b$ of the first line of w$_A$, where b is the current size of the tableaux. That this always produces a semistandard tableau follows from the property (first observed by Knuth) that for successive insertions with an identical value in the first line of w$_A$, each successive square added to the shape is in a column strictly to the right of the previous one.
Here is a detailed example of this construction of both semistandard tableaux. Corresponding to a matrix
    $A={\begin{pmatrix}0&0&0&0&0&0&0\\0&0&0&1&0&1&0\\0&0&0&1&0&0&0\\0&0&0&0&0&0&1\\0&0&0&0&1&0&0\\0&0&1&1&0&0&0\\0&0&0&0&0&0&0\\1&0&0&0&0&0&0\\\end{pmatrix}}$
one has the two-line array
$w_{A}={\begin{pmatrix}2&2&3&4&5&6&6&8\\4&6&4&7&5&3&4&1\end{pmatrix}}.$
The following table shows the construction of both tableaux for this example
| Inserted pair | ${\tbinom {2}{4}}$ | ${\tbinom {2}{6}}$ | ${\tbinom {3}{4}}$ | ${\tbinom {4}{7}}$ | ${\tbinom {5}{5}}$ | ${\tbinom {6}{3}}$ | ${\tbinom {6}{4}}$ | ${\tbinom {8}{1}}$ |
| P | ${\begin{matrix}4\end{matrix}}$ | ${\begin{matrix}4&6\end{matrix}}$ | ${\begin{matrix}4&4\\6\end{matrix}}$ | ${\begin{matrix}4&4&7\\6\end{matrix}}$ | ${\begin{matrix}4&4&5\\6&7\end{matrix}}$ | ${\begin{matrix}3&4&5\\4&7\\6\end{matrix}}$ | ${\begin{matrix}3&4&4\\4&5\\6&7\end{matrix}}$ | ${\begin{matrix}1&4&4\\3&5\\4&7\\6\end{matrix}}$ |
| Q | ${\begin{matrix}2\end{matrix}}$ | ${\begin{matrix}2&2\end{matrix}}$ | ${\begin{matrix}2&2\\3\end{matrix}}$ | ${\begin{matrix}2&2&4\\3\end{matrix}}$ | ${\begin{matrix}2&2&4\\3&5\end{matrix}}$ | ${\begin{matrix}2&2&4\\3&5\\6\end{matrix}}$ | ${\begin{matrix}2&2&4\\3&5\\6&6\end{matrix}}$ | ${\begin{matrix}2&2&4\\3&5\\6&6\\8\end{matrix}}$ |

## Combinatorial properties of the RSK correspondence
### The case of permutation matrices

If $A$ is a permutation matrix then RSK outputs standard Young Tableaux (SYT), $P,Q$ of the same shape $\lambda$. Conversely, if $P,Q$ are SYT having the same shape $\lambda$, then the corresponding matrix $A$ is a permutation matrix. As a result of this property by simply comparing the cardinalities of the two sets on the two sides of the bijective mapping we get the following corollary:
Corollary 1: For each $n\geq 1$ we have $\sum _{\lambda \vdash n}(t_{\lambda })^{2}=n!$ where $\lambda \vdash n$ means $\lambda$ varies over all partitions of $n$ and $t_{\lambda }$ is the number of standard Young tableaux of shape $\lambda$.

### Symmetry

Let $A$ be a matrix with non-negative entries. Suppose the RSK algorithm maps $A$ to $(P,Q)$ then the RSK algorithm maps $A^{T}$ to $(Q,P)$, where $A^{T}$ is the transpose of $A$.
In particular for the case of permutation matrices, one recovers the symmetry of the Robinson–Schensted correspondence:
Theorem 2: If the permutation $\sigma$ corresponds to a triple $(\lambda ,P,Q)$, then the inverse permutation, $\sigma ^{-1}$, corresponds to $(\lambda ,Q,P)$.
This leads to the following relation between the number of involutions on $S_{n}$ with the number of tableaux that can be formed from $S_{n}$ (An involution is a permutation that is its own inverse):
Corollary 2: The number of tableaux that can be formed from $\{1,2,3,\ldots ,n\}$ is equal to the number of involutions on $\{1,2,3,\ldots ,n\}$.
Proof: If $\pi$ is an involution corresponding to $(P,Q)$, then $\pi =\pi ^{-}$ corresponds to $(Q,P)$; hence $P=Q$. Conversely, if $\pi$ is any permutation corresponding to $(P,P)$, then $\pi ^{-}$ also corresponds to $(P,P)$; hence $\pi =\pi ^{-}$. So there is a one-one correspondence between involutions $\pi$ and tableaux $P$
The number of involutions on $\{1,2,3,\ldots ,n\}$ is given by the recurrence:
    $a(n)=a(n-1)+(n-1)a(n-2)\,$
Where $a(1)=1,a(2)=2$. By solving this recurrence we can get the number of involutions on $\{1,2,3,\ldots ,n\}$,
    $I(n)=n!\sum _{k=0}^{\lfloor n/2\rfloor }{\frac {1}{2^{k}k!(n-2k)!}}$

### Symmetric matrices

Let $A=A^{T}$ and let the RSK algorithm map the matrix $A$ to the pair $(P,P)$, where $P$ is an SSYT of shape $\alpha$. Let $\alpha =(\alpha _{1},\alpha _{2},\ldots )$ where the $\alpha _{i}$ are non-negative integers and ∑$_i$α$_i$<∞{\textstyle \sum _{i}\alpha _{i}<\infty }. Then the map $A\longmapsto P$ establishes a bijection between symmetric matrices with $\mathrm {row} (A)=\alpha$ and SSYT's of weight $\alpha$.

## Applications of the RSK correspondence
### Cauchy's identity

The Robinson–Schensted–Knuth correspondence provides a direct bijective proof of the following celebrated identity for symmetric functions:
    $\prod _{i,j}(1-x_{i}y_{j})^{-1}=\sum _{\lambda }s_{\lambda }(x)s_{\lambda }(y)$
where $s_{\lambda }$ are Schur functions.

### Kostka numbers

Fix partitions $\mu ,\nu \vdash n$, then
    $\sum _{\lambda \vdash n}K_{\lambda \mu }K_{\lambda \nu }=N_{\mu \nu }$
where $K_{\lambda \mu }$ and $K_{\lambda \nu }$ denote the Kostka numbers and $N_{\mu \nu }$ is the number of matrices $A$, with non-negative elements, with $\mathrm {row} (A)=\mu$ and $\mathrm {column} (A)=\nu$.