[Math] Requirements for function to be a probability density function

probability

Suppose that
$$
p(x)=\begin{cases}
cx, \quad 0 \leq x \leq 1 \\
1 – cx, \quad 1 \leq x \leq 2
\end{cases}
$$
Find $c$ and confirm that $p(x)$ is a probability density function.

This is my attempt, but I think it is wrong:
The area under $p(x)$ must be 1, therefore we require
$$
\int_0^1 cx \ dx + \int_1^2 (1 – cx) \ dx = 1.
$$
Integrating that, we find that
$$
\frac{c}{2}x^2\bigg\rvert_0^1 + \left(x-\frac{c}{2}x^2\right)\bigg\rvert_1^2 = 1
$$
Simplying that, I found that $c = 0$, and so

$$
p(x)=\begin{cases}
0, \quad 0 \leq x \leq 1 \\
1, \quad 1 \leq x \leq 2
\end{cases}
$$
However, my understanding is that $p(x)$ must be continuous and this not continuous at $x = 1$. How can I fix this?

Best Answer

Actually, by the definition of probability density function, $p(x)$ only needs to be piecewise continuous because what we really care is its integral, so it is not a problem that $p(x)$ is discontinuous at $x=1$. You can refer to your textbook to see the definition.

Related Question