Play
Multi-Player
Coins
Community
Settings
Help
Community   Maps   Forum   Mail   Ladders   Clans   Recent Games
Sign In | Sign Up
<< Back to Off-topic Forum   

Posts 1 - 6 of 6   
Help with some tricky maths: 12/8/2015 11:49:01


Thomas 633
Level 56
Report
I was curious to work out something (how unlucky I am at sports), so I tried to calculate it, but had no luck.

In sports day there are four teams. In ten attempts, I've won once (the average is 2.5). What are the odds of winning once in ten attempts with a 1/4 chance of winning?

(I'm in tenth grade, so please make relatively simple).
Help with some tricky maths: 12/8/2015 12:02:30


kynte
Level 51
Report
You've just stumbled into combinatorics!

Basically, first let's think of this as an ordered problem:

What are the odds that you'll lose 9 games in a row and then win the 10th one?

That's pretty straightforward- that's P(loss) ** 9 * P(win) ** 1 = (1 - .25) ** 9 * (.25), or ~1.9%

Now let's take out the ordering- how do we do that?

Well, think of all the possible combinations for 9 losses and a win:

LLLLLLLLLW
LLLLLLLLWL
LLLLLLLWLL
LLLLLLWLLL
LLLLLWLLLL
LLLLWLLLLL
LLLWLLLLLL
LLWLLLLLLL
LWLLLLLLLL
WLLLLLLLLL

Can we calculate each of them the same way?

Well, the first one's the old one- P(loss) ** 9 * P(win) ** 1

Then you have- P(loss) ** 8 * P(win) ** 1 * P(loss) ** 1... which is also P(loss) ** 9 * P(win) ** 1

Since you can move around the P(loss) terms and they'll always just be P(loss) ** 9, you could just do the original calculation 10 times- i.e., multiply the original result by 10 because all you're doing is moving the loss around.


Which comes out to about 18.77%, assuming that each team has an equal chance (25%) of winning going into a game. Means you're probability pretty unlucky, but (as you'll learn later when you study statistics) not significantly so- you'll get these results 1 in about every 5 times (across trials of 10 games each) in fair playing conditions.

If you're interested in reading more about this (especially about extending this to cases where you, say, have 2 or 3 or even 4 losses and the ordering gets more complicated, I recommend looking up permutations and combinations- permutations are more relevant here since we're dealing with ordering).

Specificially, look at the stuff about rearranging words (and hit me up if you're having trouble grasping what a factorial is)- how is figuring out the number of possible orderings for, say, 7 wins and 3 losses just like figuring out how many ways you can rearrange the letters in the word "VITRIOL" and still be able to tell them apart visually (basically, how do you deal with the fact that there are two "I"'s?)?

Edited 12/8/2015 12:06:21
Help with some tricky maths: 12/8/2015 12:05:20


Thomas 633
Level 56
Report
thanks.
Help with some tricky maths: 12/8/2015 13:31:27


Bane 
Level 59
Report
youll always be a winner in my heart---y breakfast sandwich. mmmmm
Help with some tricky maths: 12/8/2015 17:05:33

wct
Level 56
Report
Vitriol's explanation is good.

BTW: I forget the name of the math course [Edit: Ah! I remember now. It was called Finite Math. May be differently named in your locale], but since you're in gr 10, it should be available to you either this year or next, depending on your local curriculum, but basically the course would be as Vitriol mentioned mostly about permutations and combinations, i.e. combinatorics. But it often also involves an introduction to probability (which is highly related to combinatorics). In my locale, it was an optional course, which is why I bring it up: If you have a specialized course like this available to you, I would highly recommend taking it. It may start out pretty boring, honestly, but stick with it, it's *really* useful and important. Basically, it's the foundation of probability theory, statistics, and *also* modern reasoning (by which I'm referring to Bayesian reasoning, but you'll need to understand basic probability before that term can be explained further).

To give you a taste of how probability theory extends from combinatorics, I'll quickly summarize Vitriol's explanation by translating it into probability language. As a side benefit, I'll also avoid using decimals until the very end, preferring fractions (rational numbers) because of ... reasons. ;-) Personal preference really.

(Note: If this looks tl;dr to you, please stick with it, there is an important connection to Warlight at the end!)

In probability theory, there are various different kinds of creatures, called probability distributions, used to represent, simulate, or *model* real life 'situations' (often called 'experiments' or 'trials' in the lingo).

