Google Answers Logo
View Question
 
Q: Probability of 3-digit numbers ( Answered 5 out of 5 stars,   2 Comments )
Question  
Subject: Probability of 3-digit numbers
Category: Science > Math
Asked by: davidj-ga
List Price: $6.00
Posted: 08 Feb 2004 15:43 PST
Expires: 09 Mar 2004 15:43 PST
Question ID: 304812
I need to know the probability of any 3-digit number randomly matching
with an established 3-digit number outcome.

I'll explain:
If any number in the random sequence matches any number in the outcome
sequence, but NOT in the same placeholder spot, it gets an X score.

If a number in the random sequence matches a number in the outcome
sequence IN THE SAME placeholder spot, it gets a P score.

Examples:

Random  Outcome  Score
130     242    - - -
829     950    X - -
340     741    P - -
973     396    X X -
542     522    P P -
014     401    X X X
952     259    P X X
179     190    P X -
568     568    P P P

I need the probability (listed like .3566 or .1000) for all possible
scoring options (10 i think!), which would be:
- - -
X - -
X X -
X X X
P - -
P X -
P X X
P P - 
P P X
P P P

Please provide the formula or method used to calculate these. Thank you!

Request for Question Clarification by mathtalk-ga on 08 Feb 2004 16:58 PST
Hi, davidj-ga:

These probabilities actually depend on the number of repeated digits
in the "established 3-digit number outcome".

In other words the probability of the various X & P combinations is
different when the number of repeated digits allowed in the outcome
changes.

I notice that some of your outcomes have these and some do not.  One
can "integerate over" these variations if a distribution for the
outcomes is assumed.  For example, one might assume that all 3-digit
outcomes are equally likely, just as presumably you mean for all
"random" 3-digit numbers to be considered equally likely.

regards, mathtalk-ga

Clarification of Question by davidj-ga on 08 Feb 2004 17:53 PST
Hi,

All these calculations are just for ONE guess (one random number) for
ONE outcome only.

Like right now, if you guessed "427" and the actual answer was "734",
then what was the probability that you got that score of X X - ? In
other words, what were the chances of you selecting 2 out of those 3
numbers right, but both are in the wrong placeholder.

Hope that helps. Thanks.

Clarification of Question by davidj-ga on 08 Feb 2004 17:54 PST
To clarify also:

The random guess CANNOT have repeating digits. 
The actual outcome CAN have repeating digits.

Clarification of Question by davidj-ga on 08 Feb 2004 17:58 PST
Hi mathtalk,

For the question purposes, you are right, we *can* assume that all
3-digit outcomes are equally likely, and can integrate over these
variations. That would be find to assume that distribution for
calculation purposes. Thanks.
Answer  
Subject: Re: Probability of 3-digit numbers
Answered By: mathtalk-ga on 08 Feb 2004 21:00 PST
Rated:5 out of 5 stars
 
Hi, davidj-ga:

The simplest approach (to my devious mind) is to turn the problem upside down.

Since you've agreed to treat all the "outcomes" as having a uniform
distribution, and to find the expected probability of each "random
guess" giving certain results (subject to the restriction that the
random guess has no repeats), it makes sense to treat the "random
guess" as if it were any fixed 3-digit number without repetition and
do the probabilities based on the "random selection" of the outcome.

Specifically let the "guess" be 123 (or any other three-digit number
with distinct digits).  Then the "outcome" has three digits that are
randomly and independently selected (allowing in particular repeats to
occur with natural frequencies).

For each digit of the outcome, there is a 0.1 chance of getting a P, a
0.2 chance of getting an X, and a 0.7 chance of getting a _. 
Combining the results is now a simple "multinomial" probability, to
wit:

Pr( - - - ) =            (0.7)^3  = 0.343
Pr( X - - ) = 3 * (0.2) * (0.7)^2 = 0.294
Pr( X X - ) = 3 * (0.2)^2 * (0.7) = 0.084
Pr( X X X ) =     (0.2)^3         = 0.008
Pr( P - - ) = 3 * (0.1) * (0.7)^2 = 0.147
Pr( P X - ) = 6 * (0.1)(0.2)(0.7) = 0.084
Pr( P X X ) = 3 * (0.1) * (0.2)^2 = 0.012
Pr( P P - ) = 3 * (0.1)^2 * (0.7) = 0.021
Pr( P P X ) = 3 * (0.1)^2 * (0.2) = 0.006
Pr( P P P ) = (0.1)^3             = 0.001
                                   ------
                                    1.000

