在數學裏,矩陣加法一般是指兩個矩陣把其相對應元素加在一起的運算。但有另一運算也可以認為是一種矩陣的加法。
通常的矩陣加法被定義在兩個相同大小的矩陣。兩個m×n矩陣A和B的和,標記為A+B,一樣是個m×n矩陣,其內的各元素為其相對應元素相加後的值。例如:
![{\displaystyle {\begin{bmatrix}1&3\\1&0\\1&2\end{bmatrix}}+{\begin{bmatrix}0&0\\7&5\\2&1\end{bmatrix}}={\begin{bmatrix}1+0&3+0\\1+7&0+5\\1+2&2+1\end{bmatrix}}={\begin{bmatrix}1&3\\8&5\\3&3\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b7da39614abf8978240dd50e3111f7dfa416daa1)
也可以做矩陣的減法,只要其大小相同的話。A-B內的各元素為其相對應元素相減後的值,且此矩陣會和A、B有相同大小。例如:
![{\displaystyle {\begin{bmatrix}1&3\\1&0\\1&2\end{bmatrix}}-{\begin{bmatrix}0&0\\7&5\\2&1\end{bmatrix}}={\begin{bmatrix}1-0&3-0\\1-7&0-5\\1-2&2-1\end{bmatrix}}={\begin{bmatrix}1&3\\-6&-5\\-1&1\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c14df99026d70d1d2a4a81d63fb009c40df3ea77)
另一種運算為直和。直和可以由任何一對矩陣形成,其定義為:
![{\displaystyle A\oplus B={\begin{bmatrix}A&0\\0&B\end{bmatrix}}={\begin{bmatrix}a_{11}&\cdots &a_{1n}&0&\cdots &0\\\vdots &\ddots &\vdots &\vdots &\ddots &\vdots \\a_{m1}&\cdots &a_{mn}&0&\cdots &0\\0&\cdots &0&b_{11}&\cdots &b_{1q}\\\vdots &\ddots &\vdots &\vdots &\ddots &\vdots \\0&\cdots &0&b_{p1}&\cdots &b_{pq}\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/98ca39aafa24d261d2c5b6249270379d05fd681c)
舉例來說:
![{\displaystyle {\begin{bmatrix}1&3&2\\2&3&1\end{bmatrix}}\oplus {\begin{bmatrix}1&6\\0&1\end{bmatrix}}={\begin{bmatrix}1&3&2&0&0\\2&3&1&0&0\\0&0&0&1&6\\0&0&0&0&1\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/251bc5d17645a85597a0833edbdd22c58b0813f3)
注意到這種運算可以給兩個圖的鄰接矩陣取併集。
在任兩個向量空間內取定基底,並取兩基底的聯集為向量空間直和的基底,則兩空間上的線性變換的直和可以表成兩矩陣的直和。
一般地,n個矩陣的直和可以寫成:
![{\displaystyle \bigoplus _{i=1}^{n}A_{i}={\mbox{diag}}(A_{1},A_{2},A_{3},\ldots ,A_{n})={\begin{bmatrix}A_{1}&&&\\&A_{2}&&\\&&\ddots &\\&&&A_{n}\end{bmatrix}}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e104785ae202d2c6cb82821969d2cda0ad04c825)