Is matrix just a rectangular array of symbols and expressions, or one can define it in a more formal way?

  • $\begingroup$ Real matrices are rectangular ($2$ dimensional) array of real numbers, equipped with addition and multiplication operators $(\text{matrix},\text{matrix}) \to \text{matrix}$ (with vectors being $n\times 1$ matrices). Matrices are a particular case of the more general tensors which are $k$ dimensional arrays, sort of matrix of matrices, capable of linear transforming matrices themselves. $\endgroup$
    – reuns
    Commented Jun 4, 2016 at 6:37
  • $\begingroup$ An element of the matrix space. $\endgroup$
    – Asaf Karagila
    Commented Jun 4, 2016 at 10:13
  • 3
    $\begingroup$ I find it remarkable that the answers differ in the origin of the matrix' elements ([commutative] ring [with identity] or field)... $\endgroup$
    – Jasper
    Commented Jun 4, 2016 at 10:34
  • 22
    $\begingroup$ Unfortunately, no one can be told what a matrix is. You have to see it for yourself. $\endgroup$
    – Fiksdal
    Commented Jun 4, 2016 at 15:39
  • $\begingroup$ Many of the answers use notation that implies the matrix has finite dimensions. That is a rather simple (but very useful in practice!) special case of the general concept. For an uncountably infinite matrix (or underlying mathematical object) using notation like $\{1, 2, 3, \dots\}$ doesn't necessarily make any sense at all. $\endgroup$
    – alephzero
    Commented Jun 4, 2016 at 18:03

6 Answers 6


Let $I_n:=\{1,\cdots, n\}$.

A $n \times m$-matrix with coefficients in a ring $\mathcal{R}$ is a function $a: I_n \times I_m \to \mathcal{R}$. We define $a_{i,j}:=a(i,j)$.

In other words, a rectangular array.

Sidenote: In my point of view, I think it is particularly useful to see the above definition as a model for the concept of a matrix, and retain subconsciously the relevant idea of a rectangular array as the core concept. If you truly understand the core concept and has relative comfort with mathematics, coming up with the above definition is a simple matter.

  • $\begingroup$ And when we would have $ a: I_n \times I_m \times I_p\times I_r \to\mathcal{R}$ we still have a matrix or something other? $\endgroup$
    – Widawensen
    Commented Jun 4, 2016 at 6:01
  • 2
    $\begingroup$ A problem with this definition is that the map $\emptyset\to\mathcal R$ is at the same time a $n\times 0$ matrix for any $n\in\Bbb N$ and a $0\times m$ matrix for any $m\in\Bbb N$. This is problematic when trying to define the matrix product of an $n\times 0$ matrix with a $0\times m$ matrix, in other words of that map with itself. $\endgroup$ Commented Jun 4, 2016 at 14:10
  • 2
    $\begingroup$ @MarcvanLeeuwen: to me, that doesn't sound more problematic than the fact that you cannot divide by zero. $\endgroup$ Commented Jun 4, 2016 at 21:40
  • 1
    $\begingroup$ @MartinArgerami I don't see what you mean. Are you saying that with matrices you "cannot multiply by the empty matrix"? If so that seems like an artificial and unnecessary restriction, quite unlike the case with fields where division by zero is denied out of necessity. I believe Marc's point is the following: suppose $\circ$ is a function which performs multiplication on $\cal R$-matrices. What is $\emptyset\circ\emptyset$? The obvious answer is $\emptyset$, but this gives the wrong result for an $n\times 0$ matrix times a $0\times m$ matrix, which should be an $n\times m$ matrix of $0$'s. $\endgroup$ Commented Jun 5, 2016 at 4:32
  • 1
    $\begingroup$ @MartinArgerami: I discussed this in my own answer to this question. The matrix product in question computes the composition of (zero) linear maps $K^m\to K^0\to K^n$, which is a bona fide zero map $K^m\to K^n$. $\endgroup$ Commented Jun 5, 2016 at 4:50

Let $R$ be a commutative ring with identity, and $n,m$ be positive integers. The set of $n\times m$ matrices $R^{n\times m}$ is defined as an $R$-module (vector space, if $R$ is a field) freely generated by elements $\{e_{i,j}\}$, where $1\leq i \leq n$ and $1 \leq j \leq m$. The element $e_{i,j}$ represents the matrix with all entries equal to zero, except the entry in $i$-th row and $j$-th column, which is equal to one.

For example, for $n=5, m=6$


Any matrix is a linear combination of $e_{i,j}$, with the coefficients being just the matrix entries.

This is still just an $n \times m$-dimensional $R$-module, but there is also a natural multiplication map $\times : R^{n\times m} \times R^{m \times p} \rightarrow R^{n \times p}$, defined by $$e_{i,j} \times e_{k,l} = \begin{cases} e_{i,l} & j = k \\ 0 & j \neq k \end{cases}$$ and extended by linearity. In fact, it is the standard matrix product.

