Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have an array that looks something like this:

$a = [0.01, 0.01, 0.50, 0.03, 0.20, 0.10, 0.15]$

This is just an example, but it shows that $sum(a) = 1$. Each number in the array represents the probability of choosing that item.

How do I calculate the probability of choosing the same item twice (or more generally, $n$ times in a row)? Choosing the first item ($0.01$) and the second item ($0.01$) counts as choosing two different items, i.e. only the index in the array matters.

(Sorry for any obvious mistakes, this is my first question here.)

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Say your vector of probabilities is $a_1,\ldots,a_n$. Then the probability of picking the $i$th item on the first pick is $a_i$, and the probability of picking it on the second pick is also $a_i$, so the probability of picking the $i$th item twice is $a_i^2$.

Then picking the same item twice in two picks is the sum of this for each possible item:

$$\sum_{i=1}^n{a_i^2}$$

and the chance of picking the same item $k$ times in $k$ picks is:

$$\sum_{i=1}^n{a_i^k}$$

(Unless I completely misunderstood your question, you did not make any obvious mistakes.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.