# Number of days until day

I am looking for a formula that describes the following probability:

There are $x$ important days in one year. What is the probability that the next day will be $t$ days from now? (If we are at the end of the year, then the number of days until the next event in the next year should be tested. Therefore the probability should be the same of every day in the year)

It is important that the event needs to be exactly $t$ days from now, not more not less (therefore no summed probability)

Since $x$ is going to be at least $10$, the number of possible chosen days is very large and therefore just computing all possibilities is not an option here. ( the number of possibilities of chosing $10$ out of $365$ is $\frac{(365+10-1)!}{364!10!}$, which is very big ;) )

Any idea how to solve this?

EDIT:

The $x$ days are chosen at random and can overlap. You can think of $x$ as describing the number of friends whose birthdays we are waiting for. Two (or more) of your friends can have the same day as birthday.

$t$ is the number of days until the next event, therefore $p(t)=0$ for $t>365$

You can assume that the number of days in a year is 365.

• I think you need to calculate the waiting time to the next event in a Poisson process. (Assuming the "important days" obey the axioms needed for a Poisson process, of course.) – David Mitra Jan 23 '14 at 12:06
• Unfortunately I can't use Poisson, since the days are not exponentially distributed. I assume this could be used for an approximation, but I have no idea how good or bad it is. – Nils Ziehn Jan 23 '14 at 12:14

If I understand the question correctly, then the answer is

$$\sum_{k=1}^x{x\choose k}\left({1\over 365}\right)^k\left({364-t\over365}\right)^{x-k}$$

That is, some positive number of friends $k$ must have birthdays coming up in exactly $t$ days, and none of the others can have a birthday today, tomorrow, the day after, etc., through day $t$ from now, which means their birthdays are restricted to a range of $364-t$ days.

Added later: A much nicer, much simpler, answer was given by drhab. If neither today nor the next $t-1$ days is anyone's birthdays, then the $x$ birthdays are all in a range of $365-t$ days; if the $t$-th day is also not a birthday, then they're all in a range of $364-t$ days. So the probability of the next birthday being in exactly $t$ days is the difference

$$\left({365-t\over365}\right)^x-\left({364-t\over365}\right)^x$$

This is clearly much easier to both explain and compute than the formula I gave.

• Hey, thank you for your answer. I am still trying to validate it, but it looks very good so far! – Nils Ziehn Jan 23 '14 at 13:20
• @NilsZiehn, one caveat: As given, my answer assumes that "today" is not one of the important days. If you allow it to be a special day, then just replace the $364$ with $365$. But if you assume it to be a special day, other changes are needed. – Barry Cipra Jan 23 '14 at 13:26
• Thx mate, I think it's correct! – Nils Ziehn Jan 23 '14 at 13:47
• Yeah, I figured your last comment out by myself ;) it's fine with 365 – Nils Ziehn Jan 23 '14 at 13:48
• Note that the expression can be simplified. This because $\sum_{k=1}^{x}\binom{x}{k}a^{k}b^{x-k}=\sum_{k=0}^{x}\binom{x}{k}a^{k}b^{x-k}-b^{x}=\left(a+b\right)^{x}-b^{x}$. This simplification leads probably to answers given by me and Henry. By me it is possible however that $t=0$. – drhab Jan 23 '14 at 14:03

Taking the birthdays of $10$ people (assuming uniformity, independence, etc.) and that the time to the next important day is always positive (never $0$) then

• the probability that a particular friend has a birthday in the next $t$ days is $\frac{t}{365}$

• the probability that that friend does not is $\frac{365-t}{365}$

• the probability that none of the $10$ friends has a birthday in the next $t$ days is $\left(\frac{365-t}{365}\right)^{10}$

• the probability that at least one of the $10$ friends has a birthday in the next $t$ days is $1-\left(\frac{365-t}{365}\right)^{10}$

• the probability that first of the friends' birthdays will be $t$ days from now is $\left(\frac{366-t}{365}\right)^{10} - \left(\frac{365-t}{365}\right)^{10}$

