什么是矩阵

形如 (132456)\left(\begin{array}{ll}{1} & {3} \\ {2} & {4} \\ {5} & {6}\end{array}\right)

矩阵加减

例如,已知 A=(132456)A=\left(\begin{array}{ll}{1} & {3} \\ {2} & {4} \\ {5} & {6}\end{array}\right)B=(789101112)B=\left(\begin{array}{cc}{7} & {8} \\ {9} & {10} \\ {11} & {12}\end{array}\right), 试求 2A+3B2 \mathrm{A}+3 \mathrm{B}
2A 等于:

2A=(1×23×22×24×25×26×2)=(26481012)2 \mathrm{A}=\left(\begin{array}{ll}{1 \times 2} & {3 \times 2} \\ {2 \times 2} & {4 \times 2} \\ {5 \times 2} & {6 \times 2}\end{array}\right)=\left(\begin{array}{cc}{2} & {6} \\ {4} & {8} \\ {10} & {12}\end{array}\right)

3B 等于

3B=(7×38×39×310×311×312×3)=(212427303336)3 B=\left(\begin{array}{cc}{7 \times 3} & {8 \times 3} \\ {9 \times 3} & {10 \times 3} \\ {11 \times 3} & {12 \times 3}\end{array}\right)=\left(\begin{array}{cc}{21} & {24} \\ {27} & {30} \\ {33} & {36}\end{array}\right)

那么 2A+3B 等于:

2A+3B=(2+216+244+278+3010+3312+36)=(233031384348)2 A+3 B=\left(\begin{array}{ll}{2+21} & {6+24} \\ {4+27} & {8+30} \\ {10+33} & {12+36}\end{array}\right)=\left(\begin{array}{cc}{23} & {30} \\ {31} & {38} \\ {43} & {48}\end{array}\right)

矩阵相乘

方法:前行乘后列
例如,已知 A=(132456)A=\left(\begin{array}{ll}{1} & {3} \\ {2} & {4} \\ {5} & {6}\end{array}\right)B=(789101112)B=\left(\begin{array}{ccc}{7} & {8} & {9} \\ {10} & {11} & {12}\end{array}\right),试求 A×BA \times B

用前面矩阵的行,乘于后面矩阵的列

A×B=(132456)×(789101112)A \times B=\left(\begin{array}{ll}{1} & {3} \\ {2} & {4} \\ {5} & {6}\end{array}\right) \times\left(\begin{array}{ccc}{7} & {8} & {9} \\ {10} & {11} & {12}\end{array}\right)

=(1×7+3×101×8+3×111×9+3×122×7+4×102×8+4×112×9+4×125×7+6×105×8+6×115×9+6×12)=\left(\begin{array}{lll}{1 \times 7+3 \times 10} & {1 \times 8+3 \times 11} & {1 \times 9+3 \times 12} \\ {2 \times 7+4 \times 10} & {2 \times 8+4 \times 11} & {2 \times 9+4 \times 12} \\ {5 \times 7+6 \times 10} & {5 \times 8+6 \times 11} & {5 \times 9+6 \times 12}\end{array}\right)

=(37414554606695106117)=\left(\begin{array}{ccc}{37} & {41} & {45} \\ {54} & {60} & {66} \\ {95} & {106} & {117}\end{array}\right)

复杂一点的计算:
已知 A=(101020101)A=\left(\begin{array}{lll}{1} & {0} & {1} \\ {0} & {2} & {0} \\ {1} & {0} & {1}\end{array}\right)B=(123456789)B=\left(\begin{array}{lll}{1} & {2} & {3} \\ {4} & {5} & {6} \\ {7} & {8} & {9}\end{array}\right),试求 A2B2ABA^{2} B-2 A B

可以先减少乘的次数:

A2B2AB=(A22A)BA^{2} B-2 A B=\left(A^{2}-2 A\right) \cdot B

然后正常求解。

矩阵特殊情况

虽然从头乘到尾暴力求解也能算出答案,但是下面的这些记住,会很有用:

  1. 零矩阵 (000000000)=0\left(\begin{array}{lll}{0} & {0} & {0} \\ {0} & {0} & {0} \\ {0} & {0} & {0}\end{array}\right)=0,乘于任何数都是 0

