A is the same as the number of rows in B.
The general definition of matrix multiplication is as follows: If A is a n×m matrix and B is a m×p matrix, their product C will be a n×p matrix such that the general element cij of C is given by
Note that in general AB is not equal to BA (matrix multiplication is not commutative).
Since a vector is simply a one-dimensional matrix, the definition of matrix multiplication given above also applies when a vector is multiplied by an appropriate matrix, e.g.,
The operator * is used for matrix multiplication, as you may have guessed. For example, if
c = a * b
Note the important difference between the array operation a .* b (evaluate by hand and check with MATLAB) and the matrix operation a * b.
To multiply a matrix by a vector in that order, the vector must be a column vector. So if
b = [2 3]'