Skip to main content
2 of 5
added 35 characters in body
user avatar
user avatar

Let $x _i $ be a random variable. $x_i = 1$ means requires element is in ith position. Now probability that required element is in position between $1$ and $n$ is $$ Pr[x_i = 1] = \frac{1}{n} $$ Now Expected value is given by $$E(x) = 1 \times\frac{1}{n} + 2 \times \frac{1}{n} + 3 \times \frac{1}{n} +\cdots + n \times\frac{1}{n} $$ which can be written as $$ \frac{n(n+1)}{2n} = \frac{(n+1)}{2}$$ which is a required answer

user35837