You're not your job. You're not how much money you have in the bank. You're not the car you drive. You're not the contents of your wallet. You're not your fucking khakis. You're the all-singing, all-dancing crap of the world.

Secondly, consider a group of order (k-1) and its multiplication table. Obviously, no two entries in a given row (column) are equal, other wise we would have a*b = a*c => b = c. Now replace each number in this (k-1)-by-(k-1) table by its matrix representation.
This is what Ryan Pai says.
What I can't figue out is:
1) why he talks of finite fields rather than groups?
2) how does one add the last k-th mark to the row/column?
3) finally, it's not obvious why there should be no rectangles produced.

1) DO NOT TRY BRUTE FORCE testing for rectangles or creating all of them, O(nˆ4) and O(nˆ3) is too much for this algorithm.

2) Look into projective spaces (study about them a little if you need, lot of videos in YouTube). The FANO plane is a projective space of order 2 that is exactly the solution for K=3 (See: http://www.donnadietz.com/PG/ThirdFano.html).

For some of you who have trouble understanding why this works, in a projective space there are no parallel lines, therefore there cannot be a rectangle by default which means:

3) Every 2 lines meet in a single point.

4) Every space has K vanishing points.

5) Take a really long look at the formula for N, the major tip of the problem is there (staring at you).

Btw it is really fun doing the projective spaces by hand once you figure it out.