solved purely by analyzing matrix dimensions