matrix minima method step by step explanation