### Direct sum of matrices

In mathematics, matrix addition is the operation of adding two matrices by adding the corresponding entries together. However, there are other operations which could also be considered as a kind of addition for matrices, the direct sum and the Kronecker sum.

## Entrywise sum

The usual matrix addition is defined for two matrices of the same dimensions. The sum of two m × n (pronounced "m by n") matrices A and B, denoted by A + B, is again an m × n matrix computed by adding corresponding elements:[1][2]

\begin\left\{align\right\}

\bold{A}+\bold{B} & = \begin{bmatrix}

a_{11} & a_{12} & \cdots & a_{1n} \\
a_{21} & a_{22} & \cdots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} & a_{m2} & \cdots & a_{mn} \\


\end{bmatrix} +

\begin{bmatrix}

b_{11} & b_{12} & \cdots & b_{1n} \\
b_{21} & b_{22} & \cdots & b_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
b_{m1} & b_{m2} & \cdots & b_{mn} \\


\end{bmatrix} \\ & = \begin{bmatrix}

a_{11} + b_{11} & a_{12} + b_{12} & \cdots & a_{1n} + b_{1n} \\
a_{21} + b_{21} & a_{22} + b_{22} & \cdots & a_{2n} + b_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} + b_{m1} & a_{m2} + b_{m2} & \cdots & a_{mn} + b_{mn} \\


\end{bmatrix} \\

\end{align}\,\!

For example:


 \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}


We can also subtract one matrix from another, as long as they have the same dimensions. AB is computed by subtracting corresponding elements of A and B, and has the same dimensions as A and B. For example:



\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}

## Direct sum

Another operation, which is used less often, is the direct sum (denoted by ⊕). Note the Kronecker sum is also denoted ⊕; the context should make the usage clear. The direct sum of any pair of matrices A of size m × n and B of size p × q is a matrix of size (m + p) × (n + q) defined as [3][1]


 \bold{A} \oplus \bold{B} =
\begin{bmatrix} \bold{A} & \boldsymbol{0} \\ \boldsymbol{0} & \bold{B} \end{bmatrix} =
\begin{bmatrix}
a_{11} & \cdots & a_{1n} &      0 & \cdots &      0 \\
\vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\
a_{m 1} & \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}


For instance,


 \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}


The direct sum of matrices is a special type of block matrix, in particular the direct sum of square matrices is a block diagonal matrix.

The adjacency matrix of the union of disjoint graphs or multigraphs is the direct sum of their adjacency matrices. Any element in the direct sum of two vector spaces of matrices can be represented as a direct sum of two matrices.

In general, the direct sum of n matrices is:[1]



\bigoplus_{i=1}^{n} \bold{A}_{i} = {\rm diag}( \bold{A}_1, \bold{A}_2, \bold{A}_3 \cdots \bold{A}_n)= \begin{bmatrix}

\bold{A}_1 & \boldsymbol{0} & \cdots & \boldsymbol{0} \\
\boldsymbol{0} & \bold{A}_2 & \cdots & \boldsymbol{0} \\
\vdots & \vdots & \ddots & \vdots \\
\boldsymbol{0} & \boldsymbol{0} & \cdots & \bold{A}_n \\


\end{bmatrix}\,\!

where the zeros are actually blocks of zeros, i.e. zero matricies.

NB: Sometimes in this context, boldtype for matrices is dropped, matricies are written in italic.

## Kronecker sum

Main article: Kronecker sum

The Kronecker sum is different from the direct sum but is also denoted by ⊕. It is defined using the Kronecker product ⊗ and normal matrix addition. If A is n-by-n, B is m-by-m and $\mathbf\left\{I\right\}_k$ denotes the k-by-k identity matrix then the Kronecker sum is defined by:

$\mathbf\left\{A\right\} \oplus \mathbf\left\{B\right\} = \mathbf\left\{A\right\} \otimes \mathbf\left\{I\right\}_m + \mathbf\left\{I\right\}_n \otimes \mathbf\left\{B\right\}.$