Uniform and Independent Probability (Simple Problem)

#1
Hey there,

I have a quick question.

The problem:
3 numbers, say X, Y, and Z are chosen from a set of numbers (1 to n) where n is greater or equal to 1, in a uniform and independent manner.

Question 1
What's the chance that all these three numbers take on the same value, i.e. X=Y=Z?
My intuition
Let v equal to some value in the set (1 to n)
Let P (X = v) be the probability X equals v
Let P (Y = v) be the probability Y equals v
Let P (Z = v) be the probability Z equals v
P (X = Y = Z) = P (X = v) * P (Y = v) * P (Z = v)
P (X = Y = Z) = (1/n) * (1/n) * (1/n)
P (X = Y = Z) = (1/n)^3

Question 2
What's the chance that all these three numbers take on different values?
My intuition
Let v1, v2, v3 be values in the set (1 to n), such that v1 != v2 != v3
Let P (X = v1) be the probability X equals v1
Let P (Y = v2) be the probability Y equals v2
Let P (Z = v3) be the probability Z equals v3
P (X != Y != Z) = P (X = v1) * P (Y = v2) * P (Z = v3)
P (X != Y != Z) = (1/n) * (1 - (1/n)) * (1 - (1/n)^2)

Question 3
What's the expected number of different values?
My intuition
Let N be the number of different values X, Y, Z can take
Range of N = (1, 2,..., n)
E[N] = [N * P (X = v1)] + [(N - 1) * P (Y = v2)] + [(N - 2) * P (Z = v3)]

I'm not quite sure of the 2nd and 3rd, but I'm hoping that I'm not that far off.
Any help would be really appreciated.
Thanks a lot.
 

Dason

Ambassador to the humans
#2
For question 1 you wrote:
P (X = Y = Z) = P (X = v) * P (Y = v) * P (Z = v)

which isn't true. The right side implies that X = Y = Z = v but the left hand side has nothing about v. You'll need to correct for this.
 

BGM

TS Contributor
#3
P (X = Y = Z) = P (X = v) * P (Y = v) * P (Z = v)
This is not correct. Note that
\( \Pr\{X = Y = Z = v\} = \Pr\{X = v, Y = v, Z = v\} \) \( = \Pr\{X = v\}\Pr\{Y = v\}\Pr\{Z = v\} \)
To evaluate the required probability, use law of total probabilities:
\( \Pr\{X = Y = Z\} = \sum_{v=1}^n \Pr\{X = Y = Z|X = v\}\Pr\{X = v\} \)
Intuitively speaking, you can imagine you drawing one of the \( X, Y, Z \) first. Then require the latter two taking the same value. Since it is uniform it is equivalent to two of them taking a specific value.

Question 2 can use the similar technique if you understand question 1. So let you think about it first.

For question 3, note that the number of different values that \( X, Y, Z \) can take can only be 1, 2, 3 respectively, i.e. the support of \( N \)
In question 1,2 you have calculated \( \Pr\{N = 1\} \) and \( \Pr\{N = 3\} \) respectively.
 
#4
Intuitively speaking, you can imagine you drawing one of the \( X, Y, Z \) first. Then require the latter two taking the same value. Since it is uniform it is equivalent to two of them taking a specific value.
I see. I'm not sure if I understand this correctly..

Lets say I have:

Set \( S = \{1,2,3\} \)
\( Pr\{X=1\} = \frac{1}{3} \)
\( \frac{3!}{[(3-3)! * 3!]} \) combinations of selecting 3 numbers from S
\(
Pr\{X = Y = Z = 1\} = \frac{3!}{[(3-3)! * 3!]} * (\frac{1}{3})^3 * (1 - \frac{1}{3} )^{(3-3)}
\)

The will equal 11.12% I think does that seem right?
 

BGM

TS Contributor
#5
Yes but that will complicate the matter. You consider the numbers of random variables getting a specific number in which you can use the Binomial distribution. Thats correct. But more simply is just use the independent assumption which shown above.
 
#6
If I change the notation to:

Let \( A, B, C \) be the three variables chosen independently and uniformly from the set of integers \( S = \{1,..,n\} \)

Let \(X\) be a random variable of the number of different values \(A, B, C\) could take

so
\( X = 1 \) if all variables take the same value
\( X = 2 \) if only 2 variables take the same value
\( X = 3 \) if none of the variables take the same value

\( \Pr\{\)any value\(\} = \frac{1}{n} \) meaning any value is equally likely.

\( \sum_{i=1}^{n}\frac{1}{n} * \Pr\{X_i = 1\} \)

\( \sum_{i=1}^{n}\frac{1}{n} *\frac{1}{3!} \)

But I can't really work out the probability that all three variables are the equal i.e.\( \Pr\{X_i = 1\}\) but I know that there are \(3!=6\) permutations
 

BGM

TS Contributor
#7
I assuming you are focus on part c) now.

The first half is good. Very clear formulation.

However,

\( \sum_{i=1}^{n}\frac{1}{n} * \Pr\{X_i = 1\} \)
is wrong (actually I do not know why you think like this). The expectation is

\( 1 \times \Pr\{X = 1\} + 2 \times \Pr\{X = 2\} + 3 \times \Pr\{X = 3\} \)

where \( \Pr\{X = 1\} \) is calculated in the 1st question, and

\( \Pr\{X = 3\} \) is calculated in the 2nd question.

And both of these calculations can be very simple without using the permutation coefficients.
 
#8
Oh oops I think I was counting A, B, C as a set of 3 numbers itself and then computing their permutations.

Then I think
\( \Pr\{X = 1\} = 3 \times \Pr\{\)any value\(\} = 3 \times \frac{1}{n} \)

and

\( \Pr\{X = 3\} = \frac{1}{n}\times\frac{1}{n-1}\times\frac{1}{n-2}\times...\times1 = \frac{1}{n!}\)