Function reference · Linear algebra

transpose

Swaps the rows and columns of a matrix.

In JavaScript, a matrix also has a .transpose() method.

Notation

transpose(matrix)

Write it in an expression: nerdamer('transpose(matrix([1,2],[3,4]))'), or in the Playground.

Parameters

matrix
Matrix to transpose.

Examples

A 2 by 2 matrix.

transpose(matrix([1,2],[3,4]))
// → matrix([1, 3], [2, 4])
Open in Playground

A 2 by 3 matrix becomes 3 by 2.

transpose(matrix([a,b,c],[x,y,z]))
// → matrix([a, x], [b, y], [c, z])
Open in Playground

← Back to Function reference