Kalgebra/Probabilities

    From KDE UserBase Wiki
    Revision as of 17:48, 7 January 2011 by Yurchor (talk | contribs) (fix the template and typos)
    (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

    Introduction

    Let's say we have 5 dices and we want to gamble with them.

    Theory behind game

    First we have to analyze one die:

    The probability to get a number on a dice is 1/6 or 16,667% because the total numbers of events is 6 and the die is equiprobal.

    The probability to get each number is on the left

        1    16.667%
        2	 16.667%
        3    16.667% 
        4	 16.667% 
        5    16.667% 
        6	 16.667% 
    

    When we launch 2 dices probabilities change, so we report them:

        2	 2.778%
        3	 5.556%
        4	 8.333%
        5 	 11.111%
        6 	 13.889%
        7 	 16.667%
        8 	 13.889%
        9	 11.111%
        10   8.333%
        11	 5.556%
        12   2.778%
    

    Why is the probability for each number so different respect to first one, you may ask, the solution is very simple. Let's take '4' and make all the combinations of 2 numbers that summed gives 4:

       1+3 = 4
       3+1 = 4
       2+2 = 4
    


    So we have to sum the probability of these numbers to get the total probability of 4. Let's test it:

      Prob(1,3) + Prob(3,1) + Prob(2,2) = 1/6 * 1/6 + 1/6 * 1/6 + 1/6 * 1/6 = 0.08333 = 8,333%
    

    So if we have 5 dice, we should get for each resulting number the 5 numbers on dice that summed up give us it. The way to get the probabilities of each number with more dices is equal.

    The probability problem

    Now we mind at a problem, if we roll our 5 dice and we want 3 '6', what is the probability to get them?

    Well, the problem is: probability on first dice * probability on second dice * probability on third dice * negative probability on fourth * negative probability on fifth

    So for instance the dice can be: 6 6 6 2 3, but they can also be 5 6 6 6 1, so we have to introduce a binomial coefficient to count all this cases. To have the the binomial coefficient of N numbers on M position the formulae for kalgebra is:

    factorial(N) / (factorial(M) * factorial(N-M))

    or simply:

    comb(N,M)

    So the binomial coefficient of 3 numbers on 5 position is:

    comb(5,3)
    =	10


    so at last our function will be:

    (comb(5, 3)*(1/6)*(1/6)*(1/6)*(5/6)*(5/6))
    =0.00321502

    We can now define a simple function to get the result:

    probability:=(place, case, totalprobability, positive, negative)->(comb(place, case)*(positive/totalprobability)^case)*(negative/totalprobability)^(place-case)

    So now:

    probability(5, 3, 6, 1, 5)
    =	0.0321502

    It's the probability on 5 extraction to get 3 identical number where the probability of each card is 1/6 and the negative probability is 5/6

    We can notice that the sum of probabilities is 1:

    sum(probability(5, t, 6, 1, 5):t=0..5)
    =	1


    We can think that the probability progress until the maximum value and then it decrease costantly as it has progressed. So we can see that the distribution of numbers among the extraction is like a bell, this kind of distribution is called binomial distribution. References:[1]

    So now we understand that the game is non balanced, there are probabilities better than other so who choose the best can win easily.

    The only way to have a fair game is to gambling with only one die because each face has 1/6 of probability. Another type of equiprobal chances are the launch of a coin where each face is 1/2 of probability.

    A simple way where a player can win is to improve the probability on a face so it will be unbalanced, for istance the bank in a game can put a small load on the face with '6' so the probabilities change and the dice now became:

    0.15 	 1
    0.15	 2
    0.15	 3
    0.15	 4
    0.15	 5
    0.25	 6
    

    So now if we roll the 5 dices with this probability and we want 3 '6' to win the total probability is:

    probability(5, 3, 6, 2, 4)
    =0.164609053498

    The right prizes for each extraction should be the negative probabilities of extraction for the total amount, so with low probabilities we can have huge prizes and with high probabilities we can have low prizes.