A0=00A=0A \cdot 0=0 \quad 0 \cdot A=0

  1. E 矩阵
    下面的矩阵,我们称为 E:
    (100010001)=E(1000010000100001)=E\left(\begin{array}{lll}{1} & {0} & {0} \\ {0} & {1} & {0} \\ {0} & {0} & {1}\end{array}\right)=E \quad\left(\begin{array}{llll}{1} & {0} & {0} & {0} \\ {0} & {1} & {0} & {0} \\ {0} & {0} & {1} & {0} \\ {0} & {0} & {0} & {1}\end{array}\right)=E
    E的行列数,取决于和它配合的矩阵的行列数。例如当 E 加上一个矩阵时,E 的行列数等于加上矩阵的行列数:
    E+(123456789)E+\left(\begin{array}{lll}{1} & {2} & {3} \\ {4} & {5} & {6} \\ {7} & {8} & {9}\end{array}\right)
    此时 E 就是三行三列:(100010001)\left(\begin{array}{lll}{1} & {0} & {0} \\ {0} & {1} & {0} \\ {0} & {0} & {1}\end{array}\right)
    任何矩阵乘于 E 等于矩阵本身,E 乘于任何矩阵也等于矩阵本身:

AE=AEA=AA \cdot E=A \quad E \cdot A=A

E2=EE=E\mathrm{E}^{2}=\mathrm{E} \cdot \mathrm{E}=\mathrm{E}

  1. 矩阵相乘时,ABABBABA 未必相等
    所以,正确的:A2B2AB=(A22A)BA^{2} B-2 A B=\left(A^{2}-2 A\right) \cdot B,错误的:A2B2AB=B(A22A)A^{2} B-2 A B=B\left(A^{2}-2 A\right)

  2. AX=AYAX = AY 不能推出 X=YX = Y
    矩阵是没有除法的

  3. (AB)k(\mathrm{AB})^{\mathrm{k}}AkBkA^{k} B^{k} 不一定相等

  4. A2+(k+j)AB+kjB2A^{2}+(k+j) A B+k j B^{2}(A+kB)(A+jB)(A+k B)(A+j B) 不一定相等
    例如,下面式子是错误的:A2+2AB+B2=(A+B)2A^{2}+2 A B+B^{2}=(A+B)^{2},它俩不一定相等。
    但是,如果是 E,那么等式是成立的,比如:

A2+2AE+E2=(A+E)2A^{2}+2 A E+E^{2}=(A+E)^{2}

A2+2A+E=A2+2AE+E2=(A+E)2A^{2}+2 A+E=A^{2}+2 A E+E^{2}=(A+E)^{2}

矩阵取行列式

已知 A=(123234457)A=\left(\begin{array}{lll}{1} & {2} & {3} \\ {2} & {3} & {4} \\ {4} & {5} & {7}\end{array}\right),试求 A|\mathrm{A}|

把矩阵 A 转化为行列式,求行列式的值,即为矩阵的绝对值:

A=123234457=1|A|=\left|\begin{array}{lll}{1} & {2} & {3} \\ {2} & {3} & {4} \\ {4} & {5} & {7}\end{array}\right|=-1

公式:λA=λnA|\lambda A|=\lambda^{n}|A|

例如,下面这题,已知 A=(24646881014)A=\left(\begin{array}{ccc}{2} & {4} & {6} \\ {4} & {6} & {8} \\ {8} & {10} & {14}\end{array}\right),试求 A|\mathrm{A}|

所有都为 2 的倍数,提取一个 2 出来:

A=2(123234457)A=2\left(\begin{array}{lll}{1} & {2} & {3} \\ {2} & {3} & {4} \\ {4} & {5} & {7}\end{array}\right)

根据 λA=λnA|\lambda A|=\lambda^{n}|A|, 得到:

A=23123234457=8×(1)=8\begin{aligned}|A| &=2^{3}\left|\begin{array}{ccc}{1} & {2} & {3} \\ {2} & {3} & {4} \\ {4} & {5} & {7}\end{array}\right| \\ &=8 \times(-1) \\ &=-8 \end{aligned}

转置矩阵

先理解 ATA^{T},意思是,把行变成列,列变成行:

A=(101)AT=(101)A=\left(\begin{array}{lll}{1} & {0} & {1}\end{array}\right) \Longrightarrow A^{T}=\left(\begin{array}{l}{1} \\ {0} \\ {1}\end{array}\right)

例题,已知A=(101)A=\left(\begin{array}{lll}{1} & {0} & {1}\end{array}\right),求 ATAATA^{T} A A^{T}

