RowReduce[m]
给出矩阵 m 的行约化形式.
RowReduce
RowReduce[m]
给出矩阵 m 的行约化形式.
更多信息和选项
- RowReduce 执行一个高斯消去,将行的倍数累加在一起以尽可能的生成 0 元素. 最后的矩阵为行简阶梯形式.
- 如果 m 是一个非退化方阵,则 RowReduce[m] 是 IdentityMatrix[Length[m]]. »
- 如果 m 是一个具有
行和超过
列的充分非退化矩阵,则 RowReduce[m] 的前
列将形成一个单位矩阵. » - RowReduce 同时适用于数值矩阵和符号矩阵.
- 可以有以下选项:
-
Method Automatic 使用的方法 Modulus 0 使用的整数模 Tolerance Automatic 使用的数值容差 ZeroTest Automatic 测试矩阵元素是否可视为零的函数 - RowReduce[m,Modulus->n] 求有理矩阵对整数 n 取模后的简化形式. 若 n 为零,则使用普通算术运算. 若 n 不是质数,计算可能会失败. »
- RowReduce[m,ZeroTest->test] 计算 test[m[[i,j]]] 来确定矩阵元素是否为零.
- Method 选项可能的设置包括 "CofactorExpansion"、"DivisionFreeRowReduction" 和"OneStepRowReduction". 缺省设置 Automatic 会根据所给的矩阵选择其中的方法.
范例
打开所有单元 关闭所有单元基本范例 (3)
RowReduce[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}]MatrixForm[%]RowReduce[{{1, 2, 3, 1, 0, 0}, {4, 5, 6, 0, 1, 0}, {7, 8, 9, 0, 0, 1}}]MatrixForm[%]RowReduce[{{3, 1, a}, {2, 1, b}}]范围 (13)
基本用法 (7)
RowReduce[{{1.5, 4.75, -3.2}, {-1.7, 6.7, -9.3}, {4.9, -8.65, 15.4}}]//MatrixFormMatrixForm[RowReduce[RandomComplex[3 + I, {5, 5}]]]m = N[{{π, Sqrt[2], E}, {(1/Sqrt[2]), 1 + Sqrt[2], 2 π}, {-(1/Sqrt[2]) + 2 π, -1 + Sqrt[2], 2 E - 2 π}}, 20]RowReduce[m]//MatrixFormRowReduce[{{0, 0, 0, π}, {2, 2, 2, 2}, {3 + ISqrt[2], 0, 0, 0}, {0, 4, 4, 0}}]//MatrixFormRowReduce[{{a, b, c}, {d, e, f}, {a + d, b + e, c + f}}]RowReduce 假设所有符号都是独立的:
RowReduce[{{a, b, c}, {d, e, f}, {g, h, i}}]RowReduce[(| | |
| ---- | ----- |
| 1.2 | 3.4 |
| 5.6 | 7.8 |
| 9.10 | 11.12 |)]//MatrixFormRowReduce[RandomReal[1, {4, 6}, WorkingPrecision -> 20]]//MatrixFormRowReduce[RandomComplex[1, {3, 5}]]//MatrixFormRandomReal[{0, 9}, {500, 300}];
RowReduce[%]; //AbsoluteTiming特殊矩阵 (6)
SparseArray[{{1, 2} -> 1, {3, 1} -> 5, {2, 3} -> 2}, {3, 3}]RowReduce[%]SymmetrizedArray[{{1, 2} -> 3, {2, 2} -> 5, {2, 3} -> 7, {3, 2} -> 13}, {3, 3}, Symmetric[All]]RowReduce[%]QuantityArray[{{1, 2}, {2, 4}}, {"Meters", "Seconds"}]RowReduce[%]RowReduce 不改变单位矩阵:
RowReduce[IdentityMatrix[3]]RowReduce[IdentityMatrix[{3, 4}]]RowReduce[HilbertMatrix[7]]//MatrixFormℱ = FiniteField[29, 4];
RowReduce[{{ℱ[12], ℱ[23], ℱ[34]}, {ℱ[45], ℱ[56], ℱ[67]}, {ℱ[101], ℱ[98], ℱ[240]}}]//MatrixFormrpoly[n_] := RandomInteger[{-2 ^ 10, 2 ^ 10}, {n + 1}].x ^ Range[0, n]
SeedRandom[1234];
m = Table[rpoly[100], {10}, {11}];RowReduce[m]//Short[#, 4]&//AbsoluteTiming选项 (3)
Modulus (1)
Tolerance (1)
m = {{1, 0, 1}, {1, 10^-20, 0}, {0, 0, 1}};RowReduce[m]RowReduce[N[m]]RowReduce[N[m], Tolerance -> 0]MatrixForm[RowReduce[Transpose[Append[Transpose[m], {1, 1, 1}]]]]ZeroTest (1)
m = (| | | | |
| - | -- | - | --- |
| 1 | -2 | 3 | 2 |
| 1 | 1 | 1 | k |
| 2 | -1 | 4 | k^2 |);
RowReduce[m]//MatrixForm这种情况下,RowReduce 忽略了产生奇异矩阵的特殊情况
:
RowReduce[m /. k -> 2]//MatrixFormtest[k_][e_] := Reduce[e == 0, k, ℝ] =!= False
{test[k][k^2 + 1], test[k][k^2]}将 test[k] 作为 ZeroTest 的值传递,以获得更符号式的约化:
MatrixForm[gen = RowReduce[{{1, -2, 3, 2}, {1, 1, 1, k}, {2, -1, 4, k ^ 2}}, ZeroTest -> test[k]]]这里覆盖了
的特殊情况,但给出的是
取其他值时的非约化矩阵:
{MatrixForm[gen /. k -> 2], MatrixForm[gen /. k -> 1]}应用 (13)
生成空间和线性独立 (5)
v1 = {1, 2, 3};v2 = {4, 5, 6};v3 = {7, 8, 9};
Solve[a v1 + b v2 == v3, {a, b}]RowReduce[{v1, v2, v3}]v1 = {1, 2, 3};v2 = {4, 5, 6};v3 = {7, 8, 10};
Solve[a v1 + b v2 == v3, {a, b}]RowReduce[{v1, v2, v3}]Subscript[v, 1] = {108, 90, 252, 186};
Subscript[v, 2] = {240, 260, 520, 420};
Subscript[v, 3] = {264, 340, 536, 468};
Subscript[v, 4] = {522, 705, 1038, 929};RowReduce[{Subscript[v, 1], Subscript[v, 2], Subscript[v, 3], Subscript[v, 4]}]a = (| | | | |
| - | -- | --- | -- |
| 1 | 4 | 2 | -9 |
| 4 | 12 | 2 | 5 |
| 6 | 7 | -11 | 9 |
| 5 | 15 | 10 | 12 |);RowReduce[a]Subscript[v, 1] = {8, 8, 0, -4, 6};Subscript[v, 2] = {2, -2, -11, 1, 0};Subscript[v, 3] = {-4, -8, -12, 4, -4};Subscript[v, 4] = {8, 12, 14, -6, 6};Subscript[v, 5] = {4, 4, 6, -2, 0};RowReduce[{Subscript[v, 1], Subscript[v, 2], Subscript[v, 3], Subscript[v, 4], Subscript[v, 5]}]求解方程和可逆性 (8)
system = {2x + 3y + 5z == -2, -3x + 4y - z == 7, 4x + y - 6z == 3};a = {{2, 3, 5}, {-3, 4, -1}, {4, 1, -6}};
b = {-2, 7, 3};
system == Thread[ a.{x, y, z} == b]RowReduce[a]用 Solve 验证结果:
Solve[system, {x, y, z}]m = {{1, 2, 3}, {5, 6, 7}, {7, 8, 9}};
b = {1, 1, 1};MatrixForm[a = Join[m, Transpose[{b}], 2]]MatrixForm[r = RowReduce[a]]x = r[[All, -1]]m.x == bb1 = {1, -2, 1};
a1 = Transpose[Join[Transpose[m], {b1}]];
MatrixForm[r1 = RowReduce[a1]]因为最后一列有一个 1,所以
无解;用 Solve 确认:
Solve[m.{x1, x2, x3} == b1, {x1, x2, x3}]system = {10 x + 12 y + 14 z == 1, 22 x + 27 y + 32 z == 0, 34 x + 42 y + 50 z == -1}m = {{10, 12, 14}, {22, 27, 32}, {34, 42, 50}};
b = {1, 0, -1};
v = {x, y, z};system == Thread[m.v == b]RowReduce[Join[m, Transpose[{b}], 2]]//MatrixFormx1 = %[[All, -1]]RowReduce[Join[m, IdentityMatrix[3], 2]]//MatrixFormx0 = %[[-1, -3 ;; -1]]x1 + C[1]x0m.% == b//Simplifya = (| | | | |
| --- | --- | ---- | --- |
| 108 | 90 | 252 | 186 |
| 240 | 260 | 520 | 420 |
| 264 | 340 | 536 | 468 |
| 522 | 705 | 1038 | 929 |);RowReduce[a]用 Inverse 验证结果:
Inverse[a]a = (| | | | |
| - | -- | --- | -- |
| 1 | 4 | 2 | -9 |
| 4 | 12 | 2 | 5 |
| 6 | 7 | -11 | 9 |
| 5 | 15 | 10 | 12 |);RowReduce[a]用 Det 确认结果:
Det[a]如果
没有约化为单位矩阵,则
是
的特征值. 如果矩阵的特征值的重数大于行约化形式中的零行的数量,则该矩阵是亏损矩阵. 证明
是以下矩阵
的特征值:
m = {{-8, -6, 9, 10}, {-6, -4, 0, 6}, {0, 0, -4, 0}, {-10, -6, 9, 12}};RowReduce[m - (-4) IdentityMatrix[4]]用 Eigenvalues 确认结果:
Eigenvalues[m]矩阵
是亏损矩阵,因为 2 出现了两次,但行约化形式只有一行为零:
RowReduce[m - 2 IdentityMatrix[4]]用 Eigensystem 确认结果,用零填充特征向量表明了亏损:
Eigensystem[m]m = {{a, b, c}, {d, e, f}, {g, h, i}};MatrixForm[aug = Join[m, IdentityMatrix[3], 2]]r = RowReduce[aug];r[[All, 1 ;; 3]]MatrixForm[minv = r[[All, -3 ;; -1]]]估计用 Inverse 验证结果:
Simplify[minv == Inverse[m]]Block[{n = 10000}, N[Sum[If[RowReduce[RandomInteger[1, {10, 10}]] === IdentityMatrix[10], 1, 0], {n}] / n]]属性和关系 (8)
RowReduce 将前导零作为精确整数返回,与输入的精度无关:
m = {{0, 0, 0, 1}, {2, 2, 2, 2}, {3, 0, 0, 0}, {0, 4, 4, 0}};
MatrixForm /@ {RowReduce[m], RowReduce[N[m]], RowReduce[N[m, 10]]}当且仅当 RowReduce[m] 等于 IdentityMatrix[Length[m]],方阵 m 可逆:
m = {{1, 0, 4}, {2, 0, 3}, {2, 1, 2}};RowReduce[m] == IdentityMatrix[Length[m]]Inverse[m]实际上,可以通过对 m 和单位矩阵形成的增广矩阵求逆得到逆矩阵:
RowReduce[Join[m, IdentityMatrix[Length[m]], 2]][[All, -Length[m] ;; -1]]对于方阵,当且仅当 Det[m]!=0,m 才约化为单位矩阵:
m = RandomReal[{-1, 1}, {3, 3}];RowReduce[m] == IdentityMatrix[Length[m]]Det[m] != 0m = RandomReal[{-1, 1}, {3, 3}];RowReduce[m] == IdentityMatrix[Length[m]]NullSpace[m] === {}对于方阵,当且仅当 LinearSolve[m,b] 对普通的 b 有解,m 才约化为单位矩阵:
m = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};RowReduce[m] == IdentityMatrix[Length[m]]LinearSolve[m, {Subscript[b, x], Subscript[b, y], Subscript[b, z]}]一个
矩阵
,如果
,当且仅当 RowReduce[m] 的前
列形成一个单位矩阵的情况下,其秩才为
:
a = {{3, 7, 1, 2, 7}, {4, 5, 6, 6, 6}, {0, 5, 5, 1, 4}};
m = Length[a];
r = RowReduce[a];MatrixRank[a] == mr[[All, 1 ;; Length[a]]] == IdentityMatrix[Length[a]]MatrixForm[r]MatrixRank[m] 等于 RowReduce[m] 中非零行的数量:
m = {{1, 4, 6}, {3, 7, 0}, {9, 2, 3}, {2, 1, 8}, {7, 8, 10}};MatrixRank[m]RowReduce[m]//MatrixForm可用 RowReduce 计算方阵 m 的零空间:
m = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}};MatrixForm[r = RowReduce[Join[m, IdentityMatrix[Length[m]], 2]]]如果该行在增广的一半中有前导 1,则该行增广的一半在零空间中:
{v1, v2} = r[[3 ;; 4, 5 ;; 8]]用 NullSpace 获取零向量:
{n1, n2} = NullSpace[m]RegionEqual[ParametricRegion[a v1 + b v2, {a, b}], ParametricRegion[a n1 + b n2, {a, b}]]技术笔记
历史
1988年引入 (1.0) | 在以下年份被更新:1996 (3.0) ▪ 2022 (13.2) ▪ 2024 (14.0)
文本
Wolfram Research (1988),RowReduce,Wolfram 语言函数,https://reference.wolfram.com/language/ref/RowReduce.html (更新于 2024 年).
CMS
Wolfram 语言. 1988. "RowReduce." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2024. https://reference.wolfram.com/language/ref/RowReduce.html.
APA
Wolfram 语言. (1988). RowReduce. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/RowReduce.html 年
BibTeX
@misc{reference.wolfram_2026_rowreduce, author="Wolfram Research", title="{RowReduce}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/RowReduce.html}", note=[Accessed: 30-October-2026]}
BibLaTeX
@online{reference.wolfram_2026_rowreduce, organization={Wolfram Research}, title={RowReduce}, year={2024}, url={https://reference.wolfram.com/language/ref/RowReduce.html}, note=[Accessed: 30-October-2026]}