Matrix

A matrix is a two-dimensional array of numbers. Each element can be indexed by its row and column position. Thus, a 3 x 2 matrix:

Matrix

Transpose of a matrix

Swapping columns for rows in a matrix produces the transpose. Thus, the transpose of A is a 2 x 3 matrix:

Transpose of a matrix

Matrix addition

Matrix addition is defined as element-wise summation of two matrices with the same shape. Let A and B be two m x n matrices. Their sum C can be written as follows:

Ci,j = Ai,j + Bi,j

Scalar multiplication

Multiplication with a scalar produces a matrix where each element is scaled ...

Get Machine Learning: End-to-End guide for Java developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.