The question is, when is the following true:
1/2 n2 < 20 n
Multiply both sides by 2 to get
n2 < 40n
then divide by n (we can do that without worrying about possibly having to flip the <, because we know that n has to be positive), to get
n < 40
To verify, check the n = 39 case,
1/2 n2 = 1/2 × 392 = 760.5
20 n = 20 × 39 = 780
and the n = 41 case,
1/2 n2 = 1/2 × 412 = 840.5
20 n = 20 × 41 = 820
Remember, n is a positive integer. (A dataset cannot have a fractional number of entries, can it? No, n has to be a natural number.)
The fact that they happen to be equal at n = 40,
1/2 n2 = 1/2 × 402 = 800
20 n = 20 × 40 = 800
just means that the two algorithms need equal number of operations at n = 40.