Using matrices to manipulate data