Counting in rounds
81 players
First round: 81$\div$3 = 27 matches, with 27 winners
27 players
Second round: 27$\div$3 = 9 matches, with 9 winners
9 players
Third round: 9$\div$3 = 3 matches, with 3 winners
3 players
Fourth round: 1 final match
1 player - winner
Total: 27 + 9 + 3 + 1 = 40 matches
Counting the losers
After each match 2 players are knocked out.
At the end of the tournament 80 players will have been knocked out (at a rate of 2 players per match).
This means that we will need 40 matches altogether.