3

Expected value (mean) tends to confuse me lately.

Let $ \Omega$ be the discrete space of all functions $ \omega:\{1,2,3,\dots,n\} \rightarrow\{1,2,3,\dots,n\}$, $\mbox{Pr}$ is uniformly distributed. Let $f$ be a random variable that counts all fixed points of all functions in $ \Omega $ $$ f(\omega) = |\{i \in \{1,2,3,...,n\}: \omega(i)=i\}$$

Well, I had two ideas which ended the same way. In both of them I defined n indicators $f_1,f_2,f_3...f_n$, such that for each $ 1\leq i\leq n$, return 1 if $f(i)=i$ and 0 otherwise. Than, the expected value is the sum of $ \sum_{i=1}^{n} f_i$

First idea

Looking at index i, the probability to choose i as an image is $Pr(fi=1)= \frac{1}{n}$ then the expected value is $\frac{1}{n}+\frac{1}{n}+\frac{1}{n}...+\frac{1}{n}=\frac{n}{n}=1$

Second idea

For index i there is one option, and for the rest of the indexes are free to be chosen, so $Pr(fi=1) = \frac{1 \cdot n^{n-1}}{n^n}$

Then the expected value is once again the sum, which is $ n \cdot \frac{n^{n-1}}{n^n} = \frac{n}{n}=1 $

Am I on the right track or totally lost?

1 Answers1

0

By way of enrichment let me point out that this can be done using simple combinatorial species as shown at the following MSE link.

Start from the species of labelled trees has the specification $$\mathcal{T} = \mathcal{Z} \times \mathfrak{P}(\mathcal{T})$$ which gives the functional equation $$T(z) = z \exp T(z).$$

We have that $$T(z) = \sum_{n\ge 1} n^{n-1} \frac{z^n}{n!}.$$

To compute the expected number of fixed points note that these random mappings are sets of cycles of trees having combinatorial specification

$$\mathfrak{P} \left(\sum_{q\ge 1} \mathfrak{C}_{=q}(\mathcal{T}(\mathcal{Z}))\right).$$

Now observe that a fixed point is in fact the root of a tree placed in a one-cycle. This gives the marked species

$$\mathfrak{P} \left(\mathcal{U} \mathfrak{C}_{=1}(\mathcal{T}(\mathcal{Z})) + \mathfrak{C}_{\ge 2}(\mathcal{T}(\mathcal{Z}))\right).$$

We get the generating function

$$G(z, u) = \exp\left(u T(z) + \sum_{q\ge 2} \frac{T(z)^q}{q}\right) \\ = \exp\left(u T(z) - T(z) + \sum_{q\ge 1} \frac{T(z)^q}{q}\right) \\ = \exp\left(u T(z) - T(z) + \log\frac{1}{1-T(z)}\right) \\ = \frac{1}{1-T(z)} \exp(uT(z)-T(z)).$$

To get the expectation compute

$$\left. \frac{\partial}{\partial u} G(z, u)\right|_{u=1}$$

which yields

$$\left. \frac{1}{1-T(z)} \exp(uT(z)-T(z)) T(z) \right|_{u=1} = \frac{T(z)}{1-T(z)}.$$

The desired value is then given by

$$n^{-n} \times n! \times [z^n] \frac{T(z)}{1-T(z)} = \frac{n^{-n}\times n!}{2\pi i} \int_{|z|=\epsilon} \frac{1}{z^{n+1}} \frac{T(z)}{1-T(z)} \; dz.$$

Putting $w=T(z)$ we get from the functional equation $w=z\exp(w)$ or $z=w\exp(-w)$ and $dz = (\exp(-w)-w\exp(-w)) dw$ which yields

$$\frac{n^{-n}\times n!}{2\pi i} \int_{|w|=\gamma} \frac{\exp(w(n+1))}{w^{n+1}} \frac{w}{1-w} \exp(-w)(1-w) \; dw \\ = \frac{n^{-n}\times n!}{2\pi i} \int_{|w|=\gamma} \frac{\exp(wn)}{w^{n}} \; dw \\ = n^{-n} \times n! \times \frac{n^{n-1}}{(n-1)!} = n^{-1} \times n = 1.$$

The purpose here was to introduce the species which can be used to extract a variety of additional non-trivial statistics.

Marko Riedel
  • 64,728