not a maths major, just a programmer unable to solve the following dilemma:
I have an upper triangular matrix of size NxN, so for example with N being 4, a 4x4 matrix with 16 positions such that if made into a list from 1 to 16, it would be:
01 02 03 04
05 06 07 08
09 10 11 12
13 14 15 16
But of course, upper triangle matrices are sparse and a section of the matrix cannot be populated and in this case, excluding the main diagonal such that:
1111
0111
0011
0001
With 0 being invalid positions and 1 being valid positions that can store values. Referring back to the earlier numbering, 1, 2, 3, 4, 6, 7, 8, 11, 12, and 16 are valid while 5, 9, 10, 13, 14, and 15 are not.
My question being, by knowing the value of N, and the pattern such that there is an increasing zero padding every N times, is it possible to derive a formula such that for any position value k, I can see if it is a valid position to hold data or not?
Any help is much appreciated, thanks in advance.
HINT
Easiest way is to number a position using a (row, column) tuple $(r,c)$, and then $A[r][c] = 1$ if and only if $r \le c$.
If you insist on treating $A$ notationally as a one-dimensional array, so the entries go from $A[1] \to A[16]$ as opposed to $A[1][1] \to A[4][4]$, you have to design a formula to convert one into the other -- can you do that?