This is a brief summary of ML course provided by Andrew Ng and Stanford in Coursera.
You can find the lecture video and additional materials in
https://www.coursera.org/learn/machine-learning/home/welcome
$\left[\begin{array} {rrr} 1 & 3 \\ 4 & 0 \\ 2 & 1 \end{array}\right] $ $ \left[\begin{array} {rrr} 1 & 5 \end{array}\right] $ = $\left[\begin{array} {rrr} 16 \\ 4 \\ 7 \end{array}\right] $
n has to match: number of column and number of row has to match. Then the result will be m-dimensional vector.
Quiz: Consider the product of these two matrices:
$\left[\begin{array} {rrr} 1 & 2 & 1 & 5 \\ 0 & 3 & 0 & 4 \\ -1 & -2 & 0 & 0 \end{array}\right] $ $ \left[\begin{array} {rrr} 1 \\ 3 \\ 2 \\ 1 \end{array}\right] $
What is the dimension of the product?
Answer: 3 x 1
= $ \left[\begin{array} {rrr} 14 \\ 13 \\ -7 \end{array}\right] $
Quiz: What is $\left[\begin{array} {rrr} 1 & 0 & 3 \\ 2 & 1 & 5 \\ 3 & 1 & 2 \end{array}\right] $ $ \left[\begin{array} {rrr} 1 \\ 6 \\ 2 \end{array}\right] $ ?
$ \left[\begin{array} {rrr} 7 \\ 18 \\ 13 \end{array}\right] $
Lecturer's Note
We map the column of the vector onto each row of the matrix, multiplying each element and summing the result.
$\left[\begin{array} {rrr} a & b \\ c & d \\ e & f \end{array}\right] $ $ \left[\begin{array} {rrr} x& y \end{array}\right] $ = $\left[\begin{array} {rrr} ax + by \\ cx + dy \\ ex + fy \end{array}\right] $
The result is a vector. The number of columns of the matrix must equal the number of rows of the vector.
An m x n matrix multiplied by an n x 1 vector results in an m x 1 vector.
Below is an example of a matrix-vector multiplication. Make sure you understand how the multiplication works. Feel free to try different matrix-vector multiplications.
% Initialize matrix A
A = [1, 2, 3; 4, 5, 6;7, 8, 9]
% Initialize vector v
v = [1; 1; 1]
% Multiply A * v
Av = A * v