# Which came first - the Matrix entry name convention or the Programming for loop variable name convention?

So, conventionally, entries in a matrix are referred to as $A_{ij}$ - $i$th row, $j$th column.

For historical reasons (least partially due to Cobol naming restrictions based on what I've read, but I could be wrong), variable names for for loops will also be i and, for nested loops, j:

for (int i = 0; i < 10; i++) {
for (int j = 0; j < 20; j++) {
//..
}
}


Is this resemblance purely coincidental, or was one "borrowed" from the other? If one was "borrowed," which one came first?

• Mostly, it comes from the fact that $i$ comes before $j$ in the alphabet and $i$ is the first letter of the word index. – Michael Burr Oct 25 '17 at 23:10
• To emphasize the subscript notation, in every example and every lecture I ever do on or related to the topic, I always use R before C. You will never hear me say "rows and columns" in the other order if I can help it (unless it is to emphasize a particular property or is otherwise necessary). So, the players in the game are Rob and Charles, or it is the Rumrunners and the Coastgard, or Robbers and Cops. – JMoravitz Oct 25 '17 at 23:14
• @MichaelBurr How does the fact that $i$ comes before $j$ explain why $A_{ij}$ isn't the entry in the $i^{\text{th}}$ column, $j^{\text{th}}$ row? – bof Oct 25 '17 at 23:15
• Matrices were around long before Cobol (or even Fortran). – Robert Israel Oct 25 '17 at 23:27