How many ways are there to place two rooks on the same column or same row on a nxn chessboard?

2 n n (n-1)/2 = n^3 - n^2, no?

Logic:

Rows and columns are completely independent and identical, so find answer for rows and double it.

There are n rows, completely independent and identical, so find solution for a row and multiple by n.

In a row place the first rook in any of n squares and the second in any of n-1 squares: n (n-1). But you have counted each situation twice, so divide by 2.