Skip to content

Matrices: Tables With Two Indices

Textbook

A matrix $A\in\mathbb R^{m\times n}$ is a rectangular table of real numbers with $m$ rows and $n$ columns. Here $m,n$ are positive integers. Entry $A_{ij}$ lies in row $i$ and column $j$; the examples use one-based indices.

Its shape $m\times n$ is part of the object’s type. Equal matrices have the same shape and equal corresponding entries. Here $A$ names a table rather than a set: the context assigns its role. A row and a column containing the same numbers have different shapes and play different roles in multiplication.

For an $m\times n$ matrix, valid indices satisfy $1\le i\le m$ and $1\le j\le n$. An index outside those ranges selects no entry of this matrix. Zeros do not reduce its shape: zero rows and columns remain part of the table. Matrices of the same shape can differ in one entry; the same collection of numbers in different positions does not establish equality.

Definitions and further reading: Mathematics for Machine Learning.

In plain language

A matrix resembles a seating plan: an address requires the row first and the column second. Exchanging indices can select a different cell, and equal seat counts do not make two-by-three and three-by-two shapes identical. Zero occupies a full cell without shifting the remaining entries. Equal values do not merge; two tickets at the same price do not turn their seats into a shared chair.

Example

The illustrative matrix has first row $(1,2)$ and second row $(0,1)$. Its shape is followed by two different entries.

Matrices: Tables With Two Indices

Shape

Two rows and two columns give shape 2 × 2.

Step 1 of 3: Shape

Read all steps
  1. Shape

    Two rows and two columns give shape 2 × 2.

    A₁
    1current2current
    A₂
    0current1current
  2. Row one, column two

    Indices 1, 2 select the value 2.

    A₁
    1current2 ←current
    A₂
    0current1current
  3. Row two, column one

    Swapping the indices selects a different entry: 0.

    A₁
    1current2current
    A₂
    0 ←current1current

The example’s second row begins with zero, so $A_{21}=0$ identifies an actual entry rather than a missing cell. Both rows contain two entries, leaving the shape $2\times2$. Reading $A_{12}$ selects the first row and then its second position. State that order before calculating: an addressing mistake can produce a plausible number and survive every subsequent arithmetic step.

Related concepts: Matrix multiplication.

The original text of this free article is published under CC BY-NC-ND 4.0.

Previous / next

Previous
Elementwise Products: Keeping the Coordinates
Next
Transposition: Swapping Rows and Columns
  • Natural Numbers: Counting Discrete Objects

    Which values count discrete objects, and why the zero convention must be stated.

    Read article
    Math
  • Integers: Counting on Both Sides of Zero

    Positive and negative integers, zero, and the limits of integer division.

    Read article
    Math
  • Rational Numbers: Ratios of Integers

    Numbers as ratios of integers: equivalent fractions and the nonzero denominator requirement.

    Read article
    Math