In case $n=m$, this multiplication makes $R^{n\times n}$ into an $R$-algebra, isomorphic to the algebra of all endomorphisms on $R^n$.

  • $\begingroup$ This is the best answer, by far. But I'd denote $e_{i,j}$ by $E_{i,j}$ and I'd put a big matrix in the answer somewhere that has precisely one $1$ in it, with all the other entries $0$, just to aid the reader's visualization. $\endgroup$ Commented Jun 4, 2016 at 7:41
  • $\begingroup$ @goblin Nice idea, thanks! I'll probably leave $e_{i,j}$ to emphasis that these are just elements of the algebra. $\endgroup$
    – lisyarus
    Commented Jun 4, 2016 at 9:13
  • $\begingroup$ Sorry, this is just wrong. The set of $n\times m$ matrices does not form a ring or an algebra at all when $n\neq m$. $\endgroup$ Commented Jun 4, 2016 at 12:20
  • $\begingroup$ @MarcvanLeeuwen, now that I think about it, you're right - but your tone is imo too strong. Its true that, the construction, as given, only works for square matrices, so to claim that it works for all matrices is incorrect; but, we can indeed get all (finite-size) matrices, essentially by replacing our $R$-algebras with a single $R$-algebroid whose objects are the natural numbers. $\endgroup$ Commented Jun 4, 2016 at 12:42
  • 3
    $\begingroup$ @goblin: I assume that can be done (but I am not familiar with that notion). But more fundamentally I think there is a mismatch between on one hand what OP asks, which is similar to "how is a map formally defined" (and to which a nuts-and-bolts set-theoretic answer seems appropriate) and on the other hand what this answer provides, which is more similar to an answer to "what structure can be provided by composition of maps" (and which would probably involve category theory). $\endgroup$ Commented Jun 4, 2016 at 13:57

The standard way to define a table of values in some set $S$ as a mathematical object is to encode the positions as an index set $I$, and to represent the table as the map $I\to S$ that associates to each position it value in the table. Then matrices with $n$ rows and $m$ columns and values in $R$ could be represented (taking the usual convention of putting the row index before the column index) as maps $([n]\times[m])\to R$, where $[n]$ is an abbreviation for the $n$-element set $\{1,\ldots,n\}$, and "$\times$" denotes the Cartesian product.

However this definition has a drawback that the values $n,m$ cannot always be recovered from a matrix, even though the domain can be recovered from a map. The problem is that $[n]\times[m]=\emptyset$ whenever $n=0$ or $m=0$, so for a matrix that is the unique map $\emptyset\to R$, one cannot reconstruct the values of $n,m$. Bourbaki even explicitly states that there is a unique empty matrix, overlooking the fact that this causes problems with definitions that immediately follow in their own presentation. In everyday use of matrices, it is very common to assume that given an $n\times m$ matrix one knows what $n$ and $m$ are, but with the definition of a matrix as a map, this is simply not true in the case of an empty matrix. And empty matrices are necessary for encoding linear maps between finite dimensional vector spaces, in case a vector space of dimension$~0$ is the domain or codomain of the linear map.

One reason this is a real problem is that matrix multiplication is defined in such a way that any product of a $n\times k$ matrix with a $k\times m$ matrix should be an $n\times m$ matrix, each of whose entries is obtained as a sum of $k$ terms. If $k=0$ then both operands of the multiplication are empty matrices, so each entry of the product being a sum of $0$ terms must be $0$, giving the zero matrix of size $n\times m$. However this requires knowing the values of $n$ and $m$, and with the definition of matrix as map, this is not possible. One simply cannot define the product of the unique empty matrix with itself to be a different size zero matrix according to the circumstances.

So the conclusion is that for a rigorous definition of a matrix, one must record the dimensions as components of the matrix itself. So a proper and rigorous definition of a matrix is the following.