The fact that these all add up to probability 1 suggests that at the
least we have likely not made any arithmetic errors!  But have we
understood the problem correctly?  Here's a way to remember how a
multinomial calculation works.

The three digits of the outcome each provide a P, an X, or _, and
their selection is by independent, identical uniform distributions of
digits (1 in 10).  Therefore for each single digit of the outcome:

p = Pr( P ) = 0.1
x = Pr( X ) = 0.2
t = Pr( _ ) = 0.7

and these single digit "outcomes" are mutually exclusive and encompassing, so:

p + x + t = 1.0

The three digits of outcome are then a repeated series of trials for
these one digit probabilities, a fancy name for which is "Bernoulli
process".  In any case it clearly also holds that:

(p + x + t)^3 = 1.0

and this is one reason we refer to the calculation as "multinomial". 
Expanding the left hand side above gives us terms with factor p^i *
x^j * t^k, where the exponents i + j + k add up to 3.  Much like a
binomial expansion, we can express the formula's constant coefficients
in terms of factorials:

(p + x + t)^3 = SUM (3!/(i! j! k!)) p^i x^j t^k

where the sum is over all possible ways for nonnegative exponents
i,j,k to add up to 3.

Basically the "multinomial" coefficient 3!/(i! j! k!) simply counts
the number of arrangements in which P can occur i times, X can occur j
times, and _ can occur k times.  Here the permutations can done
mentally, as if all the symbols are the same there is only 1
arrangement, if all are different there are 6 arrangements
(permutations of three distinct things = 3!), and otherwise there are
3 possible arrangements (because we have two symbols alike and one
distinct).

Please let me know whether this "devious" approach to computing the
various probabilities is convincing or not.  If it does not convince
you, then I will break it down from the other side, i.e. what if all
the outcome digits are distinct, what if two are alike and one is
different, what if all three are the same.  That way will give the
same answers but it necessarily involves a number of "sub-cases".

regards, mathtalk-ga

Request for Answer Clarification by davidj-ga on 09 Feb 2004 07:47 PST
Thank you for the detailed "devious" answer. That makes sense to me -
however, as you offer, I would appreciate seeing the results from the
"sub-classes" as well. Thanks!

Clarification of Answer by mathtalk-ga on 09 Feb 2004 17:11 PST
Hi, davidj-ga:

Glad to oblige, but let me ask you to clarify a point about scoring
involving repetitions in the "outcome".  You listed as one of the
examples:

Guess Outcome  Score
 542    522    P P -

Clearly the first digit 5 counts for a P, but I could see either
counting the third digit 2 as one correct guess (giving it P) or as
two correct guesses (both as a P and as an X) by virtue of the
repetition.

What rule do you intend in these cases?  To take an extreme example,
suppose the outcome had three of the same digit and the guess includes
that digit.  Would that count as P _ _ or as P X X ?

thanks, mathtalk-ga

Clarification of Answer by mathtalk-ga on 09 Feb 2004 22:30 PST
In the interest of expediency and completeness, having seen your new
Question, let me go ahead and provide further breakdowns here.

First the framework.  There are three "outcome" types we distinguish:

A := all three digits of outcome number are different

B := two digits of the outcome number are the same, one different

C := all three digits of outcome number are the same

A priori the chances of these (mutually exclusive) outcomes are:

Pr( A ) = (10*9*8)/1000 = 0.720

Pr( B ) = (10*9*3)/1000 = 0.270

Pr( C ) = 10/1000       = 0.010

For example, in A one has 10 choices for the first digit, 9 for the
second digit, and 8 for the third digit (as they must all be
distinct).  In B we can choose the "doubled" digit 10 ways, the
"single" digit 9 ways, and the position of the single digit (out of
three) in 3 ways.  Finally for C we can choose a tripled digit in 10
ways.  Of course these choices added up to the "universe" of 1000
three-digit numbers.

As before there are "on paper" ten different possible scores, but
depending on the type of outcome and the rule for scoring with matched
repetitions, some of these scores are impossible.  E.g. your
observation in the other thread that if each guess digit contributes
at most once to the score, then PPX would not be possible.

So let's breakout "conditional probabilities" first for that scoring
rule, ie. each digit of the guess counts at most once:

 - as P if it matches the outcome digit in the same position

 - as X if it matches an outcome digit but not the one in its position

 - as _ if it does not match any outcome digit

