A vector of category counts can have positive variance in every coordinate while its full covariance matrix has no inverse. The missing direction is supplied by an exact constraint: all counts add to a fixed total. Increasing one category must be balanced elsewhere. A covariance model should preserve that structure rather than treat singularity as automatic evidence of a numerical failure.
Use an invented four-record batch in which each record independently receives exactly one label A, B, or C. The label probabilities are 1/2, 1/4, and 1/4, unchanged between records. These are assumed probabilities for a teaching model, not measured classifier performance or a claim about an actual robot inspection stream. No statistical library or random sample was executed.
The count vector has a restricted support
Let N_A, N_B, and N_C count the three labels. Each is a nonnegative integer, and N_A + N_B + N_C = 4 exactly. The possible vectors occupy a triangular set of integer points in a plane, rather than an unconstrained three-dimensional space.
The multinomial probability for vector (a,b,c) is 4! divided by a! b! c!, multiplied by (1/2) to the power a and (1/4) to the powers b+c, provided a+b+c = 4. For example, (2,1,1) has probability 12 times 1/4 times 1/16 = 3/16.
SciPy's official multinomial reference defines this joint mass and its fixed-sum support. R's official documentation also gives the mass formula and identifies each separate category count as a binomial marginal. The covariance construction and numerical vector below are independently derived rather than copied from either manual's examples.
Derive covariance from one-hot records
For a single record, define indicators I_A, I_B, and I_C. Exactly one equals one. Indicator I_i has mean p_i and variance p_i(1-p_i). For different categories i and j, I_i I_j is always zero, so covariance is zero minus p_i p_j, or -p_i p_j.
Counts sum these indicators over four independent records. Cross-record covariance terms vanish under the independence assumption, leaving Var(N_i) = 4 p_i(1-p_i) and Cov(N_i,N_j) = -4 p_i p_j. This reasoning separates independence between records from mutual exclusivity of labels within one record.
The mean count vector is (2,1,1). In order A, B, C, the complete covariance matrix is [[1,-1/2,-1/2],[-1/2,3/4,-1/4],[-1/2,-1/4,3/4]]. Every diagonal entry is strictly positive. The negative off-diagonal terms are not arbitrary corrections: they encode how category counts compete under the shared total.
Find the exact null direction
Multiply that matrix by the all-ones column (1,1,1). Each row sums to zero, so the result is the zero column. The matrix is singular. The same fact follows probabilistically: N_A + N_B + N_C is the constant four, whose variance must be zero.
For the centered vector, deviations add to zero as well. There can be variation along directions within the count plane, while there is no variation in the normal direction (1,1,1). Positive coordinate variances are therefore compatible with one exact zero-variance combination.
The general covariance for n independent categorical trials is n[diag(p)-p p transpose]. For any coefficient vector z, its quadratic form is n[sum p_i z_i squared - (sum p_i z_i) squared]. This is a weighted variance of the coefficient values. When all category probabilities are positive, it vanishes exactly when those values are all equal, explaining the fixed-total null direction.
Two independent directions within the plane make the remaining variation explicit. Multiplication by the vector (0,1,-1) returns that vector, giving eigenvalue one. Multiplication by (-2,1,1) returns 1.5 times that vector. Together with the zero eigenvalue, their sum is 2.5, matching the sum of the three coordinate variances.
Retain two coordinates without assuming independence
Because N_C = 4-N_A-N_B, keeping A and B still allows recovery of C. Their two-by-two covariance is [[1,-1/2],[-1/2,3/4]], with determinant 1/2. It is positive definite and has inverse [[3/2,1],[1,2]].
This reduction removes the redundant coordinate, not the dependence between A and B. Their covariance remains -1/2. The feasible pairs also retain constraints A >= 0, B >= 0, and A+B <= 4. A nonsingular reduced covariance does not make every real pair a possible count outcome or establish a Gaussian distribution.
Conversely, attempting an ordinary inverse of the full three-by-three matrix contradicts its exact null direction. A model using such an inverse needs a declared reduced representation or another appropriate treatment of the constraint. Silently perturbing the matrix changes the mathematical covariance being represented.
Aggregation and contrasts check different signs
Merge B and C into one category M. Then M = 4-N_A, with mean two and variance one. Computing from the full covariance gives Var(M) = 3/4 + 3/4 + 2(-1/4) = 1. Ignoring the covariance would incorrectly give 1.5.
For the contrast D = N_A-N_B, variance instead is 1 + 3/4 - 2(-1/2) = 11/4, or 2.75. Negative covariance lowers the variance of this category sum but increases the variance of this difference. The operation being analyzed determines how the cross terms enter.
If counts are reported as fractions by dividing each by four, their covariance divides by sixteen. Their sum becomes the constant one, so the null direction remains. Rescaling coordinates does not remove the compositional constraint.
These results concern a fixed number of independent categorical assignments. A random total, dependent labels across records, or overlapping categories defines a different count model. Preserve the total, category rules, probability vector, coordinate representation and requested contrast together; those choices explain why a valid covariance can be singular before any numerical solver is involved.
Sources checked October 24, 2026:
SciPy: scipy.stats.multinomial: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.multinomial.html
R stats: The Multinomial Distribution: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Multinom.html
Concept illustration: A small robot beside a laptop provides context for category-count modeling. The screen does not represent the invented count data, executed statistical software, or measured classifier performance.