When the index is a tuple

The rank that stops being typical

A random 2 × 2 × 2 tensor has rank two with probability π/4 and rank three otherwise, and the sentence has no analogue for matrices. It is the first of a family. An n × n × 2 tensor is a pencil of two slices, and it has rank n exactly when the pencil's eigenvalues are all real, n + 1 otherwise. Over draws, the share of rank n is 0.786 at n = 2, 0.500 at 3, 0.264 at 4, 0.039 at 6, 0.004 at 8 and none of 4,000 at 10 — falling like e^(−0.087n²) — because the mean number of real eigenvalues grows only like the square root of n, to Edelman, Kostlan and Shub's closed form within two per cent. Both ranks stay typical in theory; in practice the lower one disappears.

Worth reading first: A nearest point that is not there · A spectrum that comes in reciprocal pairs · An iteration that walks out of the set.

A rank that is not a property of the tensor found two sentences with no analogue for matrices. The same eight real numbers can have rank three over the reals and rank two over the complexes. And a random 2 × 2 × 2 tensor with independent normal entries has rank two with probability exactly π/4 and rank three with probability 1−π/41 - \pi/4 — two typical ranks, where a random matrix has one, its largest. The essay drew the share converging on π/4 over twenty thousand draws and explained it through Cayley’s hyperdeterminant: rank two when it is positive, three when it is negative.

The hyperdeterminant is special to 2 × 2 × 2, but the phenomenon is not. A tensor of shape n × n × 2 is a pair of n × n matrices — its two slices A and B along the third index — and its real rank is decided by the pencil they form. When A is invertible, the tensor has rank n exactly when the eigenvalues of A−1BA^{-1}B are all real and distinct, and rank n + 1 otherwise; this is JáJá’s theorem, and ten Berge’s account of typical ranks for these shapes. So n and n + 1 are both typical ranks at every n — each happens with positive probability — and the share of rank n is the probability that a random real pencil has only real eigenvalues. At n = 2, a 2 × 2 pencil has two real eigenvalues or none, and the hyperdeterminant’s sign is the discriminant that decides which.

What the earlier essay could not show is what happens to the two ranks as the slices grow. Both stay typical. The question is how typical, and it is a question with a number for an answer at every n, which this essay measures and then explains from a closed form it can check.

Rank n, counted and built

For each n from 2 to 10, the slices A and B are drawn with independent standard normal entries — twenty thousand pairs for n up to 4, ten thousand at 5 and 6, four thousand at 8 and 10 — the eigenvalues of A−1BA^{-1}B are computed with the collection’s own real Schur factorisation, and an eigenvalue counts as real when its imaginary part is below 10−910^{-9} of its size.

A count of eigenvalues is a count, not a rank. So for every draw the count says has rank n, the decomposition is built. With V the matrix of eigenvectors, A=(AV) V−1A = (AV)\,V^{-1} and B=(AV) Λ V−1B = (AV)\,\Lambda\,V^{-1}, which is n rank-one terms: the i-th column of AV, times the i-th row of V−1V^{-1}, times the vector (1,λi)(1, \lambda_i) along the third index. Rebuilding both slices from those n terms and comparing with the tensor gives a relative residual that is worst at 8.9⋅10−128.9 \cdot 10^{-12} over all 32,037 rank-n draws.

The largest relative residual among the rank-n decompositions built from each pencil's real eigenvectorsFor every draw counted as rank n, the tensor rebuilt from n rank-one terms — the columns of A V, the rows of V's inverse, and one and the eigenvalue on the third index — against the tensor, worst over draws: 2.39e-12 over 15713 decompositions at n = 2; 8.89e-12 over 10006 decompositions at n = 3; 3.03e-12 over 5271 decompositions at n = 4; 2.08e-12 over 1031 decompositions at n = 5; 1.36e-12 over 385 decompositions at n = 6; 2.18e-13 over 16 decompositions at n = 8.234567810⁻¹⁷10⁻¹⁵10⁻¹³10⁻¹¹10⁻⁹nworst relative residualeach rank-n count is a decomposition foundthe count is a construction, not a test
Fig. 1 The worst relative residual among the rank-n decompositions built from each pencil’s eigenvectors, against n.

