Find a continuous PDF on $[0,6]$ for given probabilities 
Find a continuous probability density function $f$ on $[0,6]$, such that $\mathbb{P}([0,2]) = 0.6$, $\mathbb{P}([1,4]) = 0.5$ and $\mathbb{P}([3,5]) = 0.2$.

After some calculations I came up with the piecewise constant function $$f(x)=\begin{cases}\frac{3}{10},&0\le x< 2\\\frac{1}{10},&2\le x\le6\\0,&\text{otherwise}\end{cases}$$ But then I noticed that the question asks for a continuous PDF. I then tried to fit some polynomials like $f(x) = ax^2$ and $ax^2 + bx$, but this becomes tedious very fast. What is a good approach to find a simple cont. PDF like this one?
 A: Hint: Instead of choosing $f$ piecewise constant, you can choose $f$ piecewise linear, $$f(x)=\begin{cases}a_1x+b_1,&0\le x< 2\\a_2x+b_2,&2\le x< 4\\a_3x+b_3,&4\le x< 6\\0,&\text{otherwise}\end{cases}$$ in a way that $f$ is continuous in $x=0,2,4,6$. 

Start with $$\int_{0}^2(a_1x+b_1)\ dx=0.6$$ Since $f(0)=0$ (for continuity) this implies that $b_1=0$ and you find that $a_1=0.3$. So, $f(x)=0.3x$ in $0\le x<2$. Next, you get that $$P([1,2])=\int_{1}^20.3x\ dx=0.45$$ (here $P([1,2])$ is a shortcut for $P(X\in[1,2])$) and hence $$P([2,4])=P([1,4])-P([1,2])=0.05$$ So, to establish the second part of $f$ know you need to solve $$\int_{2}^{4}a_2x+b_2 \ dx=0.05$$ under the restriction that $f(2)=0.6$. Can you take it?

Most direct approaches, i.e. choosing $f$ piecewise linear or piecewise constant (like the ones presented above) will present computational difficulties for a single reason: the overlapping intervals. So the first thing you should do is to split in disjoint intervals in a way that is consistent with the given probabilities. My choice $$P([0,1])=0.4, \ P([1,2])=0.2, \ P([2,3])=0.2, \ P([3,4])=0.1, \ P([4,5])=0.1$$
Now the solution follows immediately by choosing $f$ to be piecewise quadratic with roots the bounds of each interval: $$f(x)=\begin{cases}c_1(x-0)(x-1),&0\le x< 1\\c_2(x-1)(x-2),&1\le x< 2\\c_3(x-2)(x-3),&2\le x< 3\\c_4(x-3)(x-4),&3\le x< 4\\c_5(x-4)(x-5),&4\le x< 5\\0,&\text{otherwise}\end{cases}$$ Since the intervals do not overlap there is much leeway in the choice of $f$ in each interval. The previous choice is one possibility, another one would be triangle distribution in each interval and many more (that preserve continuity of course). So, now start solving $$P([k,k+1])=\int_{k}^{k+1}c_k(x-k)(x-(k+1))dx$$ for $0\le k\le 4$.
