A rank that is not a property of the tensor
Worth reading first: A nearest point that is not there · A block nobody can call sparse.
The rank of a real matrix is the same number whether its entries are read as real, complex, rational or anything else containing them. That is so standard it is difficult to state as a fact rather than as a definition: rank is the dimension of the column space, and extending the field does not add columns.
For three indices it is false. The same eight real numbers have rank three over the reals and rank two over the complexes.
The classification, which is exact
The previous essay introduced the machinery and it is worth restating, because everything on this page runs on it and none of it is an iteration.
A 2 × 2 × 2 array has two 2 × 2 slices A₀ and A₁. The determinant of the pencil A₀ + λA₁ is a quadratic in λ, and its discriminant Δ = c₁² − 4c₀c₂ is Cayley’s hyperdeterminant. The sign of Δ decides the rank: positive gives two distinct real roots and a real rank of two; negative gives a conjugate pair and a real rank of three; zero gives a repeated root and, for a tensor whose unfoldings are all rank two, a real rank of three with the infimum over rank two equal to zero.
Every rank on this page is therefore a sign, computed from eight numbers by four multiplications and a subtraction. No decomposition is taken, no tolerance is chosen, and nothing converges. That is the property that makes the experiment below an experiment rather than an illustration.
The same numbers, two ranks
Take the tensor whose entries, in the order (i, j, k) with k fastest, are
1, 0, 0, 1, 0, −1, 1, 0
Its slices are A₀ = [[1, 0], [0, 1]] and A₁ = [[0, 1], [−1, 0]], so det(A₀ + λA₁) = 1 + λ², whose discriminant is −4. Δ < 0: the pencil’s roots are ±i, and the real rank is three.
Over the complexes the same pencil has two distinct roots, so the same construction that produces two real rank-one terms when Δ > 0 produces two complex rank-one terms here. They are conjugates of one another, so their sum is real — and the sum is the tensor, exactly.
The measurement is what makes that more than a citation. The complex decomposition is formed, the reconstruction is computed in complex arithmetic, and two numbers are reported: the residual against the original, and the imaginary part of the reconstruction. Both are zero to the rounding level. Two complex rank-one terms reproduce a real tensor with an imaginary part of 10⁻¹⁶, and no two real rank-one terms do.
So the sentence this tensor has rank two is incomplete in a way that has no matrix analogue. It needs a field, and the answer changes with it.
Why the matrix case does not do this
The reason is worth having explicitly, because it explains which other statements survive.
A matrix of rank r has an r-dimensional column space, and the field the entries are read over does not change how many linearly independent columns there are: a real matrix with r independent real columns has r independent complex columns, and vice versa by taking real and imaginary parts. Rank is the dimension of a subspace spanned by objects that are already in the matrix.
A tensor’s rank is not the dimension of anything inside the tensor. It is the least number of terms in a representation, and the terms are not required to lie in any space the tensor determines. Enlarging the field enlarges the supply of terms, and the supply is the whole question.
That also says which statements are safe. Anything about the unfoldings is field-independent, because unfolding ranks are matrix ranks. Anything about the multilinear rank — the triple of unfolding ranks — is safe. What is not safe is anything about the number of rank-one terms.
What it costs to check
The complex decomposition above needs complex arithmetic, which this collection does not otherwise
have: every routine in matrix.js is real, deliberately, because every argument the site makes about
rounding is easier to read in real arithmetic and none of them needed the extension.
So the construction here is written out rather than called. Two 2 × 2 complex systems are solved by elimination, with complex multiplication and division spelled out as pairs of reals, and the whole thing is thirty lines. That is worth doing rather than avoiding for the reason the site’s own libraries exist: what the essay argues about is the decomposition, and a decomposition performed by a library is a decomposition nobody has read.
The check that it is right is the same two-route habit as everywhere else. The complex factors are formed from the pencil’s eigenvector, the reconstruction is computed entry by entry from them, and the result is compared against the eight numbers it started from. It agrees to 10⁻¹⁶, and its imaginary part is 10⁻¹⁶ separately — two numbers rather than one, because a reconstruction that happened to be real and wrong would pass a residual test on the real part alone.
Two typical ranks, and one of them has a probability
The second half of the page is stranger than the first, and it is measurable to four digits.
Draw a matrix with independent standard normal entries. Its rank is the largest possible, with probability one; the set of lower-rank matrices is a measure-zero variety, and nothing else happens. All of this collection’s talk of numerical rank is about matrices near that set rather than on it.
Draw a 2 × 2 × 2 tensor with independent standard normal entries. Its rank is two with probability π/4 and three with probability 1 − π/4. Both sets have positive measure. There is no such thing as the typical rank of a real 2 × 2 × 2 tensor; there are two of them.
The hero figure is that statement, run. Twenty thousand draws, each classified exactly by the sign of Δ, with the running share plotted against the number drawn and a two-standard-error band around π/4. The measured share lands inside the band and within about one standard error of 0.785398.
That is exact-ground-truth applied to a statement about a random object, which is a combination this
collection has had only once before — the randomised field’s bounds hold with a probability and are not
equal to one. Here the probability itself is a closed form, so the experiment has a number to be wrong
about.
What a typical rank is for
The phrase is not decoration. It is what decides whether a modelling choice is well posed.
Fitting a rank-two model to 2 × 2 × 2 data is a reasonable thing to do about 78.5 per cent of the time and an ill-posed thing to do the rest of the time — not because the fit fails, but because the target’s own rank is three and the rank-two set does not contain a nearest point to it. The previous essay’s sequence is what an optimiser does in that case.
So the honest description of a rank-two CP fit to this shape of data is: with probability π/4 there is an exact answer, and with probability 1 − π/4 there is an infimum that is not attained. No amount of care in the algorithm changes which of those the data is, and the diagnostic is not the residual.
For larger shapes the same phenomenon occurs with different numbers, and the numbers are mostly not known in closed form. What is known is that real tensors generically have more than one typical rank whenever the shape is not too lopsided, and that the smallest of them is the generic rank over ℂ. So the complex answer is the single number, and the real answer is a list.
The three quantities, kept apart
This field now has three numbers all called rank and it is worth putting them side by side, because every confusion in it is a confusion between two of them.
Rank is the least number of rank-one terms whose sum is the tensor, over a stated field. It is field-dependent, it is NP-hard to compute in general, and the set of tensors with rank at most r is not closed.
Border rank is the least r such that the tensor is a limit of rank-r tensors. It is what a truncation approaches and it is what a numerical rank at a tolerance actually reports.
Multilinear rank is the triple of unfolding ranks. It is field-independent, computable by three matrix decompositions, and the set of tensors with multilinear rank at most (r₁, r₂, r₃) is closed — which is why the next two essays are about it and not about the first two.
A matrix collapses all three into one number, which is why none of these distinctions has appeared anywhere else on this site.
Where the closed form comes from
The π/4 is not a fitted constant and it is worth saying where it comes from, because a reader shown a measurement against a transcendental number is entitled to ask whether the number was chosen after the experiment.
Δ is a quartic form in the eight entries. The share of Gaussian tensors with Δ > 0 is therefore the proportion of the sphere in eight dimensions on which that form is positive, and for this particular quartic the proportion evaluates in closed form. The derivation is not this site’s to reproduce; what this site can do is what it does with every other claimed constant — compute the quantity a different way and see whether the two agree.
The different way is the experiment on the hero figure, and the agreement is to within about one
standard error at twenty thousand draws. That is the same discipline as the arithmetic field’s check
that a simulated 24-bit rounding equals the hardware’s Math.fround: a route that could have disagreed,
and did not.
A note on the arithmetic
Every measurement on this page is a sign, so the usual worry — that a rank verdict is really a verdict about a tolerance — does not apply in the usual way. It applies in a different way and the code says so.
Δ is a polynomial in the entries, so its sign is exact except where the entries make it small, and the classification here divides Δ by the fourth power of the tensor’s norm before comparing it against a tolerance. That scaling is not cosmetic: Δ has degree four, so doubling every entry multiplies it by sixteen, and a threshold on Δ itself would be a threshold that moves with the units the data is measured in — which is the failure this collection has a whole essay about.
The tolerance still matters for the Δ = 0 boundary, which has measure zero and is therefore never hit by a random draw and always hit by a constructed example. The tensors in the previous essay are exactly there, which is why they are constructed rather than sampled.
The refusal
The claim under test is the one a reader is most likely to leave with after being told that two ranks occur: that the two are somehow symmetric, or equally likely, or that the split is a detail of the particular experiment.
Four thousand draws are classified and the assertion that the share is a half within two per cent is fed the result. It fails, at 0.786 against 0.5, by ninety-five standard errors.
That the split is π/4 rather than a half is the whole content of the second half of this page. A phenomenon that happened half the time would be a symmetry; one that happens 78.5 per cent of the time is a measurement of a specific geometric fact — the relative volume of the two components of the real rank-two locus — and it is a number that an experiment can be right or wrong about.
The other two refusals in the same file guard the first half. One is fed an ordinary rank-two tensor and required to refuse the claim that it has rank three, which is what keeps the phenomenon from being a statement about every tensor. The other is fed the Δ < 0 tensor and required to refuse the claim that the largest unfolding rank is the tensor’s rank — which is the reading that most nearly works, since it gives the right answer whenever the two happen to coincide.
At other settings
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- The orthogonality that cannot be diagonal — both name eckart–young, low-rank approximation, tensor rank, unfolding
- A decomposition made only of SVDs — both name eckart–young, low-rank approximation, unfolding
- A factorisation that is unique for once — both name low-rank approximation, tensor rank, unfolding
- A tensor that cannot be decomposed — both name border rank, exact ground truth, tensor rank
- An iteration that walks out of the set — both name border rank, low-rank approximation, tensor rank
- The format that does not notice the dimension — both name exact ground truth, low-rank approximation, unfolding
Named objects
A flat tag is an object no other essay names yet.
Border rankEckart–YoungExact ground truthHyperdeterminantLow-rank approximationNumerical rankSeeded generatorTensor rankTypical rankUnfolding