26
$\begingroup$

A simple question: By definition, does an m x n matrix have m rows and n columns, or is it vice versa?

  • 0
    Yes it's always "{number of rows} by {number of columns}"2015-02-18
  • 2
    You can name the variables how you like though. Curiously "m by n matrix" is about twice as common as "n by m matrix" in Google search results.2015-02-18
  • 1
    @ColonelPanic, that's probably because for a matrix $A$ operating on an $n$ dimensional vector $\mathcal{x}$ (i.e. $A \mathbf{x} = \mathbf{y}$) $\mathbf{y}$ is $m$ dimensional. In other words, it puts the input dimension before the output dimension alphabetically.2015-04-03

4 Answers 4

24

An $m \times n$ matrix has $m$ rows and $n$ columns.

  • 0
    can you provide a reference/citation for this?2012-09-06
  • 3
    All the textbooks i have read (both cs and math) have used this notation. For example, Strang's Introduction to Linear Algebra 4th.2012-09-06
  • 0
    You said "almost all". Were there any exceptions?2012-09-06
  • 1
    Sorry, I meant all.2012-09-06
  • 0
    How come accessing elements usually start with column, e.g. in Numpy. This is confusing.2016-06-20
  • 1
    @IvanBalashov In Numpy the first dimension is the row, not the column.2016-10-22
  • 0
    You can remember as RC2017-09-17
  • 0
    Does this notation convention go back to [Sylvester or Cayley](https://en.wikipedia.org/wiki/Matrix_(mathematics)#History)?2018-03-29
1

I suggest you always to check the notation on the book which you are using. I found sometimes this notation with different meaning. In advanced books, for example. Even the notation for linear maps as matrices. Sometimes they write $xT$.

  • 0
    What does xT refer to in this case?2012-09-06
  • 0
    It is the notation for the image of $x$ by the linear map $T$. Usually we write $T(x)$ or $Tx$.2012-09-06
1

Always check and make sure you have the right convention for the occasion. Usually m x n is rows x columns. I like to remember this as being in REVERSE alphabetical order - Rows by Columns, or R first then C. However, in Boyce & DiPrima's book "Elementary Differential Equations and Boundary Value Problems" an m x n matrix has m vertical columns and n horizontal rows.
However, when addressing elements within a matrix, it's the opposite. The element "a sub i,j" references the element in the ith row and jth column. Lesson? Always check to make sure you have the correct convention!