Every rank-n count below is therefore a decomposition found, not a test passed. The other direction — that a pencil with a complex pair has no real decomposition with n terms — is the theorem’s, and is not rebuilt here; what can be checked is that the n + 1 case needs the extra term, which a nearest point that is not there showed in its sharpest form, a tensor approached by lower-rank ones that never reach it.

The share of rank n

How often a random n × n × 2 tensor has its lower typical rank, n, against nFor each n, the share of draws of a real n × n × 2 tensor with independent standard normal entries whose slice pencil has only real eigenvalues — which is when the tensor has rank n rather than n + 1 — on a logarithmic axis. n = 2: 15713 of 20000, 0.7856; n = 3: 10006 of 20000, 0.5003; n = 4: 5271 of 20000, 0.2636; n = 5: 1031 of 10000, 0.1031; n = 6: 385 of 10000, 0.0385; n = 8: 16 of 4000, 0.0040; n = 10: 0 of 4000, 0.0000. The curve is e to the minus 0.087 n squared, fitted through the sizes with any rank-n draws.share of rank nn = 2 (π/4 = 0.785)0.79n = 30.5n = 80.004234567891010⁻⁴10⁻³10⁻²10⁻¹1n, the size of each sliceshare with rank n0 of 4000dashed: e to the minus 0.087 n squaredthe lower rank stops being typical in practice
Fig. 2 The share of draws of a random n × n × 2 tensor whose slice pencil has only real eigenvalues — the share of rank n rather than n + 1 — against n, on a logarithmic axis, with a fit through the sizes that had any.

At n = 2 the share is 0.7856, against π/4 = 0.7854, the earlier essay’s number reached by a different route. At n = 3 it is 0.5003 — a half, to within the draws’ standard error of 0.0035. After that it falls steeply: 0.2636 at n = 4, 0.1031 at 5, 0.0385 at 6, 16 draws in 4,000 at 8, and at n = 10 none in 4,000. The logarithm of the share falls faster than linearly in n, and through the sizes with any rank-n draws it fits e−0.087n2e^{-0.087 n^2} — a Gaussian in n, the same shape as Edelman’s result that a random real n × n matrix has all its eigenvalues real with probability 2−n(n−1)/42^{-n(n-1)/4}, with about half that exponent.

So “two typical ranks” is true at every n and means very different things. At n = 2 it means a coin weighted three to one. At n = 6 it means that the lower rank turns up once in twenty-six draws. At n = 10 it means an event with positive probability that four thousand draws did not produce. A statement that a shape of tensor has typical ranks {n, n + 1} is exact and, above n of about six, a statement about rank n + 1 in all but name.

A ratio of two keeps its eigenvalues real more often than one

Edelman’s result for a single matrix is a useful yardstick, because it has a closed form and the pencil’s share, as far as this essay knows, does not. A single n × n matrix with independent standard normal entries has only real eigenvalues with probability exactly 2−n(n−1)/42^{-n(n-1)/4}: 0.7071 at n = 2, 0.3536 at 3, 0.125 at 4, 0.0313 at 5, 0.0055 at 6.

How often all eigenvalues are real, for a Gaussian pencil and for a single Gaussian matrixThe share of draws with only real eigenvalues, on a logarithmic axis: for the pencil of two n × n Gaussian matrices, 0.7856, 0.5003, 0.2636, 0.1031, 0.0385; for one n × n Gaussian matrix, 0.7072, 0.3537, 0.1220, 0.0311, 0.0054, against Edelman's closed form two to the minus n(n − 1)/4, 0.7071, 0.3536, 0.1250, 0.0313, 0.0055, at n = 2, 3, 4, 5, 6.all realn = 6, pencil ÷ matrix7.12345610⁻²10⁻¹1nshare with all eigenvalues realpencilone matrixdashed: Edelman's closed form for one matrixa ratio of two keeps them real more often
Fig. 3 The share of draws with only real eigenvalues for a pencil of two Gaussian matrices and for one Gaussian matrix, with Edelman’s closed form for the single matrix dashed.

