Suppose I need to evaluate the expression $\begin{bmatrix} 0 & 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} s+2 & -1 & 0 & 0\\ 0 & s+3 & 0 & 0\\ -1 & -2 & s & -1\\ 2 & -1 & 1 & 4 \end{bmatrix}^{-1} \begin{bmatrix} 0\\ 1\\ 1\\ 1 \end{bmatrix} $ If I compute the inverse of the $4 \times 4$ matrix first, then perform the matrix-vector multiplication, I'm left with the result $ \displaystyle \frac{1}{s+3}$ If instead I perform the matrix-vector multiplication first, keeping in mind that I need to compute the inverse of whatever I'm left with, I get $(s+3)^{-1} = \displaystyle \frac{1}{s+3}$
My question is this: is it safe to assume that I can always perform the matrix-vector multiplication first and then compute the inverse of the resulting scalar (assuming, of course, that the result is invertible) or did I just happen to get lucky in this case?