# Constructing a piecewise probability density function

Here I'm trying to construct a probability density function in the form $$f(t) = \begin{cases} at, & t \in [0, 5) \\ b\sqrt{t}, & t \in [5, 20]\text{.} \end{cases}$$ Of course, $$\int\limits_{0}^{20}f(t) = 1 \implies 12.5a + 52.17491948b = 1\text{.}$$ Since $f > 0$ in $[0, 20]$, I have to figure out what values $a$ and $b$ to choose so that $f > 0$. For this to work, I see that $a > 0$ and $b > 0$.

Then I have $$a > 0 \implies \dfrac{1-52.17491948b}{12.5} > 0 \implies b < 0.019$$ approximately, and $$b > 0 \implies \dfrac{1-12.5a}{52.17491948} > 0 \implies a < 0.08\text{.}$$ It thus follows that $a + b < 0.099$ish, so I thought if I took $a + b = 0.09$ that I would get valid values for $a$ and $b$.

I have two equations: \begin{align} &12.5a + 52.17491948b = 1 \\ &a + b = 0.09 \implies 12.5a + 12.5b = 0.09(12.5) = 1.125\text{.} \end{align} It thus follows that $39.67491948b = -0.125$, which gives a negative $b$.

What am I doing wrong here?

In short: I'm wondering if given a value for $a + b$ that I can create a valid probability density function.

• I don't understand what you are doing with the line $a + b = 0.09 \implies 12.5a + 12.5b$. – JessicaK Apr 12 '15 at 19:08
• @JessicaK - Multiply all terms by $12.5$. – Clarinetist Apr 12 '15 at 19:09

Solve $a$ and $b$ from the equations:
• $ra+sb=1$
• $a+b=c$
Here $r$ and $s$ are allready known to you and $c$ denotes a fixed number.
This comes to finding (linear) expressions for $a$ and $b$ in $c$.
Then check for wich $c$ the solution $\langle a,b\rangle$ satisfies $a\geq0\wedge b\geq0$.
For each of them the corresponding $f(t)$ is a PDF.