# How to find expected cost when a random variable associated with that cost is normally distributed?

The question is as follows;

Grear Tires has produced a new tire with a mean mileage of 36500 miles and std dev of 5000 (assume normal). Grear has offered to refund a $1 per 100 miles short of 30000. For each tire sold, what is the expected cost of this offer? My approach was to find the probability density for each value 100 points down starting 30000. And to find probability-weighted average; Miles Probability Refund 29900 3.338741e-05 $$1 29800 3.251101e-05$$2 ... 100 2.474479e-16$299


Is this the correct way to do it?

• As a check, extend your table to cover a reasonably full range of miles--say, 20,000 to 55,000. Do your "probability" values sum to $1$? – whuber Dec 4 '19 at 5:54
• @whuber These probability values I got from R's dnorm( ) function corresponding to each mile value. I just want to know if there is a formula based approach rather than find probability density for each mileage under 30000 – Dom Jo Dec 4 '19 at 6:01
• dnorm does not return probabilities. It is a probability density function. – whuber Dec 4 '19 at 15:20
• That's incorrect, because $\Pr(Z=x)$ is always zero. You might find stats.stackexchange.com/questions/4220 to be instructive. – whuber Dec 4 '19 at 18:27
• @DomJo Probability and probability density are not the same thing. You can also read math.stackexchange.com/questions/521575/… – Itamar Mushkin Dec 5 '19 at 8:34

Assuming that the problem is continuous and not discrete (i.e. the producer pays half a dollar for 50 miles below the threshold), this question can be solved analytically (i.e. a formula based solution, like you said) by explicitly writing the distribution and integral.

The distribution of mileage is normal with known mean and variance, let's write $$f(x) = {1 \over \sqrt{2\pi}\sigma} exp(- {(x-\mu)^2 \over {2 \sigma^2}})$$

The cost function is 1 dollar per $$m$$ miles below some threshold $$x_0$$, so we can write $$c(x) = max( {{x_0-x} \over m} ,0)$$.

The expected cost is the integral $$\int _{-\infty} ^{\infty} f(x)c(x)dx$$. However, since the cost is 0 if $$x$$ is above $$x_0$$, we can simply write it as $$\int _{-\infty} ^{x_0} {{(x-x_0) \over m}} {1 \over \sqrt{2\pi}\sigma} exp(- {(x-\mu)^2 \over {2 \sigma^2}}) dx$$.

From here, the solution is relatively simple.

Even if the problem is discrete (i.e. the producer pays only in discrete amount of dollars), you can verify your discrete result (e.g. by Viktor's answer) by computing the continuous result and see that they are not too far.

• I am afraid, the problem is stated as a discrete one. The producer does not pay cents, but only whole dollars. – Viktor Dec 4 '19 at 7:39
• It didn't say so explicitly in the question, but I'll add a disclaimer. Either way, it's good practice to solve the continuous problem by hand and see that the results are close enough. – Itamar Mushkin Dec 4 '19 at 8:15

No. Using just PDF is incorrect. A more correct way is to use the corresponding differences of the tails of the distribution, which are the integrals of the PDF on the intervals $$(-\infty,100]$$, $$(100,200]$$, $$(200,300]$$, ...

• Ok. I think I understood. But can you write it mathematically (and solve if that's not big trouble)? I believe this can only be done in some software language like R? – Dom Jo Dec 4 '19 at 9:00
• Doing mathematics does not require any software at all. – whuber Dec 4 '19 at 15:21