M2theK Posted October 24, 2018 Share Posted October 24, 2018 I want to convert a stochastic formula into a proper equation describing the probability of a specific card draw in a card game. Example: A and B are people playing cards. They each have a 52 card deck and four cards in hand. A has an ace, a ten, and 2 fours. If A draws 3 more cards from his deck, and he wants to draw one more ace, what is the probability? That is, there are: 48 cards in the deck (52 card deck, minus the 4 cards in A's hand); 3 target cards (4 aces in the deck, minus the one in A's hand); and 3 cards to be drawn. [1] The original formula: probability=1−((D−T)!−(D−T−H)!)(D!−(D−H)!−1))=17.96%, where: D is the current deck size, T is the number of target cards in the deck, and H is the number of cards to be drawn in the next turn. An attempt to notate a proper equation, see attachment. However, the original equation seems to be notationally incorrect, since the term ((D-T-H)!) can become negative in case of: D = 30, T = 30, H > 0, but factorials are only defined for non-negative integer numbers. Further conditionals are: T > 0; H > 0; D ≥ T, D ≥ H. Question 1: What is the correctly denoted equation to prevent the term ((D-T-H)!) from becoming negative? Any solutions to this problem? Thanks in advance! Source: The equation was derived from a HTML source code provided by Scott Gray (see the full HTML source code at (http://www.unseelie.org/srccgi/ScottsGamingCgi.pdf, p. 2-3). Note: The equation in HTML source code actually works in the above-described case (see also http://www.unseelie.org/cgi-bin/cardco.cgi?deck=30&target=30&hand=3), but is obviously not functional as denoted in [1]. Link to comment Share on other sites More sharing options...
Bignose Posted October 27, 2018 Share Posted October 27, 2018 On 10/24/2018 at 7:13 AM, M2theK said: However, the original equation seems to be notationally incorrect, since the term ((D-T-H)!) can become negative in case of: D = 30, T = 30, H > 0, but factorials are only defined for non-negative integer numbers. Well, sure. The math says something is wrong when you attempt the impossible: to draw more cards from the remaining deck than are in the deck, H > (D - T). Its no different than asking what happens when you try to lift a boulder with infinite mass or try to divide by zero. The fact that the math can't be done indicates that you're asking for something impossible and you need to check that what you've set up the problem to do is correct. Link to comment Share on other sites More sharing options...
M2theK Posted October 27, 2018 Author Share Posted October 27, 2018 I am aware that the equation is incorrect, hence my question: what is the correct equation to calculate the probabilities? Link to comment Share on other sites More sharing options...
mathematic Posted October 27, 2018 Share Posted October 27, 2018 For your case it is 1- (47x46x45)/(48x47x46)=3/48=1/16. Link to comment Share on other sites More sharing options...
M2theK Posted October 28, 2018 Author Share Posted October 28, 2018 19 hours ago, mathematic said: For your case it is 1- (47x46x45)/(48x47x46)=3/48=1/16. 1/16 = 6.25% is the chance when drawing one card, true! But H (number of cards drawn next turn) = 3. Hence, the probability must be larger (~ 17%). According to the HTML source code that uses the equation posted above [1], the probability is 17.95%. Btw: In your example, it also correctly calculates the chance of 6.25% (D=48, T=3, H=1). The problem is that, as @Bignose correctly mentioned, the equation should not work, because the term ((D-T-H)!) gets negative in case of D=30, T=30, H=3. But still, the source code correctly calculates the chance = 100% using the mentioned formula! Hence, I would like to know (1) why this is possible (see source code), and (2) what would be the correct universal equation, independent of the number input for D, T, and H, as long as the pre-conditions as described above are considered (T > 0; H > 0; D ≥ T, D ≥ H)? In other words, I am looking for an equation, where I can put any kind of numbers in, as long as I adhere to the pre-conditions. Link to comment Share on other sites More sharing options...
Bignose Posted October 28, 2018 Share Posted October 28, 2018 (edited) On 10/27/2018 at 11:49 AM, M2theK said: I am aware that the equation is incorrect, hence my question: what is the correct equation to calculate the probabilities? And what I'm saying is that no equation can ever give you something correct if you ask the impossible... There is no correct equation to tell you what the odds are to do something impossible, in your case it is impossible to draw more cards than what are left in the deck. If you are programming this in a system somewhere, you need to check the inputs to limit the calculation only to actually feasible scenarios. If someone asks the impossible, you return an error, or 0, or a message explaining the impossibility, or whatever is appropriate to your system. You're fundamentally asking of the math an question it cannot answer. It is like asking 'how heavy is the color blue?' or 'how many candle lumens in a hogshead?' or 'how do I pay a $100 electricity bill when I only have $15 in my account?' Math is not the solution to impossibilities. Edited October 28, 2018 by Bignose Link to comment Share on other sites More sharing options...
mathematic Posted October 28, 2018 Share Posted October 28, 2018 For your case it is 1- (47x46x45)/(48x47x46)=3/48=1/16. 1/16 = 6.25% is the chance when drawing one card, true![ Wrong! My calculation is for the case when drawing 3 cards, not one. Link to comment Share on other sites More sharing options...
M2theK Posted October 29, 2018 Author Share Posted October 29, 2018 (edited) 18 hours ago, mathematic said: Wrong! My calculation is for the case when drawing 3 cards, not one. When the deck has 48 cards and 3 aces are left, the chance of randomly drawing an ace with one card draw is 3/48 = 1/16 = 6.25%. Why then is the result in both cases (H=1 or 3) identical? I don't understand! There should be a difference in the probability... Edited October 29, 2018 by M2theK Link to comment Share on other sites More sharing options...
mathematic Posted October 29, 2018 Share Posted October 29, 2018 The problem statement is there is one ace left and three cards are drawn, is one of them the ace, so it comes out that way. Link to comment Share on other sites More sharing options...
M2theK Posted October 30, 2018 Author Share Posted October 30, 2018 (edited) On 28/10/2018 at 6:46 PM, Bignose said: And what I'm saying is that no equation can ever give you something correct if you ask the impossible... There is no correct equation to tell you what the odds are to do something impossible, in your case it is impossible to draw more cards than what are left in the deck. If you are programming this in a system somewhere, you need to check the inputs to limit the calculation only to actually feasible scenarios. If someone asks the impossible, you return an error, or 0, or a message explaining the impossibility, or whatever is appropriate to your system. You're fundamentally asking of the math an question it cannot answer. It is like asking 'how heavy is the color blue?' or 'how many candle lumens in a hogshead?' or 'how do I pay a $100 electricity bill when I only have $15 in my account?' Math is not the solution to impossibilities. I am not sure why I am asking the impossible when D=48, T=3, H=3? There must an equation to correctly calculate the probability that can be universalized to whatever value I choose for T and H as long as T > 0; H > 0; D ≥ T, D ≥ H. If I violate these assumptions, no equation can, of course, calculate the impossible. But it's like saying x/y is not legit, because in case of y=0 there is no result. I just would like to know a way to quickly calculate the odds in other legit cases, for example, D=48, T=12, H=5. 9 hours ago, mathematic said: The problem statement is there is one ace left and three cards are drawn, is one of them the ace, so it comes out that way. But I never said there is one ace left in the deck: On 24/10/2018 at 2:13 PM, M2theK said: That is, there are: 48 cards in the deck (52 card deck, minus the 4 cards in A's hand); 3 target cards (4 aces in the deck, minus the one in A's hand); and 3 cards to be drawn. D=48, T=3, H=3 with the aces was just an example. I am more interested in more complicated cases such as D=75, T=14, H=3. Hence may assumptions that there must be a universal way to calculate these probabilities. Edited October 30, 2018 by M2theK Link to comment Share on other sites More sharing options...
mathematic Posted October 30, 2018 Share Posted October 30, 2018 Sorry - I misread the original statement. The correct answer is 1- (45x44x43)/48x47x46)=0.179579093432007. In general it is usually easier to calculate the probability that the desired outcome doesn't happen and subtract from 1. Link to comment Share on other sites More sharing options...
M2theK Posted October 31, 2018 Author Share Posted October 31, 2018 13 hours ago, mathematic said: Sorry - I misread the original statement. The correct answer is 1- (45x44x43)/48x47x46)=0.179579093432007. In general it is usually easier to calculate the probability that the desired outcome doesn't happen and subtract from 1. Thanks @mathematic and no worries. I also figured it out a little bit different, but both ways are redundant, just the notation is a bit different. My lack of knowing binomial coefficients was the problem here, since I didn't understand your approach first, but no its clear. 48 - 3 = 45 # Number of non-aces in the deck ((n),(k)) binomial coefficient (n over k) ((45),(3)) # Number of possibilities to draw no ace (ignoring order!) divided by the total number of ways to draw 3 cards ((48),(3)) is (((45),(3))) / (((48),(3))) # Probability of drawing no ace P = 1 - (((45),(3))) / (((48),(3))) = 17.96% # probability of success The universal equation I was looking for is therefore: P = 1 - (((D-T),(H))) / (((D),(H))) Link to comment Share on other sites More sharing options...
mathematic Posted October 31, 2018 Share Posted October 31, 2018 My approach might be called direct. 45/48 is the probability that the first card is not an ace, 44/47 and 43/46 are the probabilities that the second and third cards are also not aces, so the product of these three terms is the probability that an ace is not drawn. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now