Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Question:

A single-pump petrol station is running low on petrol. The total volume of petrol remaining for sale is $100$ litres.

Suppose cars arrive to the station according to a Poisson process with rate $\lambda$, and that each car fills independently of all other cars and of the arrival process, an amount of petrol that is distributed as a uniform random variable over $(0, 50)$ - assume for example that all car tanks have a capacity of $50$ litres and drivers decide "at random" when to refill.

We assume that service is instantaneous so that there are no queues at the station.

(a) On average, how many cars will the petrol station fully service (sell the full amount requested) before it runs out of petrol (and before any refilling occurs)?

(b) How much time will it take on average before the station runs out of petrol (and before any refilling occurs)?

Attempt:

I'm not exactly sure where to start with this question part (a). Let $U$ be uniformly distributed over $(0,50)$, then each time a car arrives at the petrol station, the total volume of petrol decreases by $U$. So define $U_1$ to be the amount of petrol that the first arrival (an "arrival" here being when a car arrives at the petrol station and refills) and $U_2$ be that of the second arrival, and so on. Then each $U_i$ is identically and independently distributed as $U$. So by the $N$-th arrival, the station will have $100-\sum_{i=1}^N U_i$ litres of petrol remaining. We stop once $100-\sum_{i=1}^N U_i=0$ and we basically need to find $E[N]$?


That's all I've got so far, if someone can provide a solution for (a) (for now), that would be good.

EDIT: PROGRESS

I don't think I need to use the assumption that cars arrive according to a Poisson process in this part. So, define $U_k$ as the random variable that denotes the amount of petrol that car $k$ fills, $k = 1, 2, 3, \cdots$. Thus, $U_k, k = 1, 2, 3, \cdots$ are independently and identically distributed as a uniform random variable over $(0,50)$.

Let $N$ be the random variable that denotes the number of cars that the petrol station can fully service.

Now I don't quite get the question. Say we have the following scenario:

Car 1 comes with 10L remaining in its tank, so it will fill up 40L, hence the amount of petrol left in the station is now 100-40 = 60L.

Car 2 comes with 10L remaining in its tank, so it will fill up 40L, hence the amount of petrol left in the station is now 60-40 = 20L.

Car 3 comes with 20L remaining in its tank, so it will fill up 30L, but the petrol station only has 20L left, so does this mean Car 3 just leaves the petrol station filling 0L? My gut feeling is that this cannot happen because each car can only fill an amount BETWEEN 0 and 50, ie, (0,50) [note that the end points are not included].

Hence in this scenario, the petrol station runs "out" of petrol at N=3 because it does not have enough to FULLY service Car 3, even though it still has 20L left in the pump. Thus, the petrol station can only service N=2 cars.

Is this interpretation correct? If so, how do I find $E[N]$?

EDIT 2: working on further...

Define $G_N = \sum_{k=1}^N U_k$, then $E[N] = \sum_{n=1}^{\infty} n P(N=n) = \sum_{n=1}^{\infty} n P(G_n \le 100)$

This equivalence comes from the fact that the event $\{N=n\}$ will only happen if $100 - G_n \ge 0$.