We then have the following table of conditional probabilities for
combined scores, where outcome event O is one of A,B,C as displayed in
these columns:

                    O = A     O = B    O = C

Pr( _ _ _ | O )    210/720   336/720  504/720

Pr( X _ _ | O )    252/720   168/720     0

Pr( X X _ | O )     63/720    16/720     0

Pr( X X X | O )      2/720      0        0

Pr( P _ _ | O )    126/720   168/720  216/720

Pr( P X _ | O )     42/720    16/720     0

Pr( P X X | O )      3/720      0        0

Pr( P P _ | O )     21/720    16/720     0

Pr( P P X | O )       0         0        0

Pr( P P P | O )      1/720      0        0

A quick check on our arithmetic is to verify that each column adds to
1, and I've done that.  It is worthwhile going through the computation
of each entry in detail, but first let's apply the results above,
using the definition of conditional probability, to find the absolute
probability of each score.

This formula is:

Pr( Score ) = Pr( Score | A ) * Pr( A )
            + Pr( Score | B ) * Pr( B )
            + Pr( Score | C ) * Pr( C )

because the events A,B,C "partition" the possible outcomes.

Plugging in the values for Pr( A ), Pr( B ), Pr( C ) obtained earlier:

Pr( _ _ _ ) = 0.210 + 0.126 + 0.007 = 0.343

Pr( X _ _ ) = 0.252 + 0.063 + 0.000 = 0.315

Pr( X X _ ) = 0.063 + 0.006 + 0.000 = 0.069

Pr( X X X ) = 0.002 + 0.000 + 0.000 = 0.002

Pr( P _ _ ) = 0.126 + 0.063 + 0.003 = 0.192

Pr( P X _ ) = 0.042 + 0.006 + 0.000 = 0.048

Pr( P X X ) = 0.003 + 0.000 + 0.000 = 0.003

Pr( P P _ ) = 0.021 + 0.006 + 0.000 = 0.027

Pr( P P X ) = 0.000 + 0.000 + 0.000 = 0.000

Pr( P P P ) = 0.001 + 0.000 + 0.000 = 0.001
                                     ------
                                      1.000

Now let's go through the columns of conditional probabilities in
detail.  In each case the "universe" of possibilities is the choice of
three distinct digits for the "guess", so we wind up with a common
denominator of:

10 * 9 * 8 = 720

that I did not try to reduce, knowing that the decimal answers would
work out cleanly in the end.

Let's go through the first column, conditional on A, having all three
digits of the outcome distinct, esp. since this part of calculation is
valid for either scoring rule:

Pr( _ _ _ | A ) = (7 * 6 * 5)/720 since we have 7 choices for the
first digit of the guess, to avoid all three digits of the outcome,
then 6 choices for the second digit (since it must also differ from
the first digit of the guess), times 5 choices for the final digit of
the guess.

Pr( X _ _ | A ) = (3*2*7*6)/720 because we can pick which of the
outcome digits to match in 3 ways, and the position in which to put
that digit in 2 ways, times 7 ways to pick the next digit of the guess
and 6 ways to pick the final digit of the guess (to avoid repetition
and further matches).

Pr( X X _ | A ) = (3 * 3 * 7)/720 since we have 3 choices for which
digit of the outcome will not be matched, times 3 positions for the
digit of the guess that does not match anything, times 7 choices for
the value of that unmatching guess digit (the positions of the
matching guess digits are then forced to avoid a "position" match).

Pr( X X X | A ) = 2/720 because all three outcome digits are matched
but none in its own position; there are only 2 such "derangements"
(rotate the three digits once to the left or once to the right).

Pr( P _ _ | A ) = (3 * 7 * 6)/720 since there are 3 choices for the
position match and then 7 * 6 ways to choose the remaining unmatched
guess digits.

Pr( P X _ | A ) = (3 * 2 * 7)/720 since there are 3 choices for the
position match, times 2 choices for other "non-position" match, times
7 choices for the remaining unmatching guess digit.

Pr( P P _ | A ) = (3 * 7)/720 because we can choose the unmatching
position in 3 ways and unmatching guess digit in that position in 7
ways.

Pr( P P X | A ) = 0 because as you pointed out, it's not possible to
have an "out of position" match if the other two positions do match
(assuming the three guess digits are all distinct).

Pr( P P P | A ) = 1/720 because there is only one choice for each position.

