# Are one-by-one matrices equivalent to scalars?

I am a programmer, so to me $[x] \neq x$—a scalar in some sort of container is not equal to the scalar. However, I just read in a math book that for $1 \times 1$ matrices, the brackets are often dropped. This strikes me as very sloppy notation if $1 \times 1$ matrices are not at least functionally equivalent to scalars. As I began to think about the matrix operations I am familiar with, I could not think of any (tho I am weak on matrices) in which a $1 \times 1$ matrix would not act the same way as a scalar would when the corresponding scalar operations were applied to it. So, is $[x]$ functionally equivalent to $x$? And can we then say $[x] = x$? (And are those two different questions, or are entities in mathematics "duck typed" as we would say in the coding world?)

• Could someone please create further tags for this post? I don't have enough reputation yet. (At least "scalars" would be great.) Sep 16 '11 at 4:15
• Mathematicians have many, many notions of equivalence. In some of them, the answer is yes. Sep 16 '11 at 4:17
• It is indeed sensible to treat $1\times 1$ matrices as scalars (for most applications). The surprise here is that multiplication is actually commutative! Sep 16 '11 at 4:18
• "I am a programmer, so to me $[x]\neq x$ a scalar in some sort of container is not equal to the scalar.". Note that the brackets/parentheses in the matrix notation are mostly there for aesthetic reasons and clarity. Mathematicians could have decided to just write a matrix as a table of numbers with no embellishment at all (or, on the contrary, separate entries by lines). So the notation $[x]$ does not mean that $x$ is contained in something. Nov 6 '14 at 10:40
• I got bit by this as well...I was using a linear algebra library, and multiplied a $1\times n$ matrix by a $n\times 1$ matrix. The result was stored, and caused a bug later in the program because a matrix data type was expected, but it was a scalar. I checked and this behavior is consistent with Mathematica and Maxima, so I guess it's accepted convention. Feb 27 '16 at 3:25

No. To give a concrete example, you can multiply a 2x2 matrix by a scalar, but you can't multiply a 2x2 matrix by a 1x1 matrix.

It is sloppy notation.

• You could treat the 2x2 matrix as having 1x1 matrix entries, then define multiplication to be the matrix of products of 1x1 matrices! Sep 16 '11 at 4:29
• On the other hand, a column vector ($n \times 1$ matrix) can be multiplied by a scalar as well as by a $1 \times 1$ matrix, and then it's convenient not to make any distinction, for example in the middle step of the calculation $(x \cdot n)n = n(n\cdot x) = n(n^t x) = (nn^t)x$. Sep 16 '11 at 4:39
• Yet for some reason a column matrix $x\in\mathbb{R}^{n\times 1}$ can be left multiplied by $x^{T}$ to produce $x^{T}x$, which is both a scalar (when interpreted as a dot product of vectors, $\vec{x}\cdot\vec{x}$) and a 1x1 matrix when interpreted as matrix multiplication. Explain that! Quadratic equations can be written $f(x) = \frac12 x^{T}Ax - b^T x + c$, where both $x^T Ax$ and $b^T x$ are clearly 1x1 matrices and $c$ is give to be a scalar. Mathematical inconsistencies and definition-violations put the math in serious doubt. Oct 23 '17 at 18:29
• It should be noted that the 1x1 matrix containing the value n is an isomorphism with the scalar n. Dec 28 '19 at 11:15

## Some Background

There are three basic kinds of mathematical spaces that are being asked about in the original question: scalars, vectors, and matrices. In order to answer the question, it is perhaps useful to develop a better understanding of what each of these objects is, or how they should be interpreted.

1. In this context, a scalar is a an element of a field. Without getting into too much detail, a field is an object made from three ingredients $(k,+,\cdot)$, where $k$ is a set, and $+$ and $\cdot$ are two binary operations (addition and multiplication). These operations are associative and commutative, there are distinguished identity elements (0 and 1) for each operation, every element has an additive inverse, every nonzero element has a multiplicative inverse, and multiplication distributes over addition.

Examples of fields include (among others) the real numbers, as well as the rationals, the complex numbers, and (if you are feeling a little more esoteric) the $p$-adic numbers.

2. A vector is an element of a vector space. A vector space is an object made from four ingredients $(V,k,+,\cdot)$, where $V$ is a set, $k$ is a field (the base field), $+$ is a binary operation which acts on two vectors, and $\cdot$ is a binary operation (called scalar multiplication) which acts on a scalar from $k$ and a vector from $V$. The addition is associative and commutative, there is a distinguished 0 vector (the additive identity), and every vector has an additive inverse. Scalar multiplication allows scalars to "act on" vectors; a vector can be multiplied by a scalar, and this multiplication "plays nice" with the addition (e.g. $a(b\mathbf{v}) = (ab)\mathbf{v}$ and $a(\mathbf{u}+\mathbf{v}) = a\mathbf{u} + a\mathbf{v}$ for scalars $a$ and $b$, and vectors $\mathbf{u}$ and $\mathbf{v}$).

