## the SVD provides real-valued rank

Suppose that X has a singular value decomposition

$X = u\ w\ v^T$ ;

n nonzero singular values (nonzero elements of w);

the smallest nonzero singular value is $\epsilon > 0$ .

Then,

X is of rank n

X differs from a matrix Y of rank n-1 by $\epsilon$ ;

no matrix of rank n-1 differs from X by less than $\epsilon$

we may compute one such matrix Y as follows:

the matrix

$Y = u\ w2\ v^T$

is of rank n-1 and differs from X by $\epsilon$  , where w2 is w with $\epsilon$  replaced by 0.

If, for example, X had 5 nonzero singular values and the smallest one was .15, then we could say that the rank of X was 4.15 . and if we replace the .15 in w by 0 in w2 and compute Y, we get a matrix Y of rank 4 which differs from X by as little as possible.
i remark that i do this by changing a value in the matrix w, leaving u and v alone; hence Y is the same shape as X. There are those who would drop a row and column from w, then drop a column from each of u and v. (see below under alternative SVD.)