the diagonal function creates arrays for half the square