This final expression is a decreasing function of $t$, so the probability for $t=1$ is about $0.027$ (slightly less than $\frac{10}{365}$), while the probability for $t=365$ is about $2.4 \times 10^{-26}$ (i.e. $\frac{1}{365^{10}}$)

• Thank you for your answer, but I am sure that the one from @Barry is correct – Nils Ziehn Jan 23 '14 at 13:53
• @Nils: They may be the same. Mine is clearly the same as drhab's apart from the point that I am measuring to the next (not today) so values in 1 to 365, rather than 0 to 364. – Henry Jan 23 '14 at 14:39

Set yourself on day $0$.

To be calculated is $P\left[\min\left(T_{1},\ldots,T_{x}\right)=t\right]$ where the $T_{i}$ are iid rv variables taking values in $\left\{ 0,1,\ldots,364\right\}$ uniformly.

Here: $$P\left[\min\left(T_{1},\ldots,T_{x}\right)=t\right]=P\left[\min\left(T_{1},\ldots,T_{x}\right)\geq t\right]-P\left[\min\left(T_{1},\ldots,T_{x}\right)\geq t+1\right]=\left(\dfrac{365-t}{365}\right)^{x}-\left(\dfrac{364-t}{365}\right)^{x}$$ Note that overlap is possible. You can have $T_i=T_j$ while $i\neq j$.

Here it is possible that $t=0$ (your are on a 'birthday'). If you don't want that then let the $T_i$ take values in $\left\{ 1,\ldots,364\right\}$

• Thank you for your answer, but I am sure that the one from @Barry is correct – Nils Ziehn Jan 23 '14 at 13:49
• I will check on it. Are you able to tell me what's wrong with mine (and Henry's, we are on the same line)? – drhab Jan 23 '14 at 13:51
• I am note 100% whether this is the only problem, but you are calculating the summed probability, not the exact probability that an event is in t days. Right? – Nils Ziehn Jan 23 '14 at 13:55
• No, I am calculating the exact one by means of the summed one. In the sense that $P\left\{ T=t\right\} =P\left\{ T\geq t\right\} -P\left\{ T\geq t+1\right\}$ – drhab Jan 23 '14 at 13:58
• Simplification of @Barry (see my comment there) leads to the same answer. So Barrys answer is correct, but not as simple as can be. Do not understand me wrong. Off course I am not saying this in order to let you withdraw your acceptance :-). – drhab Jan 23 '14 at 14:14

Take a day $0 \leq d<365$ chosen at random, and denote $X=\{x_n:0 \leq x_n<365\}$ the set distinct important days ($|X|=x$).
The set of least waiting times is then $\{(x_n-d)\mod{365}\}=\{t_n:0 \leq t_n<365\}$ and has the same number of elements as the set of important days. Hence the probability of least waiting a correct amount of time is equal to the probability of choosing an important day.
We also want to exclude waiting times such as $t \geq 365$ because they obviously are not least with regards to a given day. So: $$P(t)=\frac{x}{365} H[365-t]$$ Where $H$ is the unit step function.

• t is an important variable. For instance for t>365, the probability will always be 0!, since t is the number until the NEXT event (closest to now) – Nils Ziehn Jan 23 '14 at 12:00
• I guess you misunderstood, yes. Assume you have 10 friends. What is the probability that you have to wait 400 days that you have to wait for the next one of your friends to have had a birthday. It is 0. This is not a modulus question! Furthermore: even the probability that you have to wait 364 days is almost 0 since this means that all your 10 friends have their birthday on the same date! (and it was yesterday! ) – Nils Ziehn Jan 23 '14 at 12:10
• @NilsZiehn The question is, do you identify days with common index in different years? – user76568 Jan 23 '14 at 12:12
• I am not sure whether I understand you correctly, but lets say the first day is March 1st. In this case it is not important whether it is March 1st of this year or next. The problem is related to birthdays and therefore just the day and the month is important not the year. Does this help? – Nils Ziehn Jan 23 '14 at 12:21