Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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|cite|improve this question
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:


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

share|cite|improve this answer

Your Answer


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.