Old 01-13-2015, 11:26 PM   #1
ilikexd
Simfile JudgeFFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
Join Date: Apr 2006
Location: Reno, Nevada
Age: 25
Posts: 3,053
Send a message via Skype™ to ilikexd
Default Probability Question

In a standard 52-card deck, what are the odds that out of five cards drawn at random, exactly three will be hearts? exactly four? all five? I think I've gotten the answer but I need to be absolutely 100% certain about it.
ilikexd is offline   Reply With Quote
Old 01-13-2015, 11:37 PM   #2
EzExZeRo7497
Custom User Title
FFR Veteran
 
EzExZeRo7497's Avatar
 
Join Date: Dec 2010
Location: Singapore, SG
Age: 21
Posts: 6,830
Default Re: Probability Question

There are 20 ways (5! / 3!) to have three hearts on the board, 5 ways (5! / 4!) to have 4 hearts on the board, 1 way to have 5 hearts on the board.

P(3 hearts) = (39/52 * 38/51 * 13/50 * 12/49 * 11/48) * 20 = 16.3085%
P(4 hearts) = (39/52 * 13/51 * 12/50 * 11/49 * 10/48) * 5 = 1.07293%
P(5 hearts) = (13/52 * 12/51 * 11/50 * 10/49 * 9/48) = 0.049519807%

Edit: Actually not sure about the three hearts one...

Last edited by EzExZeRo7497; 01-13-2015 at 11:51 PM..
EzExZeRo7497 is offline   Reply With Quote
Old 01-13-2015, 11:54 PM   #3
llyair
Wiki Staff
FFR Wiki StaffFFR Veteran
 
llyair's Avatar
 
Join Date: Jun 2014
Posts: 307
Default Re: Probability Question

I'm getting 10 ways, (5 3) for 5 items in combinations of 3 = (5! / 3!2!)

P(exactly 3 hearts) = 0.08154
llyair is offline   Reply With Quote
Old 01-14-2015, 12:02 AM   #4
Jtehanonymous
Hunger Games Hunty
FFR Veteran
 
Jtehanonymous's Avatar
 
Join Date: Jan 2007
Location: La Florida
Age: 27
Posts: 3,678
Send a message via Skype™ to Jtehanonymous
Default Re: Probability Question

10 ways is correct for 5 choose 3, yeah, so take eze's expression and multiply by 10 instead.

The other two look good.
__________________


I buy all FFR Trading Cards I don't own:
See My FFR TCG Binder





Quote:
Originally Posted by badman7772 View Post
Jtehanonymous

You have completed the Lucky Achievement and will be awarded 25k credits.

seriously what the fuck.
Jtehanonymous is offline   Reply With Quote
Old 01-14-2015, 12:03 AM   #5
EzExZeRo7497
Custom User Title
FFR Veteran
 
EzExZeRo7497's Avatar
 
Join Date: Dec 2010
Location: Singapore, SG
Age: 21
Posts: 6,830
Default Re: Probability Question

Yeah, my mistake. Should be 5C3, 5C4 and 5C5.
EzExZeRo7497 is offline   Reply With Quote
Old 01-14-2015, 12:43 AM   #6
ilikexd
Simfile JudgeFFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
Join Date: Apr 2006
Location: Reno, Nevada
Age: 25
Posts: 3,053
Send a message via Skype™ to ilikexd
Default Re: Probability Question

Thanks everyone.
ilikexd is offline   Reply With Quote
Old 01-14-2015, 04:23 AM   #7
reuben_tate
Kawaii Desu Ne?
Sectional ModeratorFFR Veteran
 
reuben_tate's Avatar
 
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 25
Posts: 4,118
Default Re: Probability Question

Although this problem is already solved, here is an alternative solution which might be helpful for solving future similar problems.

So the probability of getting X hearts in a hand of 5 cards is equal to:

The number of possible hands with X hearts
------------------------------------------
The number of possible hands overall

The number of possible hands is simple, you have 52 cards and you have to pick 5, so there are C(52,5) such possible hands.

Now consider the number of possible hands with X hearts. There are 13 hearts in the deck and 52-13 non-hearts in the deck. Thus, you must pick X hearts from 13 possible hearts and 5-X hearts from the 52-13 non-hearts, i.e., there are C(13,X) ways to pick out the hearts for the hand and C(52-13, 5-X) ways of picking the non-hearts for the hand. So together, there are C(13,X) * C(52-13, 5-x) ways of forming a 5 card hand with X hearts.