Measured with the same eigenvalue routine and the same threshold, single matrices land on that formula to within the draws’ error at every size — 0.7072, 0.3537, 0.1220, 0.0311, 0.0054 — which checks the counting as well as the formula. The pencils land well above it: 0.786, 0.500, 0.264, 0.103 and 0.0385. At n = 6 a pencil keeps its eigenvalues real seven times as often as a single matrix does. A ratio A−1BA^{-1}B of two Gaussian matrices is not a Gaussian matrix, and whatever makes its eigenvalues cling to the real line more than one matrix’s do is the same thing that halves the exponent of the Gaussian-in-n fall. For the tensor, that difference is the difference between the lower rank being rare and being very rare.

Why the real eigenvalues run out

How many real eigenvalues the slice pencil of a random 6 × 6 × 2 tensor hasOver 10000 draws, the share whose pencil has k real eigenvalues, for k from 0 to 6: 0: 0.0411, 1: 0.0000, 2: 0.4914, 3: 0.0000, 4: 0.4290, 5: 0.0000, 6: 0.0385. The count has the parity of n, since complex eigenvalues of a real pencil come in pairs. The tensor has rank 6 only in the last bar and rank 7 in every other.n = 6, 10000 drawsall 6 real0.038mean real2.901234567891000.20.40.60.81real eigenvalues of the pencilshare of drawsonly the last bar has rank nthe rest have rank n plus one
Fig. 4 How many real eigenvalues the slice pencil of a random tensor has, over the draws at one size; the tensor has rank n only in the last bar. The dial sets n.

The distribution of the number of real eigenvalues says why. At n = 6 the pencil has no real eigenvalues on 4.1 per cent of draws, two on 49.1, four on 42.9 and six — the rank-6 case — on 3.9. The count always has the parity of n, because complex eigenvalues of a real pencil come in conjugate pairs. Turn the dial: at n = 2 the last bar is the tallest, at n = 3 it is half, and from n = 4 the bulk of the distribution sits well below n and the last bar shrinks towards nothing.

The mean number of real eigenvalues of a random n × n pencil, measured and in closed form, beside the n a rank-n tensor needsMeasured means: 1.571 at n = 2, 2.001 at n = 3, 2.364 at n = 4, 2.638 at n = 5, 2.930 at n = 6, 3.428 at n = 8, 3.828 at n = 10. Edelman, Kostlan and Shub's closed form, the square root of π times Γ((n + 1)/2) over Γ(n/2): 1.571, 2.000, 2.356, 2.667, 2.945, 3.436, 3.866. The dashed diagonal is n, the number a rank-n tensor needs.real eigenvalues, meann = 10, measured3.8n = 10, closed form3.923456789100246810nreal eigenvaluesnclosed formdashed: the n a rank-n tensor needsthe square root of n against n
Fig. 5 The mean number of real eigenvalues of a random n × n pencil, measured and from Edelman, Kostlan and Shub’s closed form, beside the diagonal n that a rank-n tensor needs.

The centre of that distribution has a closed form. Edelman, Kostlan and Shub showed that the expected number of real eigenvalues of a pencil of two independent Gaussian n × n matrices is

