From a textbook:
Theorem 3.5. A function can serve as a probability density of a continuous random variable $X$ if its values, $f(x)$, satisfy the conditions^
$f(x)\ge0$ for $-\infty <x<\infty$;
$\int_{-\infty}^\infty f(x)\,dx=1$.
^The conditions are not "if and only if" as in Theorem 3.1 because $f(x)$ could be negative for some value of the random variable without affecting any of the probabilities. However, both conditions of Theorem 3.5 will be satisfied by nearly all the probability densities used in practice and studied in this text.
Could someone explain this further?
Thanks in advance