Advanced maths

Birkhoff von Neumann decomposition calculator for a doubly stochastic matrix

Write an exact doubly stochastic matrix as a convex combination of permutation matrices and verify the reconstruction.

Your numbers

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

Write an exact doubly stochastic matrix as a convex combination of permutation matrices and verify the reconstruction.

THE FORMULAA = sum_k alpha_k P_k, alpha_k>0, sum_k alpha_k=1

A worked example

The 2×2 matrix with every entry one half equals one half the identity permutation plus one half the swap permutation. Both coefficients are positive and sum to one.

Good to know

Exact rational nonnegative square matrices of order2–10, every row and column summing to1. Repeated supported perfect matchings and exact subtraction until the residual vanishes; return positive coefficients and permutation matrices. Cap matching/subtraction work and rational growth. One decomposition, without promising the fewest terms; no stochastic-matrix normalization or scheduling side constraints.

A convex mixture of permutations

A permutation matrix has exactly one entry equal to one in every row and column, with all other entries zero. A doubly stochastic matrix instead allows fractional nonnegative entries while retaining row and column sums one. Birkhoff–von Neumann decomposition expresses every such matrix as a convex mixture of permutation matrices.

This is a constructive matrix representation, not a normalization routine for arbitrary nonnegative data. The input already needs the doubly stochastic conditions. Scaling rows or columns until they approximately sum to one would change the requested matrix and introduce a separate balancing problem. The decomposition should reproduce the exact entered fractions rather than a silently modified version.

Birkhoff von Neumann decomposition for a doubly stochastic matrix[1/2 1/2][1/2 1/2]= 1/2 I + 1/2 SwapCoefficients sum to 1
Scroll across to see the full diagram.
The 2×2 matrix with every entry one half equals one half the identity permutation plus one half the swap permutation. Both coefficients are positive and sum to one.

Compare this with the Assignment problem calculator from cost matrix. Decompose an entered doubly stochastic matrix into a convex mixture of permutation matrices with exact reconstruction, rather than optimize one assignment from a cost matrix. Target-row/column matrix balancing changes a matrix; this page decomposes an already normalized matrix.

Checking the input exactly

Each entry is a nonnegative rational number, and every row and column must sum exactly to one. These equalities determine the domain of the theorem. A row summing to 0.999999 because of deliberately rounded source data is not automatically an exact unit-sum row under the rational interpretation used by this calculator.

If decimal measurements need normalization, perform and document that step separately. Negative entries, incompatible dimensions or unsupported fraction growth should be rejected explicitly. An error is preferable to returning a plausible list of permutations whose weighted sum fails to recover the supplied matrix, because the reconstruction identity is the central mathematical claim of the tool.

The support graph contains a perfect matching

Create a bipartite graph with one class for rows and one for columns. A positive matrix entry supplies an edge. The doubly stochastic conditions guarantee enough support to find a perfect matching: every row and column can be represented once without using a zero entry. That matching defines a supported permutation matrix.

The matching is a combinatorial step, not an optimization of the eventual number of decomposition terms. Different supported matchings can lead to different valid mixtures. This freedom should be acknowledged in the output. Comparing permutation lists entry by entry across implementations can be misleading even when both reconstruct the input matrix exactly.

Subtracting a supported permutation

For the chosen matching, take the smallest residual entry along its edges as the next coefficient. Subtract that coefficient times the permutation matrix. Nonnegativity is preserved, and every residual row and column sum decreases by the same coefficient. At least one positive support entry becomes zero, which drives finite progress in exact arithmetic.

The residual is generally a scaled doubly stochastic matrix rather than a unit-sum one. Keep its common row sum explicit and continue finding supported matchings while it is positive. A routine that insists the residual rows still sum to one after each subtraction would misunderstand the invariant. The original unit total is recovered by the sum of all extracted coefficients.

The two-by-two example

The default matrix has all four entries equal to one half. Choose the identity matching first. Its smallest supported entry is one half, so subtracting half the identity leaves one half at each off-diagonal position and zero on the diagonal. The residual support is now exactly the swap permutation.

Subtracting half the swap leaves the zero matrix. The coefficients sum to one, and their weighted permutation matrices reconstruct every original entry. Choosing the swap first produces the same two terms in the opposite order. The example is small enough to inspect directly while illustrating the support reduction and common-residual-row-sum invariants used by the general algorithm.

What to verify in the output

Check that every returned term is genuinely a permutation matrix or an equivalent one-to-one column assignment. Check that every coefficient is positive and that their exact sum is one. Finally, sum the weighted terms entry by entry and compare with the original matrix using rational equality rather than a rounded visual table.

The term count describes this decomposition only. The basic supported-matching construction does not promise the smallest possible number of permutations, which is a separate optimization question. A short-looking list is not more correct than a longer valid list. Reconstruction, positivity and normalization establish validity; term-count optimality requires additional evidence that is not claimed here.

Interpreting a mixture as a schedule

A permutation can represent a one-to-one assignment, and its coefficient can be read as a fraction of time or probability when that interpretation fits the application. The matrix then describes fractional assignment totals reconstructed by those discrete patterns. This interpretation is useful, but it depends on the application allowing those patterns to be combined freely.

The calculator does not add precedence, transition costs, indivisible time slots or other scheduling constraints. It also does not prove that a physical process can switch between patterns instantaneously. Use the exact mixture as an algebraic decomposition of the entered matrix, and introduce any additional operational restrictions before treating it as an executable schedule.

A few questions, answered

Does the input get normalized automatically?

No. It must already be an exact nonnegative doubly stochastic matrix.

Is the decomposition unique?

No. Different supported matchings can produce different valid convex mixtures.

Is the number of terms minimal?

No. The constructive matching algorithm does not promise a minimum-term mixture.

What proves the result is valid?

Positive coefficients summing to one and exact entrywise reconstruction from genuine permutation matrices.

Find your calculator

Start typing to explore the library.