The Matlab code would be:
X = [1,3;2,4]
X =
1 3
2 4
b = [1;2]
b =
1
2
X - b
ans =
0 2
0 2
But would it be correct to express this operation as:
${\bf X - b} =\begin{bmatrix}1&3\\2&4 \end{bmatrix}-\begin{bmatrix}1\\2\end{bmatrix}=\begin{bmatrix}0&2\\0&2\end{bmatrix}$?
In other words, I know that you can do...
$\begin{bmatrix}1&3\\2&4 \end{bmatrix}-\begin{bmatrix}1&1\\2&2\end{bmatrix}=\begin{bmatrix}0&2\\0&2\end{bmatrix}$
but I want to express the operation as $f(\bf X, b)$.
It's interesting that the usual problem is how to code a mathematical expression...
Would any mathematician "compelled" to make sense of the non-defined expression $\begin{bmatrix}1&3\\2&4 \end{bmatrix}-\begin{bmatrix}1\\2\end{bmatrix}$ think first of any other answer than $\begin{bmatrix}0&2\\0&2\end{bmatrix}$? Say, if it was part of a sloppy "back of the envelop" calculation...
It would be great to have some simple operator like:
$\begin{bmatrix}1&3\\2&4 \end{bmatrix}{\bf\color{red}{-\,*}}\begin{bmatrix}1\\2\end{bmatrix}=\begin{bmatrix}0&2\\0&2\end{bmatrix}$
One approach is to find a simple way to represent the conversion of the vector $y=\begin{bmatrix} a \\ b \end{bmatrix}$ to the matrix $Y=\begin{bmatrix} a & a\\ b & b \end{bmatrix}$. But $\begin{bmatrix} a & a\\ b & b\end{bmatrix}=\begin{bmatrix} a \\ b \end{bmatrix}\begin{bmatrix} 1 &1 \end{bmatrix}$ i.e. $Y=y(e_1+e_2)^T$. So subtracting $y$ from each of the columns of a matrix $X$ is probably most simply represented as $X-y(e_1+e_2)^T$. (If the matrix is larger, you'd probably want to instead write $\sum_k e_k^T$.)