ATAAT=(101)(101)(101)=(101000101)(101)=(202)\begin{aligned} A^{T} A A^{T} &=\left(\begin{array}{l}{1} \\ {0} \\ {1}\end{array}\right) \cdot\left(\begin{array}{lll}{1} & {0} & {1}\end{array}\right) \cdot\left(\begin{array}{l}{1} \\ {0} \\ {1}\end{array}\right) \\ &=\left(\begin{array}{lll}{1} & {0} & {1} \\ {0} & {0} & {0} \\ {1} & {0} & {1}\end{array}\right) \cdot\left(\begin{array}{l}{1} \\ {0} \\ {1}\end{array}\right)=\left(\begin{array}{l}{2} \\ {0} \\ {2}\end{array}\right) \end{aligned}

技巧,先用行乘列可以简化过程。

逆矩阵

证明矩阵可逆

矩阵 A 有可逆矩阵的条件:

  • 矩阵 A 为方阵(行数与列数相等)
  • A0|A| \neq 0) 或者 (存在一个方阵 B 满足 AB = E 或 BA = E)

例题,设A=(123045006)A=\left(\begin{array}{lll}{1} & {2} & {3} \\ {0} & {4} & {5} \\ {0} & {0} & {6}\end{array}\right),试判断 A 是否可逆。

直接取矩阵的行列式:

A=123045006=240|A|=\left|\begin{array}{lll}{1} & {2} & {3} \\ {0} & {4} & {5} \\ {0} & {0} & {6}\end{array}\right|=24 \neq 0

A 为方阵,且行列式不为 0,所以 A 可逆。

又例如,设方阵 A 满足 A2A2E=0A^{2}-A-2 E=0,证明 A 可逆。
根据以下步骤:

A2A2E=0A2A=2EA2AE=2EA(AE)=2EA[12(AE)]=E\begin{array}{l}{A^{2}-A-2 E=0} \\ {A^{2}-A=2 E} \\ {A^{2}-A E=2 E} \\ {A(A-E)=2 E} \\ {A\left[\frac{1}{2}(A-E)\right]=E}\end{array}

如果设 B=12(AE)B=\frac{1}{2}(A-E),则 AB=EA \cdot B=E,所以 A 可逆。

求逆矩阵

(AE)(EA1)\left(A \vdots E\right) \Longrightarrow \left(E \vdots A^{-1}\right)

  • 换行
  • 某行乘上一个数字
  • 一行加上或减去另一行乘数字

通过以上方法,求 A1A^{-1}

例如,已知 A=(123234457)A=\left(\begin{array}{lll}{1} & {2} & {3} \\ {2} & {3} & {4} \\ {4} & {5} & {7}\end{array}\right),求 A1A^{-1}

我们要做的是,是将:

(123100234010457001)\left(\begin{array}{lll|lll}{1} & {2} & {3} & {1} & {0} & {0} \\ {2} & {3} & {4} & {0} & {1} & {0} \\ {4} & {5} & {7} & {0} & {0} & {1}\end{array}\right)

通过矩阵计算,变成:

(100111010252001231)\left(\begin{array}{lll|ccc}{1} & {0} & {0} & {-1} & {-1} & {1} \\ {0} & {1} & {0} & {-2} & {5} & {-2} \\ {0} & {0} & {1} & {2} & {-3} & {1}\end{array}\right)

将左边的矩阵一步步换算成 E,同时相同的操作也在右边的 E 矩阵上进行,最后右边的矩阵变成一个新的矩阵,就是我们要求的 A1A^{-1}。在这里,A1A^{-1} 就是:

A1=(111252231)A^{-1}=\left(\begin{array}{ccc}{-1} & {-1} & {1} \\ {-2} & {5} & {-2} \\ {2} & {-3} & {1}\end{array}\right)

利用 AA1=EA \cdot A^{-1}=EA1A=EA^{-1} \cdot A=E 计算

已知 A=(123234457)A=\left(\begin{array}{lll}{1} & {2} & {3} \\ {2} & {3} & {4} \\ {4} & {5} & {7}\end{array}\right)B=(1221)B=\left(\begin{array}{ll}{1} & {2} \\ {2} & {1}\end{array}\right)C=(142536)C=\left(\begin{array}{ll}{1} & {4} \\ {2} & {5} \\ {3} & {6}\end{array}\right),求矩阵 X 使其满足 AXB=CA X B=C

AXB=CA X B=C 转换,可以得到:

