Statistics and Probability is a fundamental knowledge that should be inside each Software Engineer, and here I will show you some of its wonders.

Some of you are already saying “hi” and posting pictures to boost your possibility to win the giveaway, but, how will it improve your chances? and how will I calculate? Keep reading to find out.

In probability the chance of an event to happen is measured between 0 and 1, with 0 being an impossible occurrence (it will never happen) and 1 being an occurrence that will always happen, anything in between is said to be the probability of an occurrence to happen, the closer to one the more chances it has to happen.

It’s all pretty basic stuff, but lets put it in the context of our giveaway.

Let’s imagine for a second that the giveaway ended and there’s 200 participants, this means that if you were to win you have to be randomly picked out of this crowd of 200, so you have a one out of 200 chances of winning, which is 0.005 probability. Not much is it? but there’s more so don’t worry.

Our contest randomly picks 5 people out of the 200 participants, this means that you have to be picked either one of this times, so you have one of 200 chances of winning, 5 times, so it’s (1/200)*5, or 5/200, which is 0.025, much better right? but this formula is plain wrong.

The thing is, your chances of winning are repeated 5 times and are exclusive: if you’ve already won, there’s no chance of you winning again as you are excluded from the population, so the population of participants decrements by one, but since one winner is already picked, then there’s one less chance of you to win, so both your chances and the population decrease every time until you have more chances of winning, so the formula is left like this:

1/200 + 1/199 + 1/198 + 1/197 + 1/196 = 0.025254

Looks nice but… the probability of you NOT winning is 1 – the probability of you winning, so you have a probability of loosing of 0.9747, which is really, really, really high.

This is usually where past giveaways end, but ours is a bit more complex than that.

You see, I added one more variable to the table: a contest. Users can post images and they get graded between 0 and 10, the higher the grade, the better, users with no picture will end up with a score of a 1 out of 10. Users need to have their picture win and to be picked from the crowd randomly to win the prize.

If your score is an 8 out of 10 then you have a probability of 0.8 that your picture will win, after that you have to cope with the fact that you have to be randomly selected from the crowd.

This means that your chances of winning are solely based on two variables: your picture’s score and the probability of you being randomly picked from the crowd.

So you have two probabilities that need to be met for you to win: your score, and being randomly picked.

This gives us 4 different occurrences that can happen, assuming your score is 8/10:

— Your picture wins (probability of 0.8), you are picked from the random crowd (probability: 0.02525) -> you win

— Your picture wins (probability of 0.8), you are not picked from the random crowd (probability: 0.9747) -> you loose

— Your picture looses (probability of 0.2), you are picked from the random crowd (probability: 0.02525) -> you loose

— Your picture looses (probability of 0.2), you are not picked from the random crowd (probability: 0.9747) -> you loose

So how do we calculate your final probability of winning? well, we use the bayes formula, which goes something like this: the probability of the event we want happening divided by the summary of the probabilities of all events.

The probability of you winning is the probability of your picture winning intersected with the probability of you being picked, which is 0.8 * 0.02525 = 0.0202

Knowing this, we go on to calculate your actual probability:

0.8*0.02525 / (0.8*0.9747 + 0.2*0.02525 + 0.2*0.9747) = 0.02061

Now it may seem like a low probability, but if we calculate the probability of someone with a picture of a score of 0.5 we get 0.01278, and the probability of someone winning without posting any picture is 0.00253.

You may think “Acid, I used to have a probability of winning of 0.025 with the other giveaways, now I have 0.02061 if I get a score of 8 out of 10″.

This is true, but someone with an 8 out of 10 has a much bigger chance than someone with a 5 or no picture at all.

I hope this has helped clarify how the contest works and how the picture matters.

Tweet this!