When you have two nested loops both running from to , the total operations is ( times), which equals .
But what if the inner loop runs from to ? Then you compute . Using the formula, this equals , which is .
The coefficient changes ( instead of ), but the dominant term is still . This is why checking all pairs in an array takes quadratic time.