third exercise - matrix