Examples of vector spaces include $\mathbb{R}^n$ (the base field is $k = \mathbb{R}$), $\mathbb{C}^n$ (the base field is $\mathbb{C}$), and the space of continuous functions from $[0,1]$ to $\mathbb{C}$ (i.e. the space $C([0,1])$–the base field here is $\mathbb{C}$ again).

3. Finally, a matrix is an element of a specific kind of algebra over a field. An algebra has two ingredients: $(V,\times)$, were $V$ is a vector space and $\times$ is a binary operation called a bilinear product. This product is both left- and right-distributive over the addition in $V$, and plays nice with scalar multiplication. In detail, if $a$ and $b$ are scalars and $\mathbf{u}$, $\mathbf{v}$, and $\mathbf{w}$ are vectors, then

• $\mathbf{u} \times (\mathbf{v} + \mathbf{w}) = (\mathbf{u}\times \mathbf{v}) + (\mathbf{u}\times \mathbf{w})$,
• $(\mathbf{u} \times \mathbf{v}) \times \mathbf{w} = (\mathbf{u}\times \mathbf{w}) + (\mathbf{v}\times \mathbf{w})$, and
• $(a\mathbf{u})\times (b\mathbf{v}) = (ab)(\mathbf{u}\times \mathbf{v}).$

Note that the underlying vector space (with its underlying field) is still running around, so there is a ton of structure here to play around with.

Examples of algebras include $\mathbb{R}^3$ with the usual cross product, and matrix algebras such as the space of $n\times n$ matrices over $\mathbb{R}$ with the usual matrix multiplication. The structure of an algebra is actually more general than this, and there are much more interesting examples (such as $C^{\ast}$-algebras), but these are not really germane to this question.

## The Question Itself

Now to attempt to answer the question:

If $k$ is any field, then we can regard $k$ as a (one-dimensional) vector space over itself by taking the scalar multiplication to coincide with the multiplication in the field. That is, if we let $a$ denote a scalar and $\langle a \rangle$ denote a vector, then $$a \cdot \langle b \rangle := \langle a\cdot b \rangle.$$ In a mathematically meaningful sense, this is a way of identifying the field $(k,+,\cdot)$ with the vector space $(V,k,+,\cdot)$ (though something is lost in the translation–it doesn't make sense to multiply two vectors, though it does make sense to multiply a vector by a scalar). This is a bit outside my area of expertise, but I think that the right language (from category theory) is that there is an faithful functor from the category of fields to the category of vector spaces. In more plain language, this says that fields and (certain) vector spaces are equivalent to each other. Specifically, we can sometimes regard a one-dimensional vector as a scalar–while they are not quite the same objects, they can, in the right context, be treated as though they are the same. In this sense, a scalar is "functionally equivalent" to a one-dimensional vector.

By a similar argument, we can regard a field $k$ as an algebra over itself, with the underlying vector space being that obtained by viewing $k$ as a vector space, and the bilinear product being the product obtained by making the identification $$[a]\times [b] = [a\cdot b].$$ In this case, the algebra obtained is the algebra of $1\times 1$ matrices over $k$. Hence there is a faithful function identifying any field with an algebra of $1\times 1$ matrices. Again, this gives us a way of identifying scalars with matrices, so (again) we may meaningfully assert that scalars can be identified with matrices. In contrast to the previous example, we really don't lose anything in the translation. Even more surprising, the bilinear product ends up being a commutative operation, which is a neat property for an algebra to have.

It is worth observing that, in this setting, $[a]$ is not "the scalar $a$ in some kind of container." The notation $[a]$ denotes a $1\times 1$ matrix with entry $a$. The brackets denote a great deal of structure–more than is implied by the simple statement "a scalar in a container."

Long Answer Short: A $1\times 1$ matrix is not a scalar–it is an element of a matrix algebra. However, there is sometimes a meaningful way of treating a $1\times 1$ matrix as though it were a scalar, hence in many contexts it is useful to treat such matrices as being "functionally equivalent" to scalars. It might be a little sloppy to do so, but a little bit of sloppiness is forgivable if it introduces no confusion or ambiguity, and if it aids brevity or clarity of exposition.

• I don't agree that they are "functionally equivalent". It is the same issue as type casting, where for example an int can be cast to an Integer in Java, in the same manner a scalar can be cast to a matrix, such that the casting preserves some properties. Sep 10 '18 at 5:01
• Another more related example is that given any $f : \mathbb{R} \to \mathbb{R}$ and any $x \in \mathbb{R}$ we can define $x·f$ to be the pointwise multiplication of $f$ by $x$. Likewise given any $f,g : \mathbb{R} \to \mathbb{R}$ we can define $f·g$ to be the pointwise product of $f$ and $g$. We can cast any real $x$ to the constant function on $\mathbb{R}$ whose value is always $x$, but are reals and constant functions "functionally equivalent"? Well... no, a function can be evaluated at a point, while a real has no such feature. Sep 10 '18 at 5:01
• Okay I guess the added words "in the right context", in the right context, would evade my objection. Namely, if we interpret it to mean that scalars and 1-by-1 matrices, when used in certain specific ways, can be treated as functionally equivalent, then I agree. =) Sep 10 '18 at 12:32