gives the rank decomposition of the matrix m as a pair {c,f} such that m==c.f.
RankDecomposition
gives the rank decomposition of the matrix m as a pair {c,f} such that m==c.f.
Details and Options
- RankDecomposition is also known as rank factorization or CR (column-row) decomposition.
- If the input matrix
has dimensions
and rank
, then for the pair
returned by RankDecomposition[m],
has dimensions
and
has dimensions
. As
,
has at least as many rows as columns, and
has at least as many columns as rows. » - Both
and
have maximal rank. In other words,
has
linearly independent columns and
has
linearly independent rows. » - RankDecomposition takes the following options:
-
Method Automatic method to use Modulus 0 integer modulus to use Tolerance Automatic numerical tolerance to use - RankDecomposition[m,Modulus->n] finds the reduction of rational matrices modulo the integer n. If n is zero, ordinary arithmetic is used. If n is not prime, the computation may fail. »
- Possible settings for the Method option include "CofactorExpansion", "DivisionFreeRowReduction" and "OneStepRowReduction". The default setting of Automatic switches among these methods depending on the matrix given.
- Mathematically, the rank decomposition is not unique. »
Examples
open all close allBasic Examples (3)
Compute the rank decomposition of a 2×2 matrix:
{c, f} = RankDecomposition[(| | |
| - | - |
| 1 | 3 |
| 2 | 6 |)];
{c//MatrixForm, f//MatrixForm}c.f//MatrixFormThe matrix rank of the original matrix is
, consistent with c and f having a single row/column:
MatrixRank[%]m = (| | | | |
| - | - | - | - |
| 1 | 2 | 3 | 4 |
| 2 | 7 | 3 | 9 |
| 2 | 7 | 3 | 9 |);
MatrixRank[m]Find the rank decomposition; as expected, the matrices have dimensions 3×2 and 2×4:
{c, f} = RankDecomposition[m];
{c//MatrixForm, f//MatrixForm}Verify that their product recovers m:
c.f == mRank decomposition of a matrix of rationals:
MatrixForm /@ RankDecomposition[(| | | |
| -------- | ---------- | -------- |
| (3/2) | (19/4) | -(16/5) |
| -(17/10) | (67/10) | -(93/10) |
| (49/10) | -(865/100) | (154/10) |)]Scope (12)
Basic Uses (7)
Rank decomposition of a machine-precision matrix:
MatrixForm /@ RankDecomposition[{{1.5, 4.75, -3.2}, {-1.7, 6.7, -9.3}, {4.9, -8.65, 15.4}}]Rank decomposition of a complex matrix:
MatrixForm /@ RankDecomposition[(| | | |
| ---------- | --- | ------------ |
| 0.5 + 1. I | 2.1 | 3.2 - 2. I |
| 0.0 | 4.8 | 5.5 I |
| -0.5 - I | 2.7 | -3.2 + 7.5 I |)]Rank decomposition of an arbitrary-precision matrix:
RankDecomposition[N[{{π, Sqrt[2], E}, {(1/Sqrt[2]), 1 + Sqrt[2], 2 π}, {-(1/Sqrt[2]) + 2 π, -1 + Sqrt[2], 2 E - 2 π}}, 20]]Rank decomposition of an exact matrix:
MatrixForm /@ RankDecomposition[(| | | | |
| ------------- | - | - | - |
| 0 | 0 | 0 | π |
| 2 | 2 | 2 | 2 |
| 3 + I Sqrt[2] | 0 | 0 | 0 |
| 0 | 4 | 4 | 0 |)]Find the rank decomposition of a symbolic matrix:
MatrixForm /@ RankDecomposition[{{a, b, c}, {c, b, a}, {0, 0, 0}}]The above result is generic; special values of the symbols may give different results:
Block[{a = 0, c = 0}, MatrixForm /@ RankDecomposition[{{a, b, c}, {c, b, a}, {0, 0, 0}}]]Rank decomposition of a tall rectangular matrix:
MatrixForm /@ RankDecomposition[(| | |
| ----- | ----- |
| 1.2 | 3.4 |
| 5.6 | 7.8 |
| 9.10 | 11.12 |
| 13.14 | 15.16 |)]Rank decomposition of a wide rectangular matrix:
MatrixForm /@ RankDecomposition[(| | | | | | |
| ---- | ---- | ---- | ---- | ---- | ---- |
| 0.52 | 0.03 | 0.08 | 0.75 | 0.52 | 0.24 |
| 0.97 | 0.34 | 0.13 | 0.24 | 0.44 | 0.60 |
| 0.50 | 0.68 | 0.36 | 0.31 | 0.06 | 0.05 |)]The rank decomposition of a large numerical matrix is computed efficiently:
mat = RandomReal[{2, 10}, {200, 180}];RankDecomposition[mat];//TimingSpecial Matrices (5)
Rank decomposition of a sparse matrix:
SparseArray[{{1, 2} -> 1, {3, 1} -> 5, {2, 3} -> 2, {3, 2} -> 1, {3, 3} -> 2}, {4, 4}]RankDecomposition[%]Depending on the input, the result may not have any SparseArray objects:
SparseArray[{{1, 2} -> 1.1, {3, 1} -> 5, {2, 3} -> 2.5}, {3, 3}]RankDecomposition[%]Rank decomposition of structured matrices:
SymmetrizedArray[{{1, 2} -> 3, {2, 2} -> 5, {2, 3} -> 7, {3, 2} -> 13}, {3, 3}, Symmetric[All]]RankDecomposition[%]Depending on the input, the structure may be preserved:
QuantityArray[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, {"Meters", "Seconds", "Kilograms"}]RankDecomposition[%]One or both of the matrices in the rank decomposition of an identity matrix is the input matrix:
MatrixForm /@ RankDecomposition[IdentityMatrix[3]]MatrixForm /@ RankDecomposition[IdentityMatrix[{3, 4}]]Compute the rank decomposition of a matrix with finite field elements:
ℱ = FiniteField[29, 4];
MatrixForm /@ RankDecomposition[{{ℱ[12], ℱ[23], ℱ[34]}, {ℱ[45], ℱ[56], ℱ[67]}, {ℱ[101], ℱ[98], ℱ[240]}}]Compute the rank decomposition of a 10×11 matrix of univariate polynomials of degree
:
rpoly[n_] := RandomInteger[{-2 ^ 10, 2 ^ 10}, {n + 1}].x ^ Range[0, n]
SeedRandom[1234];
m = Table[rpoly[100], {10}, {11}];RankDecomposition[m]//Short[#, 4]&//AbsoluteTimingOptions (2)
Modulus (1)
m is a 3×3 matrix of integers between 0 and 4:
m = {{1, 0, 4}, {2, 0, 3}, {2, 1, 2}};The matrix has full rank in ordinary arithmetic but not modulo 5:
{MatrixRank[m], MatrixRank[m, Modulus -> 5]}Use arithmetic modulo 5 to compute the rank decomposition as 3×2 and 2×3 matrices:
MatrixForm /@ RankDecomposition[m, Modulus -> 5]The decomposition in ordinary arithmetic is trivial:
MatrixForm /@ RankDecomposition[m]Tolerance (1)
Create a matrix with a linear dependency and noise added:
v1 = {1, 2, 1, 2};
v2 = {2, 3, -1, 1};
v3 = 2v1 - 3v2 + RandomReal[{-.01, .01}, 4];
m = {v1, v2, v3}Compute the rank decomposition:
MatrixForm /@ RankDecomposition[m]A tolerance setting commensurate with the noise reduces the rank of the decomposition factors:
MatrixForm /@ RankDecomposition[m, Tolerance -> 10 ^ (-2)]Properties & Relations (5)
The first matrix of RankDecomposition[m] is either tall or square, and the second is wide or square:
mats = {(| | | |
| - | - | - |
| 1 | 2 | 3 |
| 2 | 4 | 6 |
| 3 | 6 | 9 |), (| | | |
| - | - | - |
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 3 | 6 | 9 |), (| | | |
| - | - | -- |
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 3 | 6 | 10 |), (| | | |
| -- | -- | -- |
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 3 | 6 | 10 |
| 11 | 12 | 13 |), (| | | | |
| - | - | -- | -- |
| 1 | 4 | 3 | 11 |
| 2 | 5 | 6 | 12 |
| 3 | 6 | 10 | 13 |)};
Map[MatrixForm] /@ RankDecomposition /@ matsThe common inner dimension of the two matrices is equal to MatrixRank[m]:
MatrixRank /@ matsIn {c,f}=RankDecomposition[m], f has linearly independent rows:
{c, f} = RankDecomposition[RandomReal[1, {3, 5}]];
RowReduce[f]And c has linearly independent columns:
RowReduce[c]In {c,f}=RankDecomposition[m], RangeSpace[c] equals RangeSpace[m]:
m = {{a, b, 2, 3}, {2, 3, a, -b}, {a + 4, b + 6, 2 + 2a, 3 - 2b}};
{c, f} = RankDecomposition[m];
RangeSpace[m] == RangeSpace[c]Additionally, the range spaces of
and
are equal:
RangeSpace[m] == RangeSpace[f]//SimplifyThis is equivalent to saying that the rows of f are spanned by the nonzero rows of RowReduce[m]:
RowReduce[m]fThe rank decomposition of m can be computed from the "compact" singular value decomposition {u,σ,v}=SingularValueDecomposition[m,MatrixRank[m]] as {u,σ.ConjugateTranspose[v]}:
m = (| | | | |
| -------------- | ------------- | ------------- | ------------- |
| 0.97 + 0.42 I | 0.32 + 0.5 I | 0.56 + 0.94 I | 0.41 + 0.88 I |
| 0.26 + 0.55 I | 0.83 + 0.02 I | 0.57 + 0.27 I | 0.66 + 0.43 I |
| -0.71 + 0.13 I | 0.51 - 0.48 I | 0.01 - 0.67 I | 0.25 - 0.45 I |
| 1.49 + 1.52 I | 1.98 + 0.54 I | 1.7 + 1.48 I | 1.73 + 1.74 I |);
{u, σ, v} = FullSimplify[SingularValueDecomposition[m, MatrixRank[m]]];{c, f} = {u, σ.v};
{c, f} == RankDecomposition[m]However, since the rank decomposition is not unique, there is no guarantee this result agrees with the result of RankDecomposition[m]:
m = (| | |
| - | - |
| 1 | 2 |
| 3 | 4 |);
{u, σ, v} = FullSimplify@SingularValueDecomposition[m, MatrixRank[m]];
{c, f} = {u, σ.v};
{c2, f2} = RankDecomposition[m];
{c, f} == {c2, f2}The matrices c and f computed using SingularValueDecomposition are nonetheless a valid rank decomposition:
{m == Simplify[c.f], MatrixRank[c] == Last[Dimensions[c]], MatrixRank[f] == Length[f]}Compare the two rank decompositions:
MatrixForm /@ {c, f, c2, f2}If m is exact, each element of RankDecomposition[m][[2]] will have a 1 as its first nonzero entry:
m = (| | | |
| - | - | - |
| 1 | 2 | 1 |
| 6 | 2 | 6 |
| 7 | 0 | 5 |
| 8 | 6 | 4 |
| 7 | 9 | 3 |);
RankDecomposition[m][[2]]If m is inexact, there are no constraints on the form of the elements:
RankDecomposition[N[m]][[2]]Related Guides
History
Text
Wolfram Research (2026), RankDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/RankDecomposition.html.
CMS
Wolfram Language. 2026. "RankDecomposition." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RankDecomposition.html.
APA
Wolfram Language. (2026). RankDecomposition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RankDecomposition.html
BibTeX
@misc{reference.wolfram_2026_rankdecomposition, author="Wolfram Research", title="{RankDecomposition}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/RankDecomposition.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_rankdecomposition, organization={Wolfram Research}, title={RankDecomposition}, year={2026}, url={https://reference.wolfram.com/language/ref/RankDecomposition.html}, note=[Accessed: 12-June-2026]}