The very simplest distribution, called the Bernoulli distribution after a famous dude, is very much like a coin-flip situation, but instead of the coin always being 1/2 heads, 1/2 tails, the coin can be biased and have any probability between 0 and 1 of being heads. So, in your case, a single competition between the four teams (assuming all teams have *equal* probability of winning), *your* chance of winning is 1/4. Likewise, your chance of *not* winning (i.e. losing) is 1 - 1/4 = 4/4 - 1/4 = (4-1)/4 = 3/4. (Just a reminder of fraction addition/subtraction, as I know that's one of the things high school students tend to be rusty on, after relying on decimals so much.)

So, for a single competition, your distribution would be a Bernoulli(1/4) distribution. It's like a coin flip, except this biased 'coin' only shows 'heads/win/success' with a probability of 1/4 instead of 1/2 for an unbiased 'coin'.

Now, when you take multiple Bernoulli situations/experiments/trials and *count* the number of heads/wins/successes (i.e. adding them up, but ignoring which order they came in), what you have is called the Binomial distribution. If you're familiar with the 'binomial coefficients' or 'binomial numbers', that's where the name comes from. If you're not familiar with that term, then a really good starting point for understanding where they come from and what they look like is Pascal's Triangle (https://en.wikipedia.org/wiki/Pascal%27s_triangle) which is really easy to create by hand with pen and paper just by starting with 1, and generating each next row from the simple rule: Each number in the next row is the sum of the two numbers (left and right) above it. See the wiki page for more.

Well, those binomial numbers can also be obtained using a factorial formula (which you would learn about in the course I mentioned), but that formula is so common and useful that it has its own symbol/operator defined for it, which is hard to write in text, but easy to write with a pen and paper. On paper you would write (a b), except the b wold be under the a, rather than after it; kind of like a fraction, but without the division line. In text, and on many calculators, you can use a capital C between the two numbers which you can think of as 'choose' or 'combinations of', so you'd write aCb or perhaps a C b.

Say you have 3 red balls and 2 white balls, total of 5 balls. To find the number of *combinations* of those balls put in a row, but treating all red balls as identical, and all white balls identical, then there are (N r) or N C r where N is the total number of balls and r is the number of red balls, so in this case it would be (5 3) or 5C3 or 5 C 3. If you have a calculator with that button (often with the label nCr or just C (but not the 'clear' button), you'll find that the 5C3 = 10.

All of that background info on the Binomial *numbers* is simply to help explain the notation for the Binomial *distribution*, which uses that bracket notation.

Here's the formula for the Binomial distribution. In the formula, N is the total number of trials (10 in your case), r is the number of 'successful' trials (I don't know why it's often called r, it really should probably be s for success; but I have a hunch the 'red balls, white balls' example has cause it to be r for red; I could be wrong). The symbol '^' represents exponentiation, e.g. '2 to the power of 4' is 2^4.

Probability of r successes out of a total of N trials
= (N r) * p^r * (1-p)^(N-r)
(or, equivalently)
= (N C r) * p^r * (1-p)^(N-r)

If we plug in your numbers, the formula reads
(10 C 1) * (1/4)^(1) * (3/4)^(10-1)
= (10) * (1/4) * (3/4)^9
= 10 * (19683 / 1048576)
= 98415 / 524288
which is *approximately* (drum roll....)
=-ish 0.1877117
=-ish 0.1877

as Vitriol also calculated. But the fraction/rational number 98415 / 524288 is exact.

(Note: The Binomial distribution assumes that each 'trial' is 'independent' of all the other trials, which is a useful assumption that is sometimes not exactly true in real life; for example, if you lose a game, you might lose some confidence, slightly lowering your chance of winning the next game.)

Warlight connection: The basic number of armies killed by attackers and defenders is determined by the exact same Binomial Distribution as this one [clarification: Assumes 100% Luck setting. Reducing Luck changes the distribution to be less spread out], but instead uses the attack and defense kill rates (0.6 and 0.7 or 6/10 and 7/10) for p. So, when you look at the Analyze Attack window, you're seeing a simulation of the Binomial Distribution [see previous clarification]. Cool, eh?

Edited 12/8/2015 20:18:17
Help with some tricky maths: 12/8/2015 21:01:36

wct
Level 56
Report
I found a tool that is really easy to show what the Binomial distribution looks like, here: http://www.zweigmedia.com/RealWorld/stats/bernoulli.html. Try it out with n=10, p=0.25, and click the Graph It button, and you'll see that actually getting 1 win out of 10 is not really that unlikely for p=0.25. For example, the probability of getting 2 wins is only 0.2816, and the probability for 3 wins is only 0.2503.
Posts 1 - 6 of 6   

Contact | About WarLight | Play Risk Online | Multiplayer Strategy Game | Challenge Friends, Win Money | Skill Game | Terms of Service