# Mean and variance of the number of people seen in a row

I need to calculate mean and variance of the random variable $X$ which can be defined as: let $N$ be number of people in a row. If a higher person stands in front of a lower person in a row, then the lower person is not seen. Let $X$ be the number of people that is seen if you look at the row (you stay in front of it).

I tried to calculate the probability of $k$-th person in a row to be seen by dividing number of variants where this person is seen by the number of all variants. But the expression I got were not very nice. Are there any other ways to solve the problem? Any tips would be highly appreciated!

Edit. I see in this question that the mean of such variable can be found pretty easy. But what about the variance? Since variance of the sum of dependent variables is not equal to sum of variances?

• Are all people of unique height? – Tony Hellmuth Jun 3 '18 at 16:49
• @TonyHellmuth, not necessarily. – makar Jun 3 '18 at 16:50
• Is the heights aren't unique, I think you would have to tells us what they are, or at least their distribution. Anyway, I would try to do this first under the assumption of unique heights -- that looks hard enough to be going on with. – saulspatz Jun 3 '18 at 16:59

The events that person $i$ can been seen and that person $j\gt i$ can be seen are in fact independent: Whether $i$ can be seen only depends on the order of the first $i$ people, not on their heights, whereas whether $j$ can be seen past them depends only on their heights, not on their order. Thus $\mathsf E\left(X_iX_j\right)=\mathsf E\left(X_i\right)\mathsf E\left(X_j\right)$ (with $X_i$ the indicator variable for person $i$ being seen), and thus