Can a matrix be used to achieve this?