finally solved the matrix puzzle