matrix working