Is there a mathematical notation of indexing a matrix?

Do matrices in linear algebra support an operation of indexing them analogous to array indexing?

For example:

$$A = \left [\begin{array}{cc} 1 & 2 \\ 3 & 4 \end{array}\right]$$

In C, a fixed 2 by 2 array in 32 bit integer space could be described as:

int32_t A[][2] = {
{1, 2},
{3, 4}
};


and allows operations like:

A[0][0] = 2;


Is there a universally accepted equivalent to such an operation in linear algebra?

I understand that a Matrix is not a C Array equivalent, but I am curious whether such an operation is supported.

• It's really not clear to me what you mean. Often one will write the $(i, j)$ entry of a matrix $A$ as $A_{ij}$ or $a_{ij}$. – Travis Willse May 11 '16 at 12:26
• I mean is there a non naive, universally accepted way to denote mutation/accessing of an element within a matrix. A universally "correct" way to denote such an operation. – Dmitry May 11 '16 at 12:27
• The notation $A_{ij}$ "accesses" the element, but if you're referring to the operation that takes a matrix $A$, indices $i, j$ and a value $b$ and returns the matrix $A'$ whose entries are $A'_{kl} = A_{kl}$ for $(k, l) \neq (i, j)$ and $A'_{ij} = b$, then no, there is no widely familiar notation for this. Of course, you can always define such a notation and explain it yourself. – Travis Willse May 11 '16 at 12:43
• I think the title of this question should be modified to make clear that the question is about a notation for modifying a matrix entry. – Marc van Leeuwen May 12 '16 at 8:32
• @MarcvanLeeuwen indexing/mutating. But from the responses I got so far, it appears a matrix is not a mutable construct, and instead new matrices must be created via transformation or reinitialization, so asking how to modify a matrix seems misleading. – Dmitry May 13 '16 at 16:40

$A_{ij}$ is a common notation for the $(i,j)$th entry of a matrix $A$.

$i$ specifies the row, $j$ specifies the column, and the indexes start with $1$, rather than $0$.

So if $A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$, then $A_{11} = 1$, $A_{12} = 2$, $A_{21} = 3$, and $A_{22} = 4$.

• A standard matrix is always row major then, right? – Dmitry May 11 '16 at 12:40
• In the usual notation, the first index specifies the row. Is that what you mean by "row major"? – Ben Grossmann May 11 '16 at 15:35
• @Dmitry Yes, it's row major order. – DylanSp May 11 '16 at 16:45
• @Dmitry: I think you've misunderstood the term "row major". Row-major order has to do with the order in computer memory or storage -- whether the elements in the same row are always adjacent, vs. whether the elements in the same column are. In math, there's nothing analogous to that. – ruakh May 11 '16 at 20:31
• @Dmitry: Again, nonsense. There are plenty of languages that use column-major order, including some of the earliest languages (e.g. Fortran). That's why the terms "row major" and "column major" even exist. But they all use the normal math notation, with the row index preceding the column index. (If they didn't, then there would actually be no difference between row-major and column-major orders: if you flip the notation and the storage, then the two flips cancel each other out.) – ruakh May 13 '16 at 18:21

The most common one is $A_{ij}$, although you will often $a_{ij}$ in lowercase. Slightly less common is $A_{i,j}$ (usually when the indices are themselves a formula). Far less common is $A (i,j)$; sometimes used when there are other subindices/superindices around.

No, quite independently of matrices there is no standard mathematical notation for mutating operations, because there is no notion of executing a mathematical text. If we wrote a hypothetical formula with a side effect, what would make that side effect actually happen? We are free to reread our formulas if we don't quite understand them the first time around; would that make the side effect happen a twice or more?

However, it is possible to describe mathematical values in en operational way, as "the result of taking such and so value and performing this and that operation on it". Note that the meaning of such a description does not change by "executing" it, since it specifies which value to start with. Things like bringing matrices into echelon form are often described using this kind of description, but it usually does not use a symbolic formalism to describe just what operations are to be performed.

One case that is somewhat of this nature is evaluating polynomials by writing say $P(2)$ (although I personally prefer the more explicit $P[X:=2]$), which means (more or less) the result of taking the expression referred to by $P$ and replacing every instance of $X$ by the value $2$, and then performing the arithmetic operations (addition, multiplications, powers,...).

But for modifying a matrix value in a specific way, I don't think there is any standardised notation.

• Very important point! But I think the notation $A_{00} \leftarrow 2$ could be considered “standard mathematical notation for mutation”; this is what's used for most algorithm pseudocodes in CS papers. Arguably, such mutation still doesn't really make sense mathematically though. (Mutation can be described rigorously as a mathematical operation however, as a monadic action for instance.) – leftaroundabout May 11 '16 at 19:18
• of course there's a notion of executing mathematical text. By construction, mathematics is nothing but a bunch of symbols until it is parsed by us and in the process of walking through the statements, we implicitly transform a default environment, consisting only of reserved variables bound to reserved values such as pi, e, to new environments with the new state of the environment. Like most programming languages, math statements are chained with implicit(or explicit) "then". Every statement is a side effect in the sense that our new environment has new variables/or a new object on our stack. – Dmitry Jan 19 '18 at 21:48
• When we re-read an expression, we take an arbitrary environment, that we suppose is valid at this step, and interpret the statement and see what our new environment is, and use that as the input to the next step. This is of course can easily be optimized down to "changing state", since there's no other "threads" messed up if we mutate a value. – Dmitry Jan 19 '18 at 21:51
• That said, you're right, there's no actual reason to care whether we redefine a variable or not because the statement "let x = 2, let x = 3" is no different than "(λΓ.(λx. (λx ...)(3))(2))" where (λx. x) is a lambda function, and λΓ denotes our implicit environment(with pi, e, more or less variables) and since we are allowed to have many functions that have the same named variable, mutation in a math statement is just an abstraction of lambda abstraction which allows us to use math without caring how it "works"(variable binding, concept of then, concept of environments and stacks). – Dmitry Jan 19 '18 at 22:03
• My point is that math definitely has side effects, but you're right that as long as there is only one thread of reasoning, the concept of mutability is meaningless because mutability is isomorphic to shadowing(can easily convert to and from the two structures, a=2 a=3,a=4 and the (λΓ.(λx. (λx. (λx ...)(4))(3))(2)) that we execute by choosing an environment λΓ to start with. – Dmitry Jan 19 '18 at 22:17

Try $e_i^t Ae_j = a_{ij}$ where $e_i$ the i-th Standard Vector. $e_i = (0,…,0,1,0,….0)^t$ and the $1$ ist the i-th Element.

• What does t denote? – Dmitry May 11 '16 at 12:31
• The matrix you would obtain by changing the value of one of the entries of $A$, is a new, different matrix which is not equal to $A$. So it should have a new name, something other than $A$. It's not like a variable in programming where you can just change its value. – littleO May 11 '16 at 12:52
• Ok that makes sense. Similar to Haskell constructs. – Dmitry May 11 '16 at 12:53
• Hmm its $(e_j)^t$. You have a specific vector and then you transpose it. – user317721 May 11 '16 at 13:12
• @Dmitry, I'm a little amused by the fact that you are familiar enough with functional programming and not with math to say "oh, math notation works like Haskell" rather than the reverse. There's nothing wrong with that, though. – Mark S. May 11 '16 at 18:07