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.)


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:


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


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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