Problem: Let the probability density function of a random variable $X$ be \[ \begin{dcases} x, &\text{ if } 0 \leq x \lt \frac{1}{2} ;\\ c(2x-1)^2, &\text{ if } \frac{1}{2} \leq x \leq 1;\\ 0, &\text{ otherwise} . \end{dcases} \] Find out the value of $c$.
Solution: Note that if $f(x)$ is a probability density function for a random variable $X$, then \[ \int_{-\infty }^{\infty } f(x)~\mathrm{d} x = 1. \]
So, we have \begin{align*} & \int_{-\infty }^{\infty } f(x)~\mathrm{d} x = 1\\ \implies & \int_{-\infty }^0 0~\mathrm{d} x + \int _{0}^{\frac{1}{2}}x~\mathrm{d} x + \int _{\frac{1}{2}}^{1}c(2x-1)^{2} ~\mathrm{d} x + \int _1^\infty 0~\mathrm{d} x = 1 \\ \implies & 0 + \left. \frac{x^{2} }{2} \right|_{0}^{\frac{1}{2}} + c\int_{\frac{1}{2}}^1 \left( 4x^2-4x+1 \right) ~\mathrm{d} x + 0 = 1\\ \implies & \frac{1}{8} + c \left[ \frac{4x^3}{3} - \frac{4x^{2} }{2} + x \right]_{\frac{1}{2}}^1 = 1\\ \implies & c \left[ \frac{1}{3} - \frac{1}{6} \right] = 1-\frac{1}{8}\\ \implies & c = \frac{21}{4}. \end{align*} Thus, \[ \textcolor{blue}{\boxed{c=\frac{21}{4}}} \]