So, using the formula above, the probability of getting a hand with X hearts is:

C(13,X) * C(52-13, 5-X)
-----------------------
C(52,5)
__________________
AMA: http://ask.fm/benguino

Happening now! Click to join!



Quote:
Originally Posted by Spenner View Post
(^)> peck peck says the heels
Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
reuben_tate is offline   Reply With Quote
Old 01-14-2015, 06:17 AM   #8
blindreper1179
Vice President Of TGB
FFR Veteran
 
blindreper1179's Avatar
 
Join Date: Jun 2006
Location: repping tha D!
Age: 30
Posts: 5,919
Send a message via AIM to blindreper1179 Send a message via Skype™ to blindreper1179
Default Re: Probability Question

Fucking math nerds. And they said you wouldn't use math outside of school!
__________________
Quote:
Originally Posted by thesunfan View Post
absolutely I want to vomit on your face irl
Quote:
Originally Posted by choof View Post
It was like trying to throw logic at a fuckin brick wall lmao
Quote:
Originally Posted by choof View Post
whats more dense, a black hole or an icyworld file
Quote:
Originally Posted by Celirra View Post
I've never been so disappointed by a man from Alabama than I am right now
Overwatch streaming whenever I'm on(Trying every tuesday night (10pm-12/1am EST) https://www.twitch.tv/blindreper
blindreper1179 is offline   Reply With Quote
Old 01-14-2015, 09:01 AM   #9
Charles Claythorne
FFR Player
 
Charles Claythorne's Avatar
 
Join Date: Apr 2013
Location: New York
Age: 23
Posts: 134
Send a message via Yahoo to Charles Claythorne Send a message via Skype™ to Charles Claythorne
Default Re: Probability Question

you dont need math, you can just simulate 10,000 trials on excel like a pro
__________________
Charles Claythorne is offline   Reply With Quote
Old 01-14-2015, 09:53 AM   #10
grizz13114
FFR Veteran
FFR Veteran
 
grizz13114's Avatar
 
Join Date: Aug 2013
Posts: 215
Default Re: Probability Question

Goddamn Statistics are killing me
grizz13114 is offline   Reply With Quote
Old 01-14-2015, 09:56 AM   #11
rushyrulz
Digital Dancing!
Multiplayer ModeratorEvent StaffFFR Simfile AuthorFFR Music ProducerFFR Veteran
 
rushyrulz's Avatar
 
Join Date: Feb 2006
Location: 68 billion club, NE
Age: 26
Posts: 12,208
Default Re: Probability Question

Quote:
Originally Posted by Charles Claythorne View Post
you dont need math, you can just simulate 10,000 trials on excel like a pro
Why stop at 10,000?

Brute force of 5,000,000 iterations gives the following:
percentage of shuffles that resulted in 3 hearts in the first 5 cards of the deck: 8.1381%
percentage of shuffles that resulted in 4 hearts in the first 5 cards of the deck: 1.0734%
percentage of shuffles that resulted in 5 hearts in the first 5 cards of the deck: 0.0486%
__________________


Last edited by rushyrulz; 01-14-2015 at 10:32 AM..
rushyrulz is offline   Reply With Quote
Old 01-14-2015, 03:04 PM   #12
Charles Claythorne
FFR Player
 
Charles Claythorne's Avatar
 
Join Date: Apr 2013
Location: New York
Age: 23
Posts: 134
Send a message via Yahoo to Charles Claythorne Send a message via Skype™ to Charles Claythorne
Default Re: Probability Question

because i only have 10,000 decks of cards duh

I am also fairly surprised that five million trials is approaching the theoretical probabilities to only two significant digits. Statistics is weird!!!
__________________
Charles Claythorne is offline   Reply With Quote
Old 01-16-2015, 03:06 PM   #13
stargroup100
behanjc & me are <3'ers
FFR Simfile AuthorFFR Music Producer
 
Join Date: Jul 2006
Posts: 2,024
Default Re: Probability Question

Quote:
Originally Posted by Charles Claythorne View Post
I am also fairly surprised that five million trials is approaching the theoretical probabilities to only two significant digits. Statistics is weird!!!
Actually, we can calculate this as well.

Let n be 5000000. Let p be the probability of getting exactly 3 hearts for one draw, or 2717/33320 (as shown already in this thread).

Let z be the 1-a/2 percentile of a standard normal distribution, and a be the error percentile. The confidence interval is

p +/- z sqrt(p(1-p)/n)

For a 50% confidence level, z = 0.674. The confidence interval is between 8.146% and 8.163%.
For a 99% confidence level, z = 2.576. The confidence interval is between 8.123% and 8.186%.

In order for your confidence interval to shrink by a factor of 10 [due to sample size], or become closer to the theoretical value by one more significant digit, the second term needs to differ by a factor of 10. The variable n only appears once, and it is inside the root, so it's quite easy to see that the number of trials needs to be increased about 100-fold. However, it should be noted that this is less accurate for small values of n and probabilities close to 0 and 1. Going backwards we can estimate 50,000 trials is accurate to a few percent, and 500 trials is accurate to a few ten-percent intervals.

This is one of the rough approximations used for finding confidence intervals of binomial distributions. There are more accurate ones, but this one should give you a pretty good idea.



Wrote some javascript code in like 2 minutes for anyone who wants to try:
Code:
<script>
// heartdraw.html
var start = Date.now();

var deck = 52;
var hearts = 13;
var errors = [];


// CHANGE THE FOLLOWING VARIABLES TO CHOOSE HOW MANY TRIALS AND DRAWS PER TRIAL
var trials = 5;
var totaldraws = 50000;


// Test trials
for (var n = 0; n < trials; n++) {
	var success = 0;

	for (var k = 0; k < totaldraws; k++) {
		if (Math.random() < 2717/33320) success++;

		// The below is commented out because it's brute force drawing and slower.
		// However, I kept it in in case anyone wants to try other draws at the cost of not needing to calculate the theoretical probabilties.

		/*var handhearts = 0;
		var decksize = 52;
		var heartsleft = 13;
		for (var i = 0; i < 5; i++) {
			if (Math.random() < heartsleft/decksize) {
				heartsleft--;
				handhearts++;
			}
			decksize--;
		}
		if (handhearts === 3) success++;*/
	}

	// Display trial results
	if (trials <= 20) {				// change the numerical value for display option
		var rate = success/totaldraws;
		var theoretical = 2717/33320;
		var error = (rate/theoretical-1)*100;
		errors.push(error);

		console.log('Out of ' + totaldraws + ' draws, ' + success + ' were successes.');
		if (trials <= 5) {			// change the numerical value for display option
			console.log('Percentage of successful draws: ' + rate);
			console.log('Theoretical success rate: ' + theoretical);
			console.log('Percent error: ' + error);
		}
	}
}

// Check trial cumulative stats
if (trials > 1) {
	var maxerror = errors[0];
	var minerror = errors[0];
	var sum = errors[0];
	for (var n = 1; n < errors.length; n++) {
		if (errors[n] > maxerror) maxerror = errors[n];
		else if (errors[n] < minerror) minerror = errors[n];
		sum = sum + errors[n];
	}
	var mean = sum/errors.length;

	console.log('------------ Trial overall results ------------');
	console.log('Mean trial error (percent): ' + mean);
	console.log('Range of trial errors (percent): ' + minerror + ' to ' + maxerror);
}

console.log('Time elapsed: ' + ((Date.now()-start)/1000) + ' seconds.');

</script>
I also haven't done this stuff in a long ass time so if I made a mistake anywhere someone please correct me on it.
__________________
Rhythm Simulation Guide
Comments, criticism, suggestions, contributions, etc. are all welcome.

Piano Etude Demon Fire sheet music

Last edited by stargroup100; 01-16-2015 at 03:12 PM..
stargroup100 is offline   Reply With Quote
Old 01-16-2015, 03:28 PM   #14
Xtreme2252
Some ******
FFR Veteran
 
Xtreme2252's Avatar
 
Join Date: Mar 2007
Location: Prince Rupert, BC, Canada
Age: 27
Posts: 176
Send a message via AIM to Xtreme2252 Send a message via MSN to Xtreme2252 Send a message via Yahoo to Xtreme2252 Send a message via Skype™ to Xtreme2252
Default Re: Probability Question

I'd ballpark it in the range of like 0%-33% for all of the above. Good enough, right?
Xtreme2252 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 03:58 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution