I want to write the operation of vectorizing or flattening a matrix into a vector, by using matrix multiplication.
If I have an MxN matrix X, I want to turn it into a column vector y that is MN x 1.
I should be able to do this as a matrix multiplication as follows:
$y=AXb$, where A is an MN x M matrix, X is MxN, and b is Nx1.
stewbasic is right although his argument is not clear. Assume that we want to stack the matrix $X$ row by row; then $f:X\in M_{p,q}\rightarrow vect(X)\in K^{pq}$ is a linear isomorphism and, in fact, a tensor; in general a tensor is not decomposable, that is, there does not exist $A\in M_{pq,p},b\in K^q$ s.t. $f=A\otimes b^T$; indeed $rank(f)$ would be equal to $rank(A)rank(b)\leq p$. Yet, always $f$ can be written as a sum of decomposable: $f=\sum_{i=1}^r A_i\otimes b_i^T$. Since $rank(f)=pq$, necessarily $r\geq q$ but we can do $r=q$.
Example. Assume that $p=q=2$. Then $f=\begin{pmatrix}1&0\\0&0\\0&1\\0&0\end{pmatrix}\otimes [1,0]+\begin{pmatrix}0&0\\1&0\\0&0\\0&1\end{pmatrix}\otimes [0,1]$.