A matrix with entries in $R$ is a triple $(n,m,f)$ where $n,m\in\Bbb N$ and $f$ is a map $([n]\times[m])\to R$.

  • 5
    $\begingroup$ An alternative solution rejects the notion of "matrix" in favor of "$n\times m$ matrix", that is, the dimensions must be given as parameters to the definition. (Compare with the definition of "$p$-group", which has $p$ as a parameter.) The matrix multiplication is then parameterized by $n,k,m$, so that $A \cdot_{n,k,m} B$ is defined when $A$ is an $n\times k$ matrix and $B$ is an $k\times n$ matrix, and the result is an $n\times m$ matrix. This simplifies the set theoretic structures at the expense of extra implicit parameters to theorems about matrices. $\endgroup$ Commented Jun 4, 2016 at 17:15
  • 1
    $\begingroup$ ...This is how we resolve this issue in the Metamath formalization of matrix multiplication. $\endgroup$ Commented Jun 4, 2016 at 17:21
  • $\begingroup$ @MarioCarneiro: That might be a solution in certain formal contexts, but has several problems for ordinary mathematical practice. I think what you say is that any matrix has to occur in the context that fixes its size, and cannot be considered on its own. (The analogy with $p$-groups is wobbly: the Klein $4$ group can be studied independently of being a $2$-group.) In practice texts are not written with such a discipline. And it would seem that having a set containing matrices of different sizes is impossible, contrary to what set theory requires. $\endgroup$ Commented Jun 4, 2016 at 18:53
  • $\begingroup$ Although I only intended the $p$-group example as a demonstration of "parameterized definition", it is also a good example of this phenomenon. We like to think that we can recover the "$p$" given a $p$-group, and this is almost true, but the trivial group is a $p$-group for every $p$, similar to how the empty matrix is a $0\times n$ matrix for every $n$. In almost every case when talking about $p$-groups, though, one is not interested that a group is a $p$ group for some $p$, but rather the specific $p$ used as a parameter to the theorem... $\endgroup$ Commented Jun 5, 2016 at 2:01
  • $\begingroup$ ... for example in the theorem that a finite $p$-group has size $p^n$ for some $n$, the $p$ in the hypothesis and consequent must match. As for having matrices of different sizes in the same set, this is only done very rarely - a similar sort of thing is the construction of an exterior or tensor algebra, whose elements are linear combination of tensors of different dimension. In this case, the differences are tracked by taking a disjoint union of the individual matrix spaces, which effectively adds the "dimension tag" which you are using here. $\endgroup$ Commented Jun 5, 2016 at 2:12

Let $m$ and $n$ be positive integers and let $F$ be a field. An $m $ by $n $ matrix with entries in $F $ is a function from $S $ into $F $, where $S $ is the set of all ordered pairs of integers $(i,j) $ such that $1\leq i \leq m $ and $1\leq j \leq n $.


The other answers define a matrix in a way that is just a rectangular array of numbers. This not only ignores the beauty of the structures, but it makes proving many basic facts (eg. that the determinant is multiplicative, among innumerable others) very cumbersome.

Of course matrices can have very different mathematical structures depending on how you interpret them. (eg. linear transformations, bilinear forms, etc.) Since it's the most common, here's how you could define a matrix as a linear transformation:

Let $V$ and $W$ be finite dimensional vector spaces over a field $F$ with respective bases $B$ and $C$. Let $T:V\to W$ be a linear map. Then the "matrix" for $T$ can be defined as the map $B\times C\to F$, which maps $(\beta,\gamma)$ to the coefficient of $T(\beta)$ in the (unique) expansion of $\gamma$ in terms of image of $B$ under $T$, which is a basis for $W$.

Actually it's now obvious how you'd extend this definition to "infinite matrices."

  • 3
    $\begingroup$ The question asks what a matrix is, not what matrix should be associated to a linear map. In fact this answer supposes one already knows what a matrix is (the very vaguely mentioned "array representing the map $B\times C\to F$"). Also this definition has the curious consequence that keeping $T$ but permuting (for instance) the elements of the basis $B$ does not change the matrix at all. Maybe the assumption is that bases are just (unordered) sets. But then one can no longer talk about the first row of a matrix, rather annoying when trying to discuss Gaussian elimination. $\endgroup$ Commented Jun 4, 2016 at 12:31
  • $\begingroup$ I took out the ambiguous phrase. I think you're missing the point which is that matrices spoken about in mathematics always have some structure, usually a linear map and some choice of basis. No mathematician thinks of a matrix as an arbitrary array of numbers as many of the other answers suggest. By their definitions, a baseball box score is a $2\times12$ matrix, which is silly. $\endgroup$ Commented Jun 4, 2016 at 17:00
  • $\begingroup$ @MarcvanLeeuwen For uncountably infinite dimensional vector spaces, talking about "the first basis function" or "the first row/column of the matrix" may be meaningless. Finite dimensional vector spaces and matrices are a much simpler (but very useful) special case. $\endgroup$
    – alephzero
    Commented Jun 4, 2016 at 17:58

Depending on how abstract/general/formal you want to get, you might want to check out (google) Chu spaces, e.g., https://en.wikipedia.org/wiki/Chu_space Your phrase "array of symbols and expressions" suggests you might want to discuss more abstract arrays than numbers/fields/etc. If the wikipedia page whets your appetite, I'd say the most comprehensive yet easy-to-follow introduction is http://boole.stanford.edu/pub/coimbra.pdf


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .