multiplying matrices with different dimensions