Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|cite|improve this question
Yes it's always "{number of rows} by {number of columns}" – Colonel Panic Feb 18 '15 at 16:15
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. – Colonel Panic Feb 18 '15 at 16:19
@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. – Shep Apr 3 '15 at 1:42
up vote 12 down vote accepted

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

share|cite|improve this answer
can you provide a reference/citation for this? – Anderson Green Sep 6 '12 at 2:16
All the textbooks i have read (both cs and math) have used this notation. For example, Strang's Introduction to Linear Algebra 4th. – James Sep 6 '12 at 2:17
You said "almost all". Were there any exceptions? – Anderson Green Sep 6 '12 at 2:19
Sorry, I meant all. – James Sep 6 '12 at 2:20
How come accessing elements usually start with column, e.g. in Numpy. This is confusing. – Ivan Balashov Jun 20 at 6:24

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$.

share|cite|improve this answer
What does xT refer to in this case? – Anderson Green Sep 6 '12 at 2:36
It is the notation for the image of $x$ by the linear map $T$. Usually we write $T(x)$ or $Tx$. – Sigur Sep 6 '12 at 2:38

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!

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.