TL;DR
A doubly stochastic matrix is a square grid of non-negative numbers in which every row adds up to 1 and every column adds up to 1. Read it as a fair-share table: each row gives out exactly one whole unit, and each column collects exactly one whole unit. Matrices like this are the bridge between "a table of probabilities" and "a one-to-one matching".
Where you'll see it: in assignment and matching problems, in Markov chains whose long-run behaviour is uniform, and in soft matching layers of neural networks and in optimal transport.
Intuition
Start from a sharing problem
Suppose three workers each have one full day to spend, and three tasks each need exactly one day's worth of attention in total. Let the entry in row , column be the fraction of worker 's day spent on task . Two rules must hold:
- Worker spends the whole day, so the fractions in row add to 1. Nobody has time left over and nobody works more than a day.
- Task gets exactly one day in total, so the fractions in column add to 1. No task is starved and none is overfunded.
A grid that obeys both rules is doubly stochastic. The word "stochastic" means that each row is a split of one whole, and "doubly" means that the columns are splits of one whole too.
Why the second rule is the interesting one
A row-only rule is common and easy to satisfy. Every Markov chain has a transition matrix whose rows sum to 1: from each state the chain has to go somewhere. Columns are a different matter. Column sums ask how much probability flows into each state, and that is usually not 1. Requiring both rows and columns to sum to 1 is a much stronger condition, and it forces the matrix to be balanced in a way the row rule does not.
flowchart LR A[Non-negative entries] --> B[Rows sum to 1: each source spends one unit] A --> C[Columns sum to 1: each target receives one unit] B --> D[Doubly stochastic] C --> D D --> E[Mixture of one-to-one matchings]
The math
Definition
An matrix is doubly stochastic if
- every entry is non-negative: for all ;
- every row sums to 1: for every ;
- every column sums to 1: for every .
Here is the entry in row and column , and is the size of the square grid. The first condition says entries are never negative. The second is the row rule and the third is the column rule. A matrix that satisfies only the first two is called row-stochastic, and it is exactly what a transition matrix is.
Two simple examples always work. The identity matrix (1s on the diagonal, 0s elsewhere) is doubly stochastic, because each row and each column has exactly one 1. The matrix whose every entry is is doubly stochastic too, because each row and column has entries of and those add to 1.
Permutation matrices
A permutation matrix is a 0-1 matrix with exactly one 1 in each row and exactly one 1 in each column. It encodes a one-to-one matching: row is sent to the column where its 1 sits. For , one example is
Every permutation matrix is doubly stochastic, since each row and column contains a single 1. The converse is not true in general, but the next result says how the two families are related.
The Birkhoff–von Neumann theorem
A convex combination of matrices is a sum with every weight and . Weights are like a recipe whose proportions add to one. See convex sets.
The theorem says that every doubly stochastic matrix is a convex combination of permutation matrices:
where each is a permutation matrix. Conversely, any such combination is doubly stochastic, because a convex combination of matrices with row and column sums equal to 1 still has row and column sums equal to 1. So the doubly stochastic matrices are exactly the convex hull of the permutation matrices. In plain terms: a fractional sharing plan is always a mixture of exact one-to-one plans.
Closure under products
If and are doubly stochastic, so is their product . The entries of are , which are non-negative because every term is a product of two non-negative numbers. For the row sums,
The column sums work the same way with the roles of rows and columns swapped. This is why the class is closed under the operations you use to chain sharing steps together.
Uniform stationary distribution
Let be a row Vector of length with entries . Then has -th entry . So : the uniform distribution is stationary for . This is the reason doubly stochastic transition matrices are used when you want a chain that settles into equal probability over its states.
Worked examples
Test two matrices.
- All entries are non-negative.
- Row sums: and .
- Column sums: and .
So is doubly stochastic.
- All entries are non-negative.
- Row sums: and .
- Column 1 sums to , not 1.
So is row-stochastic but not doubly stochastic. Passing the row test is not enough.
Take
- Row 1: .
- Row 2: .
- Row 3: .
- Column 1: .
- Column 2: .
- Column 3: .
Every row and column is a whole unit, so is doubly stochastic. Read it as three workers splitting their time across three tasks, where each task receives exactly one unit of attention in total.
To check the uniform-stationary claim, multiply by . The first entry is , the second is , and the third is . The vector comes back unchanged.
Suppose a matching model gives each pair a positive score, and you want soft assignment weights that obey both sharing rules. Start with
The Sinkhorn method repeats two steps: divide each row by its sum, then divide each column by its sum. Sinkhorn showed in 1964 that for a matrix with all positive entries, this alternation converges to a doubly stochastic matrix.
Step 1, row normalisation. Row 1 sums to 3 and row 2 sums to 7, so the rows become and , which is about and .
Step 2, column normalisation. Column 1 sums to and column 2 sums to . Dividing gives
The columns now sum to 1, but the rows do not: the first row is and the second is . One more round of row and column scaling pulls them closer to 1. Repeating the two steps until both sums are 1 (to the accuracy you need) yields the doubly stochastic matrix that the scores determine.
Tradeoffs and failure modes
| Situation | Problem | Better choice |
|---|---|---|
| Each source must spend exactly one unit and each target must receive exactly one unit | Checking only rows misses unbalanced targets | Doubly stochastic, checked on both rows and columns |
| Only the outgoing probabilities from each state matter | Requiring column sums adds a constraint you do not need | Row-stochastic transition matrix, as in a Markov chain |
| You need a hard one-to-one assignment, not fractions | A doubly stochastic matrix gives shares, not decisions | Round to a permutation matrix, or solve the assignment problem directly |
| You start from arbitrary positive scores | Rows and columns cannot both be normalised in one step | Sinkhorn iterations, which converge but may need many rounds |
| The matrix is very large | Storing and scaling entries becomes expensive | Sparse representations, or a method that never forms the full matrix |
The most common mistake is to check rows, see that they sum to 1, and stop. Always check the columns as well. A second common mistake is to treat a convex mixture of permutation matrices as a single assignment. It is a fractional plan, and a fractional plan is not the same thing as a matching.
History
Garrett Birkhoff proved the central result in 1946, in a short paper that showed doubly stochastic matrices are mixtures of permutation matrices. John von Neumann worked on closely related results a few years later, which is why the theorem carries both names. In the 1960s, Richard Sinkhorn showed that scaling the rows and columns of a positive matrix in turn converges to a doubly stochastic one. Sinkhorn's scaling idea is the basis of the Sinkhorn–Knopp algorithm, which later became a standard tool in optimal transport and machine learning. The idea caught on because it turns a messy set of scores into a balanced table, and that balance is useful wherever a fair split of resources has to be found.
Recap
A doubly stochastic matrix is a non-negative square matrix with every row and every column summing to 1. Its rows alone make a transition matrix, and the extra column rule gives a uniform stationary distribution. Products of such matrices stay doubly stochastic, and the Birkhoff–von Neumann theorem says every one is a mixture of permutation matrices, which are exact one-to-one matchings.
Check yourself
QuestionBesides non-negativity, which two conditions make a square matrix doubly stochastic?Show answer
Every row must sum to 1 and every column must sum to 1. Checking only one of them is not enough: a matrix can have every row summing to 1 and still have a column that sums to 0.9 or 1.2.
QuestionIs doubly stochastic?Show answer
No. The rows sum to and , so it passes the row test. The columns are and , and neither is 1. It is row-stochastic only.
QuestionWhy is the product of two doubly stochastic matrices doubly stochastic?Show answer
Each entry of the product is a sum of products of non-negative numbers, so it is non-negative. For a row sum, first add across the columns of the second matrix: for each , because has row sums 1. The row total of the product then becomes , because has row sums 1. The column case is symmetric and uses the column sums of instead.
QuestionA Markov chain on three states has a doubly stochastic transition matrix. What is its stationary distribution, and why?Show answer
The uniform distribution . Multiplying it by a doubly stochastic matrix gives column sums divided by 3, and each column sum is 1, so the vector does not change. Equal probability across the states is preserved by every step.