Must probability density be continuous?

From other materials that I've read, the probability density of a continuous random variable must itself be continuous. Is this correct? If it is, I don't understand why that would be so, why can't the probability change abruptly?


Take $f(x) = 2x$, $0\le x \le 1$, and 0 otherwise. This is a density function which is not continuous.


Michael Chernick asks for an example of a probability distribution with a density that is everywhere discontinuous.

As discussed in this question, there exists a measurable set $A \subset \mathbb{R}$ such that for every interval $I$, we have $0 < m(A \cap I) < m(I)$, and moreover $m(A) < \infty$. Then $f(x) = \frac{1}{m(A)} 1_A(x)$ is a nonnegative measurable function with $\int_\mathbb{R} f(x)\,dx = 1$, so it can be taken as the density of a continuous probability distribution. $f$ is nowhere continuous because every interval contains points of $A$ and $A^C$. Moreover, any function $g$ with $f=g$ a.e. is also nowhere continuous.