Given a grid populated randomly with a subset of numbers, what is the chance that at least one whole row or column contains exactly one unique number? A grid has $c$ columns and $r$ rows. Each cell in the grid is populated with one of $n$ possible numbers. What is the probability that at least one row and/or column contains the same number in all of its cells?
I have attempted to solve this like so, assuming (wrongly, I now believe) that the column matching condition and the row matching condition are independent events:

*

*Chance that a given column in isolation meets the matching condition:
$P_C=(1/n)^r \times n$


*Chance that a given row in isolation meets the matching condition:
$P_R=(1/n)^c \times n$


*Chance that at least one column in the grid meets the matching condition:
$P_{C+}=1-(1-P_C)^c$


*Chance that at least one row in the grid meets the matching condition:
$P_{R+}=1-(1-P_R)^r$


*Chance of any row or column matching (prospective solution):
$1-(1-P_{C+})(1-P_{R+})$
I have programmatically determined the correct solution under multiple conditions:

*

*$c = 2, r = 2, n = 2$: formula says $15/16$ (should be $14/16$)

*$c = 2, r = 3, n = 2$: formula says $119/128$ (should be $29/32$)

*$c = 3, r = 3, n = 2$: formula says $3367/4096$ (should be $205/256$)

*$c = 4, r = 4, n = 2$: formula says $11012415/16777216$ (should be $21331/32768$)

Fascinatingly, the larger the grid is, the smaller the margin of error is.
Where did I go wrong? What should I study to better understand problems like this one?
 A: For $i=1,\dots,c$ let $E_{i}$ denote the event that all numbers
are the same in column $i$.
For $j=1,\dots,r$ let $F_{i}$ denote the event that all numbers
are the same in row $j$.
Then to be found is $P\left(E_{1}\cup\cdots\cup E_{c}\cup F_{1}\cup\cdots\cup F_{r}\right)$.
This can be done with inclusion/exclusion and under the convention
that $P\left(\cap\varnothing\right)=1$ we find:
$$P\left(E_{1}\cup\cdots\cup E_{c}\cup F_{1}\cup\cdots\cup F_{r}\right)=$$$$1-\sum_{i=0}^{c}\sum_{j=0}^{r}\binom{c}{i}\binom{r}{j}\left(-1\right)^{i+j}P\left(E_{1}\cap\cdots\cap E_{i}\cap F_{1}\cap\cdots\cap F_{j}\right)$$
(observe that the term for $i=0=j$ under the summation is $\left(-1\right)^{0}P\left(\cap\varnothing\right)=1$
and that this is compensated by the preceding $1$)
Here: $$P\left(E_{1}\cap\cdots\cap E_{i}\cap F_{1}\cap\cdots\cap F_{j}\right)=n\times n^{ij-ic-jr}$$
so we arrive at probability:
$$1-n\sum_{i=0}^{c}\sum_{j=0}^{r}\binom{c}{i}\binom{r}{j}\left(-1\right)^{i+j}n^{ij-ic-jr}$$
I leave it here now, but later I will have a second look for a sanity check and an effort to simplify the result.
