Skip to content

Transposition: Swapping Rows and Columns

Textbook

Transposing $A\in\mathbb R^{m\times n}$ produces $A^{\mathsf T}\in\mathbb R^{n\times m}$ with $(A^{\mathsf T})_{ji}=A_{ij}$. Rows become columns and columns become rows, preserving the entries. Transposing twice restores the original matrix.

A column of three coordinates has shape $3\times1$; its transpose has shape $1\times3$. The number of coordinates stays the same, but compatible matrix products depend on the new shape. The superscript $\mathsf T$ rearranges positions; it does not raise numerical values to a power.

An entry at address $(i,j)$ moves to $(j,i)$. Swapping indices twice restores $(i,j)$, proving the double-transpose rule for every entry. A square matrix retains its shape, but off-diagonal entries may exchange positions. Diagonal entries stay put because their indices are equal. Consequently, identical shapes before and after transposition do not establish equality of the matrices themselves. Shape describes available addresses; the entry rule determines which value occupies each address.

Definitions and further reading: Mathematics for Machine Learning.

In plain language

Transposition exchanges the roles of rows and columns while preserving every entry. A row becomes the column with the same index, so the order 2, 4, 6 is not reversed. This is an exact address change rather than a rotation of the paper. In a student-by-subject table, subjects become rows and students become columns; relocation improves no grades.

Example

The example transposes the original illustrative column $(2,4,6)^{\mathsf T}$. The column is followed by the resulting row and the reverse operation.

Transposition: Swapping Rows and Columns

Column

Each value occupies its own row.

Step 1 of 3: Column

Read all steps
  1. Column

    Each value occupies its own row.

    x₁
    2current
    x₂
    4current
    x₃
    6current
  2. Row

    After exchanging indices, the values share one row.

    xᵀ
    2current4current6current
  3. Restored column

    Transposing again restores the column.

    x₁
    2current
    x₂
    4current
    x₃
    6current

The value four begins in row two, column one, then moves to row one, column two. Two remains the first coordinate and six the third. Transposing back restores each original address. Checking the collection of values alone is insufficient: the row $(6,4,2)$ contains the same numbers but is not the required transpose. Checking both the shape and each swapped address exposes that error.

Related concepts: Matrices.

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

Previous / next

Previous
Matrices: Tables With Two Indices
Next
Matrix Multiplication: A Row Meets a Column
  • 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