The standard 52-card deck will represent a database consisting of 4 identical sets each containing a set of 13 integers: Ace=1, 2 to 10 represent respectively the numerical values, J=11, Q=12 and K=13.
Drawing randomly 2 cards you get two numbers, say n1 and n2. Evaluate the absolute value of d=n1-n2.
What is the probability that d will not be equal to 10?
Please solve analytically and use a simulation program to validate your results.
If the first card is an ace (probability 1/13) the probability you'd get an 11 (Jack) is 4/51.
If the first card is a 2 (probability 1/13) the probability the next is a 12 is 4/51,
If the first card is a 3 (probability 1/13) the probability the next is a 13 is 4/51,
If the first card is 4 through 10 (probability 7/13) the difference can't be 10.
First card 11, 12 and 13 mirror the cases of 1 through 3.
The probability that the first will be one of the valid ones to get 10 is 6/13, and they all have probability of 4/51 of finding a number 10 different.
But you want NOT 10 different so it's 1 - (6/13)*(4/51) = 213/221 =~ 0.963800904977376.
fullDeck=repmat([1:13],1,4);
hit=0;
for trial=1:100000000
deck=fullDeck;
r=randi(52);
c1=deck(r);
deck(r)=[];
r=randi(51);
c2=deck(r);
if abs(c2-c1)~=10
hit=hit+1;
end
end
disp([hit trial hit/trial])
>> tensNotWelcomed
96378653 / 100000000 = 0.96378653
agrees with the calculated value, considering the number of trials.
|
Posted by Charlie
on 2023-08-30 10:00:27 |