Probability of right triangle occurrences in rectangular 0-1 arrays 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).
 A: This is a partial answer to determine the number $R_{m,n} $ of possible right triangles in a $m \times n $ matrix. To get it, it may be simpler to count the possible hypothenuses. Each possible hypothenuse is identified by a pair of element in the matrix with different row and different column. Also, for each hypothenuse, there are two different right triangles. 
The number of hypothenuses in a $m \times n \, $ matrix can be calculated by simply observing that each element of the matrix can be connected by diagonal segments with any of the $(m-1)(n-1) \,$  elements that are on a different row and on a different column. Because there are $mn $ elements in the matrix, and because each diagonal segment connecting two elements $A $ and $B $ can be traced in two directions (from $A $ to $B $ and vice versa), the total number of possible hypothenuses is $$\frac {1}{2} mn (m-1)(n-1) $$ So,  the total number of right triangles in a  $m \times n $ matrix is  
$$R_{m,n}=mn (m-1)(n-1) $$
For $m=n$, this reduces to 
$$R_{n,n}=n^2 (n-1)^2$$
These formulas confirm the trivial result $R_{1,1}=0 \,$ (and more generally $R_{k,1}= R_{1,k}=0 \, \, \,$), and give, for example, $R_{2,2}=4 \, \,$, $R_{3,2}=12 \, \, $, and $R_{3,3}=36 \, \, \,$,  which can be  confirmed by direct counting. Note that these formulas are also in accordance with the result of $600 \,$ triangles for a $5 \times 6 \,$ matrix  reported in one of the comments, because $5 \cdot 6 \cdot 4 \cdot 5=600 \, \, \,$.
