# Can we have a matrix whose elements are other matrices as well as other things similar to sets?

Basically, what I am asking is this: Is a matrix just like an ordered sequence, of which the elements can be anything? It would seem silly to restrict a matrix down to limited uses such as only for numbers, but I get the impression that I cant multiply two matrices whose elements are the planets in our solar system. So we only allow numbers in matrices.

Does this also mean that I cannot have a matrix of matrices? I feel like I should be able to since if I wanted to multiply two matrices of matrices, then although tedious by hand it can be done since I can add/subtract and multiply normal matrices. Although I do not know many of the other operations so I do not know if everything else can be done with such constructs.

-

If you don't want to add or multiply matrices the entries of a matrix could be any mathematical object. But there is not so much going on here...

Let's assume you want to be able to add and multiply square matrices. You can certainly do so if all the elements of your matrix lie in some common structure $(X,+,\cdot)$, i.e., a set endowed with addition and multiplication operations. If the $+$ in $X$ is commutative and associative then matrix addition will be so; if moreover the $\cdot$ in $X$ is associative and distributes over addition then the matrix multiplication will be so.

Especially, you can take matrices to have entries in any ring $R$, not necessarily commutative. Such things come up naturally in the Wedderburn-Artin theory of semisimple rings. In particular, you can take as your entries the ring of matrices with entries in some other (not necessarily commutative!) ring. In this regard one of the basic facts is that for any ring $R$,

$M_m(M_n(R)) \cong M_{mn}(R)$.

-

To allow the basic matrix operations, the entries should be from a ring. That is, they don't need to be usual real numbers, but surely they cannot be planets as we don't know how to add or multiply these. But apart from numbers, for exmple polynomials can be used. And since the set of $n\times n$ matrices over a ring is itself a ring, yes, you could put matrices (of equal square size) there. Intriguingly, if you add/multiply $m\times m$ matrices of $n\times n$ matrices, the result is the same as if you simply drop the "intermediate " parentheseis and work immediately with $nm\times nm$ matrices.

In fact, one often does this the other way round by structuring big matrices into chunks for abbreviation, even with non-square and varying sizes. For example something like $$\begin{pmatrix}A&b\\c^T&z\end{pmatrix}$$ with a $n\times m$ matrix $A$, a column vector $b$, a row vector $c^T$ and a scalar $z$ may easily occur in the area of linear optimization (and is simply a $(n+1)\times (m+1)$ matrix. The nice thing is that e.g. multiplication of this with a $(m+1)\times 1$ column vector $d\choose u$ (with $d$ a vector and $u$ a scalar, or $d$ an $m\times r$ and $u$ is $1\times r$) is simply $$\begin{pmatrix}A&b\\c^T&z\end{pmatrix}\begin{pmatrix}d\\u\end{pmatrix}=\begin{pmatrix}Ad+bu\\c^Tb+zu\end{pmatrix}$$ just as if the entries were numbers.

-
@PeteL.Clark Alright replaced "can't add" with "don't know how to add", implying there is no natural/canonical ring structure. –  Hagen von Eitzen Feb 26 '13 at 22:03

There's no real need for matrices to have only numbers for entries. Given any collection $\mathcal{O}$ of objects, we can think of an $m$ by $n$ matrix $A$ of the objects of $\mathcal{O}$ as a function $$A:\{1,...,m\}\times\{1,...,n\}\to\mathcal{O}.$$ We typically denote $A(i,j)$ by $A_{i,j}$. Now, if we want to have some matrix operations, then we will need some associative binary operations $+$ and $\cdot$ defined on $\mathcal{O}$. Let's suppose we've got such things.

Given matrices $A,B$ of objects of $\mathcal{O}$ with the same domain (dimensions), we can define the matrix $A\oplus B$ by $$(A\oplus B)_{i,j}:=A_{i,j}+B_{i,j}.$$

Given matrices $A,B$, with $A$ being $l$ by $m$ and $B$ being $m$ by $n$, we can define the matrix $A\odot B$ by $$(A\odot B)_{i,j}:=A_{i,1}\cdot B_{1,j}+\cdots+A_{i,m}\cdot A_{m,j}.$$

If the operations $+$ and $\cdot$ have all the usual properties, then $\oplus$ and $\odot$ will have all the properties we've come to expect from regular matrix multiplication. Otherwise, there may be some differences.

-