However, two questions remain, what is the distribution of $G_n$? (How do I derive the distribution of the sum of $n$ iid uniform random variables and second, how do I compute the infinite sum?


Furthermore, I should mention that this question can be done without the need of any computer software package or programming. It has a closed form solution with an exact answer, I am feeling that my current approach definitely won't work by hand.

share|improve this question
    
Seems like you are mostly on the right track regarding (a), but you need to stop when 100 − $\sum_1^n U_i$ $\le$ 0, and then accordingly you have N-1 or N as the number of cars. –  A.Chakraborty Apr 21 at 18:02
    
Thanks. A bit unsure how to proceed from here though... I don't think we need the information regarding the Poisson process at all for part (a). –  user40333 Apr 22 at 5:28
    
The rules of the game are not fully stated. What happens when a car "needing" $30$ liters arrives, and there are only $20$ liters left? A bank would not pay out $20$ dollars on a $30$ dollars cheque, but a pump station attendant maybe has other orders. –  Christian Blatter Apr 23 at 18:17
    
I think all rules has been stated, we just need to read carefully. Because the amount of petrol filled by a car has to be BETWEEN 0 and 50 (not including 0 and 50), so this means that if a car "needing" 30L arrives but there are only 20L at the petrol pump, then this car cannot leave, i.e., it cannot fill 0L. But the question also states "...how many cars will the petrol station fully service (sell the full amount requested) before it runs out of petrol (and before any refilling occurs)?". So this car will NOT get FULLY serviced, since it does not get to refill its REQUESTED amount. –  user40333 Apr 23 at 18:28
    
...hence the process terminates here, and the petrol station can ONLY FULLY service N=2 cars (assuming car 3 is the one that needs 30L). –  user40333 Apr 23 at 18:28

2 Answers 2

up vote 5 down vote accepted
+100

Let $N$ denote the number of cars that will be fully served, in other words, if $N=n$, then car $n+1$ is the first one ordering more petrol than the amount left at the station.

Changing slightly the notations and using the homogeneity of the problem, $$ [N\geqslant n]=[\text{car}\ n\ \text{is fully served}]=[U_1+\cdots+U_n\leqslant2], $$ where the random variables $U_n$ are i.i.d. and uniform on $(0,1)$. The mean time elapsed between two cars are served is $1/\lambda$ hence the mean time $\mathtt t$ before some petrol order cannot be satisfied is $$ \mathtt t=\frac{E(N)+1}\lambda. $$ Now, let $N_x$ denote the number of cars that will be fully served if the initial volume of petrol at the station is $x\cdot50$ liters. Then $N=N_2$ and, for every $x\geqslant0$, conditioning on the amount of petrol the first car is served and using the identity $P(U_1\leqslant x)=\min\{x,1\}$, one gets $$ E(N_x)=\min\{x,1\}+\int_0^{\min\{x,1\}}E(N_{x-u})\,\mathrm du. $$ Thus, if $x\geqslant1$ then $$ E(N_x)=1+\int_0^1E(N_{x-u})\,\mathrm du=1+\int_{x-1}^xE(N_u)\,\mathrm du, $$ while if $x\leqslant1$ then $$ E(N_x)=x+\int_0^xE(N_{x-u})\,\mathrm du=x+\int_0^xE(N_u)\,\mathrm du. $$ Let $n(x)=E(N_x)$. If $x\leqslant1$, then $$ n'(x)=1+n(x), $$ and $n(0)=0$ hence, for every $x$ in $(0,1)$, $$ n(x)=\mathrm e^{x}-1. $$ If $1\leqslant x\leqslant2$, then $$ n'(x)=n(x)-n(x-1)=n(x)-(\mathrm e^{x-1}-1). $$ Integrating this and using the initial condition $n(1)=\mathrm e-1$ yields, for every $x$ in $(1,2)$, $$ n(x)=\mathrm e^x-1-\mathrm e^{x-1}(x-1), $$ in particular, $$ E(N)=n(2)=\mathrm e^2-1-\mathrm e, $$ which yields $$ \mathtt t=\frac{\mathrm e^2-\mathrm e}\lambda\approx\frac{4.67}\lambda. $$

share|improve this answer
    
Thank you! So you basically modelled it as a renewal process, fantastic solution. However, I'd just like to clarify one thing, why did you add $1$ to $E[N]$ when working out $t$? I would have thought the mean time before the station runs out of petrol is just $\lambda^{-1} E[N]$? –  user40333 Apr 25 at 16:46
    
E[N]/λ is the mean time when the last car to be fully served is served. The station runs out of gas "one car later". –  Did Apr 25 at 17:26
    
Yup, however the question says "...before the station runs out of petrol (and before any refilling begins)." The part bolded means that even if the station has some gas left, it is considered to be "out of gas" since no refilling occurs. So do we really need the $+1$? –  user40333 Apr 25 at 18:04
    
In my opinion, it makes no sense to decide that the station is out of gas when it has some gas left... And note that, as long as there is some gas left, a new car might arrive and be served, if only it asks for little enough gas. –  Did Apr 25 at 20:22
    
Yes I understand, however, we have defined $N$ to be the number of cars that are FULLY serviced, thus any cars that arrives after the $N$-th car cannot be fully served, thus, the process ends here because each car has to be refilled to its full capacity, hence by the $N+1$-th car, the petrol pump has effectively run out of gas. In other words, even if the petrol pump has "some" gas left, it cannot use it to fulfill the request of any cars. –  user40333 Apr 25 at 20:39

This is my answer in collaboration with my brother (75% by me and 25% by him... Okay fine, you must not believe me, this 50%-50% work! Although, he only guide me a bit and let me borrow his stat textbook). Here we go! \(^◡^)/

Let $X_i$ be a random variable that denotes the amount of petrol that is filled to the $i$-th car, $N$ be a random variable that denotes number of cars that the petrol station can fully service, and $V$ be a random variable that denotes the total volume of petrol that is used to fill the cars.


Assumptions:

  1. Conditional on $N=n$, the random variables $X_1,\cdots,X_n$ are i.i.d. random variables.
  2. Conditional on $N=n$, the common distribution of the random variables $X_1,\cdots,X_n$ does not depend on $n$.
  3. The distribution of $N$ does not depend in any way on the values of $X_1,\cdots,X_n$.

Then, we have a model \begin{align} V=X_1+X_2+\cdots+X_N,\qquad\qquad N=0,1,2,\cdots, \end{align} where $V=0$ when $N=0$. From Bayes' we have \begin{align} \text{E}[Y]=\text{E}[\text{E}(Y|X)], \end{align} then the moment generating function (MGF) of $V$ is \begin{align} \text{M}_V[t]&=\text{E}\left[e^{\Large tV}\right]\\ &=\text{E}\left[e^{\Large t(X_1+X_2+\cdots+X_N)}\right]\\ &=\text{E}\left[\text{E}\left(e^{\Large t(X_1+X_2+\cdots+X_n)}|N=n\right)\right]\\ &=\sum_{n=0}^\infty\text{E}\left(e^{\Large t(X_1+X_2+\cdots+X_n)}|N=n\right)\Pr(N=n) \end{align} The expectation value of $V$ can be calculated as follows \begin{align} \text{E}[V]&=\left.\frac{d}{dt}\text{M}_V[t]\right|_{t=0}\\ &=\left.\frac{d}{dt}\sum_{n=0}^\infty\text{E}\left(e^{\Large t(X_1+X_2+\cdots+X_n)}|N=n\right)\Pr(N=n)\right|_{t=0}\\ &=\sum_{n=0}^\infty\text{E}(X_1+X_2+\cdots+X_n|N=n)\Pr(N=n)\\ &=\sum_{n=0}^\infty\text{E}(nX_i)\Pr(N=n)\\ &=\text{E}(X_i)\sum_{n=0}^\infty n\Pr(N=n)\\ &=\text{E}(X_i)\text{E}(N)\\ \end{align} We expect that the total volume of petrol that will be used to fill the cars is $100$ liters and $X_i$ is uniformly distributed over $(0,50)$. Hence \begin{align} \text{E}[V]&=\text{E}(X_i)\text{E}(N)\\ 100&=\frac{1}{2}(0+50)\text{E}(N)\\ 100&=25\text{E}(N)\\ \text{E}(N)&=4 \end{align} Therefore, the number of cars that will be fully served is $4$ cars and if $T$ is a random variable that denotes the time taken before the station runs out of petrol, then \begin{align} \text{E}(T)&=\frac{\text{E}(N)}{\lambda}=\frac{4}{\lambda} \end{align} To be honest, I'm not quite sure about my answer since the result is too good to be true. ✌(^ₒ^)✌

P.S. You may vote down my answer, but please make sure you also make an answer to this question. Thank you. ≧◠◡◠≦✌

share|improve this answer
    
Assumptions 2. and 3. are not compatible with the model. (Did you by any chance read the other answer? You might want to have a try...) –  Did Apr 29 at 15:34
    
Mr. @Did: No Sir, when I asked my big brother about this question he only pointed me his stat book and told me about compound model, MGF & PGF. I'm very newbie about these things. I just try my luck to answer a bounty question. Sorry if I'm mistaken. ≥︺‿︺≤ –  Anastasiya-Romanova 秀 Apr 29 at 15:48
    
Charming. By the way, assumption 1. as well is off the mark. –  Did Apr 29 at 15:50
    
Mr. @Did: I suppose that I'm completely wrong! Hahaha. I'm sorry user40333. ≥►.◄≤ –  Anastasiya-Romanova 秀 Apr 29 at 15:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.