Skip to content

matrix

a list of equal-length lists, rows of numbers

1
# in nested brackets
2
[[1, 2], [3, 4]]
3
# filled with one value
4
matrix(2, 3, 7)[[7, 7, 7], [7, 7, 7]]
5
# the identity
6
identity(3)[[1, 0, 0], [0, 1, 0], [0, 0, 1]]
Example outputCtrl+Enter to run
  • transpose a matrix with its rows and columns swapped
  • matmul the matrix product of a and b, where a must have as many columns as b has rows
  • det the determinant of a square matrix
  • inv the inverse of a square matrix: the matrix that multiplies with it to give the identity
  • identity the n by n identity matrix: 1 down the diagonal and 0 elsewhere
  • matrix a matrix of the given number of rows and columns, filled with fill (0 if left out)
  • reshape the items of xs laid out as a matrix of the given rows and columns, filling row by row
  • row row i of matrix m, counting from 0
  • col column j of matrix m, counting from 0
  • hcat two matrices side by side, which need the same number of rows
  • vcat two matrices one above the other, which need the same number of columns
  • rref the reduced row echelon form of a matrix: the simplest matrix its row operations can reach
  • rank the rank of a matrix: how many of its rows are independent of the others
  • cofactor the cofactor of m at row i and column j: the determinant of what is left without them, signed
  • adjugate the adjugate of a square matrix: the transposed cofactors, which divided by the determinant give the inverse
  • kron the Kronecker product of two matrices: every item of a times the whole of b, in blocks
  • permanent the permanent of a square matrix: the determinant without the alternating signs
  • solve solve linear equations: the list x for which matmul(a, x) gives b

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.