# Maximum Likelihood Estimation Of A Coin Flip

## Introduction

Today, I will explain easy things in a complex way. I will give a simple example of maximum likelihood estimation of the probabilities of a biased coin toss.

## Bernoulli trial

A Bernoulli trial is a random experiment with two outcomes. The standard example is the flip of a probably biased coin. Let us first denote the outcomes with , and instead of head and tail, since that sounds a lot more professional. The coin will land on one side, say with probability of . It will land on the other side with a probability of , since the probabilities need to sum to one. In mathematical formulation we get the probability and . Now we can define the probability mass function .

In case you only know continuous probability distributions, the probability mass function is similar to the probability density function, but in the discrete case.

## Maximum Likelihood Estimation

Let us now assume, that we have flipped the coin a few times and got the results which are either or . In stochastic parlance these are called observations. The question is what the probability is. Intuitively one could assume that it is the number of ones we got divided by the total number of coin throws. For example if we threw the coin a hundred times and 30 times we got a one, then we would maybe guess . Actually this is the interpretation from a frequentist perspective, but let us not digress into that territory. I will prove in the following that the intuition in this case is correct, by proving that the guess is the “most likely” value for the real .

First, let us reformulate our probability mass function as , which makes it easier to calculate with it. If we have the (independent) observations , then their joint probability mass function is

If we interpret this as a function not in the observations with the fixed parameter , but instead as a function in the model parameter with fixed observations, we get what is called the likelihood function .

We now want to find the with the highest likelihood given the observation , that is, we want to maximize our likelihood function . In this case it is easier to maximize the log of the likelihood , which yields the same result, since the log is monotonously increasing.

As you may remember, maximizing a function means setting its first derivative to zero.

Multiplying by yields that the maximum is reached at . This is the most likely value for given our observation which confirms our intuition.