Each horizontal lines will have 10 matchsticks.
You will have 11 horizontal lines
Therefore you will have 10*11 horizontal matchsticks
Same work with the vertical matchsticks
You will have 11 vertical lines of 10 matchsticks.
therefore you will have 11*10=110 vertical matchsticks.
In total you will have 220=2*11*10
If you have a 20x20 square.
Again you will have 21 horizontal lines of 20 matchsticks and 21 vertical lines of 20 matchsticks. Therefore you have 20*21*2 matchsticks in total.
Now for a nxn square
we have horizontal n+1 horizontal lines of n matchsticks and n+1 vertical lines of n matchsticks. In total we have n*(n+1)*2 matchsticks.
Therefore the formula is 2n(n+1) matchsticks for a n x n square.
It is matches the result for n=10, n=20 and of course n=1 n=2, n=3.