$c = \frac{1}{9}$
Suppose $X$ has density function $f(x)=c(3−|x|)$ when $−3<x<3$. What value of $c$ makes this a density function?
$c = \frac{1}{9}$
We know one fact quickly: in order for $f(x)$ to be a valid density function:
$$\displaystyle\int_{\forall x \in supp(X)} f(x) dx = 1$$.
The only real wrinkle to this question is that the absolute value operator is annoying, because it cannot be integrated across the entire support of the function. Among other reasons, the annoyance of this integral is one of the reasons that we prefer Mean Squared Error as a model evaluation metric, rather than, say Mean Absolute Deviations.
In order to solve this question, we can break the function into two parts and integrate each of the parts.\begin{align}\displaystyle\int_{-3}^{0} (3 - (-x)) dx &= \displaystyle\int_{-3}^{0} (3 + x) dx \\
&= \frac{1}{2} 3x + x^2 \bigg|^{0}_{-3}\end{align}
Or... we can be a little bit sneaky. We know that the absolute value function creates a right isosceles triangle. And, given the support provided in the question, we know that this triangle is going to be symmetric with its hypotenuse on the x-axis. We can use this symmetry to note that the right isosceles triangle can be broken into two smaller right triangles, each of which contain $$0.50$$ of the probability distribution.
Remembering back to 4th grade geometry identities, we know that the area of a triangle is
\[\frac{1}{2} \cdot base \cdot height\]
And, that given our setup, this value must equal $$0.5$$. Because the base is determined by the support of the function, we know that the length of the base is 3. Filling in what we know:\[\begin{aligned}0.5 &= \frac{1}{2} \cdot 3 \cdot height \\
1 &= 3 \cdot height \\
\frac{1}{3} &= height\end{aligned}\]So, we can conclude function needs to produce a triangle with max height $\frac{1}{3}$. We know this max height will occur at the point $x=0$ and so we can solve the simple equation $c(3 - 0) = \frac{1}{3} \rightarrow \mathbf{c = \frac{1}{9}}$.
Honestly, we probably wouldn't actually solve it this way, but I (Alex here...) wanted to show that we can hack through a lot of these probability questions with very rudimentary math. And, now you can tell your families that you're getting an advanced data science degree... using fourth-grade math. :joy: