Thanks for your question. I will assume that you are familiar with
the combinatorial function since you make use of it in your question.
I will follow you in denoting the function with 'C'. Just as a
refresher, the combinatorial function works as follows:
y C x = y! / (x! * (y-x)!)
It's also useful to note that Excel has a combinatorial function. To
get 30 C 6 you would type '=combin(30,6)' into a cell.
OK, enough of the preliminaries...
**Important**: For any lottery type problem in which they ask the
probability of matching exactly x numbers after choosing y from a pool
of n, the formula will be:
(y C x * n-y C y-x) / n C y
So in the example you provide, we want the probability for matching
exactly 4 numbers after choosing 6 from a pool of 30. The resulting
6 C 4 * 24 C 2 / 30 C 6
6 C 4 is equal to 15. This means that there are 15 ways of including
4 of the 6 correct numbers.
24 C 2 is equal to 276. This means that there are 276 ways of
including 2 of the 24 incorrect numbers.
30 C 6 is equal to 593,775. This means that there are 593,775 ways of
arranging the 30 numbers into groups of 6.
Finally, (15 * 276) / 593,775 = .00697. So given that there are 15
ways of arranging 4 correct numbers in a draw of 6 and there are 276
ways of arranging two of the incorrect 24, we multiply 15 by 276.
This gives us all the possible ways in which we can draw 4 correct
numbers and 2 incorrect numbers. We then divide that number by the
total number of possible ways of drawing 6 from 30: 593,775.
The probability of exactly 4 of the 6 numbers drawn from a pool of 30
being correct is .00697.
You might find the following websites helpful:
Info on the combinatorial function:
Info on calculating lottery probabilities:
If anything is unclear, please request clarification prior to
submitting a rating.
Best of luck!