How to understand probability density function? I have a probability density function like this:

p(x) = $\begin{cases}1,&amp;0\le x\le1 \\0,&amp; \text{otherwise}   \end{cases}$

I want to know how to understand this PDF. Does this mean the probability of any value x $\in$ [0,1] is p(x)? I guess it's not. Then, if I want to know the probability that x=0.5, is P(0.5)=1 right? If it's right, $\int$p(x)dx=1 could be failed. So how to understand the PDF please?
The PDF gives you the relative probability of one value over another. In your example, we see that if $0 \le x_1 \le 1$ and $0 \le x_2 \le 1$, then $p(x_1)=1$ and $p(x_2)=1$, so the probabilities will be equal. Your PDF represents a uniform random variable over $[0,1]$. If you had something like this:

$$p(x) = \begin{cases}1,&amp;0\le x\le\frac{1}{2} \\2,&amp;\frac{1}{2}&lt;x\le1\\0,&amp; \text{otherwise}   \end{cases}$$

Then you would say that the probability of $P(X=1)$ is twice the probability of $P(X=0)$. The PDF does not say anything about the actual probabilities.
The PDF gives you the relative probability of one value over another. In your example, we see that if $0 \le x_1 \le 1$ and $0 \le x_2 \le 1$, then $p(x_1)=1$ and $p(x_2)=1$, so the probabilities will be equal. Your PDF represents a uniform random variable over $[0,1]$. If you had something like this:

$$p(x) = \begin{cases}1,&amp;0\le x\le\frac{1}{2} \\2,&amp;\frac{1}{2}&lt;x\le1\\0,&amp; \text{otherwise}   \end{cases}$$

Then you would say that the probability of $P(X=1)$ is twice the probability of $P(X=0)$. The PDF does not say anything about the actual probabilities.