E[#real]=π Γ ⁣(n+12)Γ ⁣(n2),\mathbb{E}[\#\text{real}] = \sqrt{\pi}\,\frac{\Gamma\!\left(\frac{n+1}{2}\right)}{\Gamma\!\left(\frac{n}{2}\right)},

which grows like πn/2\sqrt{\pi n/2}. The measured means are 1.571, 2.001, 2.364, 2.638, 2.930, 3.428 and 3.828 at n = 2 to 10, against the formula’s 1.571, 2.000, 2.356, 2.667, 2.945, 3.436 and 3.866 — within two per cent at every size, and exact at n = 2, where π/2 is twice π/4 because the count is two or zero. The rank-n event needs all n eigenvalues real, and the typical pencil has about the square root of n of them. The distance between n and πn/2\sqrt{\pi n/2} is what makes the event rare, and it grows with n.

Rarer, and less sound when found

The decompositions that do exist change with n as well. Each is built from the eigenvector matrix V of the pencil, and its n rank-one terms cancel against one another by as much as V is far from orthogonal: the condition number of V is the factor by which an error in the tensor can reappear, amplified, in the terms. A tensor that cannot be decomposed measured that amplification directly on a sequence whose terms are known in closed form, where a fit started at the answer lost digits at the rate the conditioning predicts.

How well conditioned the rank-n decompositions are, where they exist, against nFor the draws whose pencil has only real eigenvalues, the condition number of the eigenvector matrix V from which the n rank-one terms are built — the factor by which the terms' cancellation can amplify an error — as the median, the ninetieth percentile and the largest, on a logarithmic axis. n = 2: 1.7, 4.3, 980; n = 3: 3.2, 8.9, 321; n = 4: 5.1, 14.4, 414; n = 5: 7.3, 23.0, 198; n = 6: 10.0, 29.9, 269; n = 8: 22.2, 108.3, 258.condition of the termsmedian, n = 21.7median, n = 8222345678110¹10²10³ncondition number of Vlargestninetieth percentilemedianonly the draws that have rank nrarer, and less well conditioned when found
Fig. 6 For the draws that have rank n, the condition number of the eigenvector matrix the decomposition is built from — median, ninetieth percentile and largest — against n.

On the rank-n draws the median condition number of V is 1.7 at n = 2, 3.2 at 3, 5.1 at 4, 7.3 at 5, 10.0 at 6 and 22 at 8; the ninetieth percentile runs from 4.3 to 108. The largest, 980, is at n = 2, on a draw whose two real eigenvalues nearly coincide — the boundary between the two ranks, where an eigenvector matrix becomes singular. So as n grows the rank-n case becomes both rarer and, when it occurs, a decomposition whose terms carry more cancellation. Neither trend is large at these sizes. Both point the same way: the lower typical rank is a thinner and thinner slice of the space, and a slice near its own edge.

What the family says about the 2 × 2 × 2 case

The earlier essay’s π/4 now reads as the first term of a sequence rather than a curiosity of the smallest case. It is large because at n = 2 the expected count of real eigenvalues, π/2, is already most of the way to 2. At n = 3 the expected count is exactly 2 and the share of all-real pencils is a half; at every larger n the expected count falls further behind n.

It also says something about the claim, true in a rank that is not a property of the tensor, that the rank depends on the field. Over the complex numbers every one of these pencils has n eigenvalues, all of them distinct with probability one, and every n × n × 2 tensor has complex rank n. The gap between the real and the complex rank is exactly the complex pairs — one extra real term for the pencil as a whole, however many pairs there are, since the real rank is n + 1 whenever it is not n. So over the reals the typical rank is n + 1 in practice and the complex rank is n always, and the field-dependence the earlier essay found in one tensor is, for this family, the ordinary case. The orthogonality that cannot be diagonal found the other half of what a tensor gives up against a matrix: no decomposition has both orthogonal factors and a diagonal core. Here the loss is in the count itself, and it is decided by the field the numbers live in.

What “typical” was ever claiming

A rank is typical for a shape when the tensors having it fill a set of positive volume — an open region of the space, which a random draw from any continuous distribution lands in with positive probability. For n × n matrices only one rank is typical, n, because the singular matrices are a surface of zero volume. For n × n × 2 real tensors two are, n and n + 1, because the pencils with all-real eigenvalues and the pencils with a complex pair are each an open region, separated by the surface where two eigenvalues collide. The definition is about which regions exist, and it is silent on how large they are.

What the measurement adds is the size of the smaller region under the most natural distribution there is, and the size falls like a Gaussian in n. That makes “typical” a word to read with its measure attached. A statement in a paper that a shape has typical ranks {5, 6} is exact; a practitioner who draws random 5 × 5 × 2 tensors to test a rank-5 method will find one in ten usable, and at 8 × 8 × 2 one in 250. The same gap between existence and frequency runs through tensor rank generally: a nearest point that is not there is about a set that exists and whose infimum is not attained, and one term too many about a fit whose spare term has a place to go and does not go there.

What an algorithm meets

A computation that fits a CP decomposition of rank n to an n × n × 2 tensor — alternating least squares or any other — meets this directly; a decomposition made only of SVDs is the collection’s way round the question, a Tucker format whose existence does not depend on the rank. On the rank-n draws an exact fit exists and the eigenvector construction above finds it in one eigenvalue problem. On the others, the best rank-n approximation may not exist at all: rank n + 1 tensors with a complex pair are approached by rank-n ones whose terms grow without bound, the phenomenon a nearest point that is not there measured for 2 × 2 × 2. At n = 6 that is the situation on 96 draws in a hundred, and at n = 10 essentially always. A method that asks for rank n on this shape is asking for the rare case, and an iteration that walks out of the set is what an alternating fit does on the common one: its terms grow without bound while its residual falls towards a value no rank-n tensor attains.

The practical rule is the eigenvalue count. It is the same kind of rule the rank a sweep can vouch for looked for in an alternating fit — a number the computation can produce that says which case it is in — with the difference that here the number is exact and cheap. Computing the pencil’s eigenvalues costs one n × n eigenvalue problem; if they are all real the decomposition is in hand, and if any pair is complex the tensor needs n + 1 terms, and a rank-n fit should be expected to diverge rather than to converge.

Only the n × n × 2 shape, only normal entries

Only the n × n × 2 shape, with independent standard normal entries. Other distributions change the probabilities — a pencil whose slices are nearly simultaneously diagonalisable has all-real eigenvalues far more often — and other shapes have other typical ranks, most of them not known in closed form. The sweep stops at n = 10 with four thousand draws, so the share there is known only to be below about 10−310^{-3}; the Gaussian-in-n fit is a fit through five points, not a derivation, and the exponent 0.087 is stated to that precision and no further.

The complex rank n of the other draws is the theorem’s and is not rebuilt: building those decompositions needs complex eigenvectors and complex terms, and a residual of the same kind would check them, which this sweep did not do. An eigenvalue with imaginary part below 10−910^{-9} of its size is counted as real. A pencil with a nearly real complex pair, or a nearly repeated real pair, sits on the boundary between the two ranks, and the count there depends on that threshold; the boundary has measure zero, and the built decompositions’ residuals — none above 10−1110^{-11} — say that no draw counted as rank n was a boundary case in disguise.

Still open: the exact shares, and the shapes beyond

The shares in closed form. The measured shares are π/4 at n = 2 and a half at n = 3, both to within the draws’ error, and the exponent of the Gaussian-in-n fall is about 0.087. Whether the probability that a Gaussian pencil has only real eigenvalues has a closed form of Edelman’s kind — and whether its exponent is exactly half of log⁡2/4\log 2/4 — is a question with a sign: the fit says it is close to half, and a closed form would say whether it is exactly.

The n × n × 3 shape. Three slices give a tensor whose typical real ranks are larger than n and not decided by one pencil. Whether the lower of them also becomes rare as n grows, and at what rate, would say whether the disappearance measured here is a property of pencils or of real tensors generally.

What a rank-n fit does on the common case. On a draw whose pencil has a complex pair, an alternating least-squares fit of rank n cannot converge to an exact decomposition and may not converge at all. How its residual and the size of its terms behave over iterations — whether it looks like the swamps alternating least squares is known for or like a divergence — is measurable on the same draws, and it is the version of this result an algorithm meets.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Border-rankCP decompositionEigenvaluesGeneralised eigenvalue problemMatrix pencilProbabilistic boundsTensor rank