In Linear Algebra, a matrix is a 2-dimensional(rectangular shaped) array of numbers, symbols, or expressions arranged in rows and Columns with the same length. A matrix could be reduced as a submatrix of a matrix by deleting any collection of rows and/or columns.

Order of the matrix is defined by the number of rows and columns in it, indicating it's dimension and the number of elements. A Matrix is represented as where is the matrix, is the number of rows and is the number of columns.

Where A and B are represented as and

Matrix Operations:

  • Adding and subtracting matrices: Possible if both have the same dimension.
  • Scalar Multiplication: multiply each number in the matrix with the scalar value.
  • Matrix Multiplication: only possible if the number of rows in first matrix is the same as the number of columns in second matrix. we use Dot Product to multiply two matrices by multiplying the numbers in each row of first matrix with the numbers in each column of second matrix, and then add the products. It’s also not commutative, that is .*
  • Transpose a Matrix: To transpose a matrix, means to replace rows with columns. When you swap rows and columns, you rotate the matrix around it's diagonal.
  • Matrix Factorization: Is a mathematical model used in Content-Based Filtering in Recommender Systems.


  • Square Matrix: it is a matrix with an equal number of rows and columns.
  • Rectangular matrix: it is a matrix that doesn't have an equal number of rows and columns.
  • Diagonal Matrix: it has values on the diagonal entries, and zero on the rest of the matrix.
  • Scalar Matrices: has equal diagonal entries and zero on the rest of the matrix.
  • Identity Matrix: it has 1 on the diagonal and 0 on the rest.
  • Zero Matrix (Null Matrix): it has only zeros.