# Is there something wrong with this Probability Density Function?

Problem:

A certain software company uses a certain software to check for errors on any of the programs it builds and then discards the software if the errors found exceed a certain number. Given that the number of errors found is represented by a random variable X whose density function is given by

$$f(x) = \begin{cases}2(x+2)/5 & : 0 < x < 4\\[1ex] 0 & : \text{otherwise}\end{cases}$$

Find the average number of errors the company expects to find in a given program.

Solution:

The random variable X is given as a continuous random variable, thus its expected value can be found as follows ....

Question:

How do we know that X is a continuous random variable? Shouldn't be more appropriate to model this problem with discrete random variable and use Probability Mass Function instead of Probability Density Function?

Even if it is a PDF, the integral over the range is not equal to 1. If we calculate the excepted value for the random variable X using integral, the value is 14.93. According to the PDF, this does not look like a correct expected value since the PDF in that range is equal to zero.

I found this problem on the Internet, and I am not sure that the PDF and the solution is correct. Where I am wrong?

Unless there is such a thing as half an error I think you are right. The expectation should be evaluated with a summation not an integral. But interpreting it that way I get $f(1) + f(2) + f(3) = 4.8$ instead of $1$ so I guess the problem is ill-posed. You are correct that it makes no sense as a continous PDF either since the integral is not $1$ and $14.93$ is outside the range of possible values. In general it is possible that a PDF has a zero integral in a neighborhood around the expectation (consider the middle of a bimodal distribution).