the total number of games in the league with t matches is 1 + 2 + ... + t-1 = 1 + (t-1) * (t-1)/2 = t*(t-1)/2 = (t^2 - t)/2.

you forgot the parenthesis around t^2 - t... N is the amount of games and t is the amount of teams.

in the case of 9 teams N = (9^2 - 9)/2 = (81 - 9)/2 = 72/2 = 36.