This is an example in the book (A First Course in Probability by Sheldon Ross).
A stick of length 1 is split at a point U that is uniformly distributed over $(0,1)$. Determine the expected length of the piece that contains the point $0 \leq p \leq 1 $.
The problem with this is I don't know how would I go about solving this. They have solved this in the book but I do not understand their solution.
For example I don't know how to setup the probability density formula and then to find the expected value from there.