## Matrix-vector multiplication
Given two length-$n$ vectors $\vec v$ and $\vec w$, we define the *scalar product* $\vec v \vec w$ as the value obtained by multiplying each element of $v$ with the corresponding element of $w$ and summing up the products:
$$ \vec v \vec w = \sum_{i=1}^n v_i w_i $$
Given an $m\times n$ matrix $M$ and a length-$n$ vector $\vec v$, we define the *matrix-vector product* $M\vec v$ as the $m$ dimensional vector $\vec w$, whose $i$-th element is the scalar product of the $i$-th row vector of $M$ with the vector $\vec v$:
$$ \vec w = M\vec v \quad\text{means}\quad w_i=\sum_j m_{ij} v_j.$$
For $M\vec v$ to be defined, the number of columns of $M$ must be equal to the length of $\vec v$.