I recently came up with an interesting probability puzzle and wondered what would be the best way to solve it. It goes as follows:
Suppose your friend is to arrive sometime on Monday, with a uniform distribution over the full 24 hour day. Whatever time they arrive dictates how long they will stay at your place. For example:
- If your friend arrives exactly at midnight (00:00) on Monday, they won't stay at all, and simply say "hello" while passing by.
- If they arrive at 1:30am (01:30) they will stay for an hour and a half, until 3:00am (03:00).
- If they arrive at 2:00pm (14:00) they will stay for 14 hours, until 4:00am the next day, Tuesday.
If $t$ is a moment in time sometime between the beginning of Monday and the end of Tuesday, what is the probability your friend is at your house at time $t$?
Stated a little more formally, if $a \in [0, 86400)$ is the arrival time (in seconds) of your friend, then the times they will be staying at your house will be given by $[a,2a)$. So the question becomes:
Given $t\in[0, 172800)$, what is the probability that your friend is at your house at time $t$?
Naturally I am interested in the method for arriving at a solution more so than the actual solution itself. I would also like to know how to approach the problem if the distribution on $[0,86400)$ was not uniform, but instead was given by some specific probability density function.
Thanks, in advance.

You are introducing the Bernoulli random variable $B_t$ which reads as follows:
$$B_t = \begin{cases} 0 & \text{if the friend is not at home at time}~t\\ 1 & \text{if the friend is at home at time}~t\\ \end{cases}.$$
In this sense, $t$ is a parameter of the random variable, not a random variable itself.
The probability that $B_t = 1$ corresponds to:
$$p_t = p((A < t) \wedge (A > t/2)),$$
where $A$ (the arrival time) is a random variable. In this case, since it is uniformly distributed in the set $[0, D]$, where $D = 86400$, the pdf of $A$ is:
$$f_A(a) = \frac{1}{D}, \forall a \in [0, D].$$
To find the exact expression, we must consider the following cases:
Roughly speaking, you can find the distribution of $B_t$ (which is $[1-p_t, p_t]$ on the set $\{0, 1\}$), and not the distribution of $t$!
For general distribution of $A$ (i.e. if $f_A(a)$ has another form), then just solve the integrals stated in points $1$ and $2$ with the right distribution.