Next we consider the conditional probabilities given B, having two
digits in the outcome which are equal and a third digit which is
distinct.

Pr( _ _ _ | B ) = (8 * 7 * 6)/720 since it is only necessary to avoid
the two digits that appear in the outcome.

Pr( X _ _ | B ) = (3 * 8 * 7)/720 since we have 3 choices for the
location of the (non-positional) match, times 8 * 7 ways to fill the
other two guess digits without matching the outcome (if the location
of the non-positional match is chosen, the value for that guess digit
is forced).

Pr( X X _ | B ) = (2 * 8)/720 because we have a choice of 2 locations
(the positions of the equal outcome digits) for our unmatched guess
digit, times 8 possible values for that guess digit (the other two
guess digits are forced).

Pr( X X X | B ) = 0 because we can't have three matches with only two
distinct digits in the outcome.

Pr( P _ _ | B ) = (3 * 8 * 7)/720 since again we can choose the
position of the (positional) match in 3 ways, times 8 * 7 ways to fill
the other two guess digits without matching (all the values except the
two that appear in the outcome are available to choose from).

Pr( P X _ | B ) = (2 * 8)/720 because we must choose one of the 2
locations in which the outcome digits are equal to put a positional
match (we cannot have a non-positional match there if the outcome's
"odd" digit has a positional match) and then we have 8 choices for the
unmatched guess digit in the other one of those locations (the value
for the guess digit in the outcome's "odd" digit position is forced).

Pr( P X X | B ) = 0 because again it's not possible to have three matches.

Pr( P P _ | B ) = (2 * 8)/720 because one of the 2 locations where the
outcome has equal digits must be unmatched (we cannot match both as
the guess digits are distinct) and that position can be filled 8 ways.

Pr( P P X | B ) = 0 because three matches are not possible.

Pr( P P P | B ) = 0 because three matches are not possible.

To complete these conditional probabilities it remains only to
consider the outcomes C in which all three digits are equal.  One
quickly sees that under the scoring rules considered here, either
there are no matches or there is exactly one match and that one is
positional:

Pr( _ _ _ | C ) = (9 * 8 * 7)/720 since there are 9 choices for the
first guess digit (that avoid the triple digit in the outcome), 8
choices for the second guess digit, and 7 choices for the third one.

Pr( P _ _ | C ) = (3 * 9 * 8)/720 since there are 3 positions for the
matching digit (which necessarily matches also in position) and 9 * 8
choices for the remaining unmatched digits.

All the other conditional probabilities involving outcomes C are zero,
as it is not possible to have two matches or to have a match that does
not agree in position.

This completes the calculation of the scoring probabilities with the
interpretation that you evidently intended (at most one "score" per
each digit of the guess).  To see that the numbers I originally
provided are consistent with this interpretation of scoring:

 - a P for each guess digit matching an outcome digit in its position, and
 
 - an X for each guess digit matching an outcome digit not in its position

we need only revise the conditional probabilities in the columns for B
and C, because the scoring changes only affect outcomes with
repetitions.

For the column under B the basic differences are that any positional
match associated with a repeated digit gives and X as well as a P, and
also opens up a number of ways to obtain three X's (which was not
possible given B under the scoring system you intended).

For the column under C there are still only two possible scores, but
these are now "_ _ _" and "P X X" because a positional match in the
latter case also draws in two nonpositional matches.

If there is interest I can supply the gory details, but the final
numbers would revert to those I originally posted.

Sorry for the confusion.

regards, mathtalk-ga
davidj-ga rated this answer:5 out of 5 stars and gave an additional tip of: $3.00
Excellent description and summary!

Comments  
Subject: Re: Probability of 3-digit numbers
From: aht-ga on 08 Feb 2004 17:36 PST
 
davidj-ga:

The first thing I thought of, when I saw your question, is the 'Daily
3' lottery held in many parts of the world including my own home
province:

http://www.bclotteries.ca/cm/daily3/howtoplay.htm

So, here are some of the results you are looking for... I'll leave it
up to our resident math guru, mathtalk-ga, to show you the
methodology!

Regards,

aht-ga
Google Answers Researcher
Subject: Mastermind variant
From: ulu-ga on 08 Feb 2004 18:32 PST
 
This reminded me of the first step in a game of Mastermind with 10
colors and 3 pegs.

http://www.maa.org/editorial/knot/Mastermind.html

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy