OH! The probability

KittyKat7373

New Member
Joined
Aug 25, 2019
Messages
1
So I have a small issue with reading and greatly need help with a problem I am having and trying to get it to proof on my College homework.
I get the actual math behind it but trying to get the right formulas in Excel to work has been a major issue.

So the problem goes like this.

You are playing a game of flipping a coin. You have 10 flips of the coin to get 4 heads in a row.

Then I have to do that 10000 times. Yes. 10000 times, and get the percentile of the probability that you'd win....

College teachers why you do this too me!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
@KittyKat.... Since you "get the actual math", perhaps you can regale us with your knowledge, and tell us how you would calculate the probability mathematically. (BTW, it is not the same as the probability of getting 4 heads in any of the 10 flips.)

Then perhaps we could help you with the Excel formulation.

-----

In any case, I do not think that is what your instructor expects you do in Excel, unless it is also a part of the assignment that you did not state.

Instead, I think your instructor is asking for a simulation (10,000 samples of 10 flips each) that estimates the probability by counting the number of samples that have exactly(?) 4 heads in a row.

(Regarding "exactly": That is my interpretation. It is up to you to decide if "4 heads in a row" means "4 or more heads in a row".)

To that end, you might build a row of 10 formulas of the form =--(RAND()<0.5), which returns 0 or 1.

If one row of formulas is in A1:J1, note that COUNTIF(A1:J1,1)=4 tells you that there are exactly 4 "heads" (1s). However, you would need to do more to determine if the 4 heads are "in a row" (contiguous).

One idea.... Enter the following formula into K1: =CONCATENATE(A1,B1,...,I1,J1). Fill in the ellipses ("..."). In Excel 2016 and later, I believe you can write =CONCAT(A1:J1). Then in L1, use =AND(COUNTIF(A1:J1,1)=4, ISNUMBER(FIND("1111",K1))) to recognize 4 "in a row".

Repeat that row of formulas 10,000 times.

In M1, =COUNTIF(L1:L10000,TRUE) is the number of times we encounter 4 heads in a row. With a VBA macro (or manually), repeat the experiment many times (I did 100). Then the average of values in M1 divided by 10000 should approximate the probability of 4 heads in a row of 10 flips.

Of course, if you know how to calculate the probability mathematically, it would helpful to verify the experimental result.

-----

Forgive me for doing your homework assignment for you, if indeed I did it correctly. It was fun! And it was too difficult to offer "guidance" without being explicit.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,412
Messages
6,119,369
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top