Derive a CDF from a PDF
UberData Scientist · Technical ScreenLast updated
This question tests the ability to derive a Cumulative Distribution Function (CDF) from a given Probability Density Function (PDF), ensuring proper integration and boundary conditions.
Problem Statement
Suppose a continuous random variable X represents the time (in hours) a rider waits for a ride-share vehicle. The probability density function (PDF) of X is given by:
f(x) = { k * x for 0 <= x < 2, k * (4 - x) for 2 <= x <= 4, 0 otherwise }
- Determine the value of the constant 'k' that makes f(x) a valid probability density function.
- Derive the cumulative distribution function (CDF), F(x), for all real numbers x.
- Verify your CDF by checking the boundary conditions and ensuring continuity at the point x = 2.
Constraints
- The total probability must sum to 1.
- The CDF must be defined for all x in the range (-infinity, +infinity).
Example
If f(x) were a uniform distribution on [0, 1], f(x) = 1, then F(x) = 0 for x 1.
Hints
Hint 1
Recall that the integral of the PDF over its entire support must equal 1, which will allow you to solve for the constant k.
Hint 2
The CDF F(x) is defined as the integral of the PDF from negative infinity to x; remember to calculate this piece-wise for each interval of the PDF.
Hint 3
Ensure that your final F(x) function is continuous at x = 0, x = 2, and x = 4, and that it maps the support to the range [0, 1].
Follow-up questions
- How would the CDF change if the wait time X was conditioned on the event that the rider waited at least 1 hour?
- If you were asked to estimate the median wait time from this distribution, how would you approach it using the CDF you just derived?
- How does the property of the CDF being non-decreasing relate to the non-negativity constraint of the PDF?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.