update matrix exercise