PDF with two expressions

49 Views Asked by At

When we have a probability density function, $f(x)$ for $a<x<b$, then the mean is $\int_{a}^{b} xf(x) dx$. My question is, what happens when we have different expressions for $f(x)$ within different ranges? For example, $$f(x) = \begin{cases} x^2 & a\leq x < b\\ 2x & b \leq x < d \end{cases}$$ How would we find the mean now? Would we just do it over the two ranges?

1

There are 1 best solutions below

1
On

How would we find the mean now? Would we just do it over the two ranges?

Yes.

To be clear, you sum the integrals of the piecewise function $f$ over the intervals of each piece.   For this piece-wise density, $$\begin{align}\Bbb E[X]\quad & = \int_a^d x\, f(x)\,\operatorname dx \\[1ex] & = \int_a^b x\,f(x)\operatorname d x+\int_b^d x\,f(x)\operatorname d x\\[1ex] & = \int_a^b x\cdot x^2\,\operatorname d x+\int_b^d x\cdot 2x\,\operatorname d x \\[2ex] & = \tfrac 1 4(b^4-a^4)+\tfrac 2 3 (d^3-b^3)\end{align}$$