AXB=CA1AXB=A1CEXB=A1CXB=A1CXB=A1CXBB1=A1CB1XB=A1CB1X=A1CB1=(111252231)(142536)(13232313)\begin{array}{l}{\qquad A X B=C} \\ {A^{-1} A X B=A^{-1} C} \\ {\begin{aligned} E X B &=A^{-1} C \\ X B &=A^{-1} C \\ X B &=A^{-1} C \\ X B B^{-1} &=A^{-1} C B^{-1} \\ X B &=A^{-1} C B^{-1} \end{aligned}} \\ {X=A^{-1} C B^{-1}=\left(\begin{array}{ccc}{-1} & {-1} & {1} \\ {-2} & {5} & {-2} \\ {2} & {-3} & {1}\end{array}\right)\left(\begin{array}{ll}{1} & {4} \\ {2} & {5} \\ {3} & {6}\end{array}\right)\left(\begin{array}{cc}{-\frac{1}{3}} & {\frac{2}{3}} \\ {\frac{2}{3}} & {-\frac{1}{3}}\end{array}\right)}\end{array}

伴随矩阵

利用 AA=AEA^{*} \cdot A=|A| EAA=AEA \cdot A^{*}=|A| E 计算

例,已知 A=(123234457)A=\left(\begin{array}{lll}{1} & {2} & {3} \\ {2} & {3} & {4} \\ {4} & {5} & {7}\end{array}\right),且 AX=A1+XA^{*} X=A^{-1}+X,求矩阵 X

根据以下步骤:

AX=A1+XAAX=A(A1+X)AEX=A(A1+X)AEX=AA1+AXAEX=E+AXAEX=E+AXAEX=E(AEA)X=E(AEA)1(AEA)X=(AEA)1EEX=(AEA)1EX=(AEA)1\begin{aligned} A^{*} X &=A^{-1}+X \\ A A^{*} X &=A\left(A^{-1}+X\right) \\|A| E X &=A\left(A^{-1}+X\right) \\|A| E X &=A A^{-1}+A X \\|A| E X &=E+A X \\|A| E X &=E+A X \\|A| E X &=E \\(|A| E-A) X &=E \\(|A| E-A)^{-1} \cdot(|A| E-A) X &=(|A| E-A)^{-1} \cdot E \\ E X &=(|A| E-A)^{-1} \cdot E^{\prime} \\ X &=(|A| E-A)^{-1} \end{aligned}

然后直接求解。

矩阵的秩

求矩阵的秩

对矩阵进行变换,使下行左端的 0 比上行多,直到下面行为 0 为止,秩为有非0数的行数。

例如,已知A=(1234246845671269)A=\left(\begin{array}{llll}{1} & {2} & {3} & {4} \\ {2} & {4} & {6} & {8} \\ {4} & {5} & {6} & {7} \\ {1} & {2} & {6} & {9}\end{array}\right),求 R(A)R(A)
将 A 行变换后可得:

(1234036900350000)\left(\begin{array}{cccc}{1} & {2} & {3} & {4} \\ {0} & {-3} & {-6} & {-9} \\ {0} & {0} & {3} & {5} \\ {0} & {0} & {0} & {0}\end{array}\right)

则,R(A)=3R(A) = 3

已知矩阵的秩,求矩阵里的未知数

例题,已知B=(12342μ68369λ)B=\left(\begin{array}{llll}{1} & {2} & {3} & {4} \\ {2} & {\mu} & {6} & {8} \\ {3} & {6} & {9} & {\lambda}\end{array}\right),且R(B)=1R(B)=1,求 λ,μ\lambda, \mu 的值。
经过行变换,我们得到:

(12340μ400000λ12)\left(\begin{array}{cccc}{1} & {2} & {3} & {4} \\ {0} & {\mu-4} & {0} & {0} \\ {0} & {0} & {0} & {\lambda-12}\end{array}\right)

而且R(B)=1R(B)=1,则

R(B)=1{μ4=0λ12=0{μ=4λ=12R(B)=1 \longrightarrow\left\{\begin{array}{c}{\mu-4=0} \\ {\lambda-12=0}\end{array} \rightarrow\left\{\begin{array}{l}{\mu=4} \\ {\lambda=12}\end{array}\right.\right.

总结

公式表

矩阵算法相关公式、法则
AB 和 BA 未必相等
X=AY 不能推出 X = Y
A2+(k+j)AB+kjB2A^{2}+(k+j) A B+k j B^{2}(A+kB)(A+jB)(A+k B)(A+j B) 不一定相等,但 A2+(k+j)A+kjE=A2+(k+j)AE+kjE2=(A+kE)(A+jE)A^{2}+(k+j) A+k j E=A^{2}+(k+j) A E+k j E^{2}=(A+k E)(A+j E)
λA=λnA\vert \lambda A \vert = \lambda^{n} \vert A\vert
(AB)T=BTAT(A B)^{T}=B^{T} A^{T}
AT=A\left \vert A^{T}\right \vert=\vert A \vert