performing secondary operatons on matrices