The idea of this blog was shown up in my mind on my wedding day. In Indonesian tradition, a groom must say a (long) sentence in front of several chosen people in order to make a marriage. The sentence is called "Ijab Qabul". I was really nervous that day, especially my dad said that I have to memorise the sentence and read it in one breath. If I failed, I have to repeat it again until I make it.

One hour before the ceremony, I decided to practice the sentence in a silent room. My target is to say the sentence 20 times without failing. If I made a mistake, I have to repeat my count from 0. After trying many times, I could only manage saying the sentence 18 times in a row. And I was thinking, "if I can say the sentence 18 times in a row, what is the probability I can say it without a mistake next time?"I didn't have time to think about it on my wedding day. But several days later, I managed to solve the problem.

My method is to use Bayesian probability approach. Let's say $$p$$ is the successful probability and $$p$$ can be between 0 to 1. Also, denote $$k$$ as the number of successful events happen in a row. The probability of successful probability has value of $$p$$ given there are $$k$$ successful events is

$$P(p|k) = \frac{P(k|p) P(p)}{P(k)}.$$

Let's calculate the variables on the right hand side one by one. The variable $$P(k|p)$$ denotes the probability of getting $$k$$ successful events in a row given the successful probability is $$p$$. By a simple AND rule,

$$P(k|p) = p^k.$$

Now, for the probability of successful probability having value of $$p$$, $$P(p)$$, is a bit different. The range of $$p$$ is continuous, so instead of calculating the probability of successful probability having the exact value of $$p$$, we can calculate the probability having the value between $$p$$ and $$p + dp$$, which is

$$P(p) = dp\ \mathrm{for}\ p \in [0,1].$$

Lastly, we need to compute the probability of getting $$k$$ successful events in a row, considering all possible values of $$p$$. This can be done by some integration

$$P(k) = \int_0^1 P(k|p) dp = \int_0^1 p^k dp = \frac{1}{k+1}.$$

Now combining all the variables, we can get the probability of the successful probability having value of $$p$$, given there are $$k$$ successful events in a row,

$$P(p|k) = (k+1) p^k dp.$$

We already obtained the probability distribution of $$p$$, but this does not answer our original question, "what is the probability of the next event successful?"

To answer that question, we can calculate the expected value of $$p$$,

$$\mathbb{E}(p|k) = \int_0^1 p P(p|k) = (k+1) \int_0^1 p^{k+1} dp = \frac{k+1}{k+2}.$$

So, the probability of having the next event successful, given there are already $$k$$ successful events in a row, is $$(k+1)/(k+2)$$.

For my case, I can say the sentence 18 times in a row without a mistake. So the probability of saying it correctly next time is 95%.

Side note: it turns out that during Ijab Qabul, the imaam gave me a paper containing the text, so I can just read it. And also, I realised later that this problem is actually the "sunrise problem".