Since matrices can be added and scaled, it is meaningful to define linear combinations of matrices (of the same shape), such as 2A-4B.
Note that A+B=B+A. We can multiply an m × n matrix A by a p × q matrix B only if n = p.
We obtain an m × q matrix C whose elements are calculated as in the following example:

More formally, the element at (i,j) in the resulting matrix is the result of taking the dot product between the i
th row in A and the j
th column in B.
If we use matrix notation to describe two vectors, multiplication produces the same result as the dot product, as long as we assume that the first vector is a row vector and the second is a column vector.
For example if A = (1,2,3) and B = (4,5,6) are two vectors, then their dot product in matrix notation can be given as: