Say I have an $M\times N$ matrix where each element is equally likely to be $0$ or $1$.
For an $M\times N$ matrix $A$, I'm interested in the probability of right triangle occurrences.
By right triangle, I mean: treat the $1's$ in the matrix as vertices of triangles. Then a right triangle is an arrangement that forms a right triangle orthogonal to the axes, i.e. one side is horizontal, one side is vertical, and the hypotenuse is diagonal. Or more specifically, define a right triangle as a set of three "1's" elements such that 2 of the elements share a row and 2 of the elements share a column. E.g. in the following $5\times 6$ array:
0 0 1 0 1 0
0 1 0 0 0 0
1 0 0 1 0 1
0 0 1 0 0 0
0 0 0 0 0 0
There is only $1$ right triangle. It is the triangle with vertices at: $(0,2)$ is the apex, $(3,2)$ is the lower left, $(0,4)$ is the upper right, where I'm indexing from $0$, starting at the top left.
Ideally I would like to have an expression for the distribution of the number of triangles, $K$, in an arbitrary $M \times N$ array, i.e. $K~F(M,N)$. However, I expect this might be difficult, so I'll allow 2 simplifications if necessary:
1) can just be square matrix $N \times N$
2) can be the probability of 1 or more right triangle occurrences instead of the distribution for $K$. So just 1 - P(no right triangles).