To show that \( f(x) \) is a probability density function (PDF) of the random variable \( X \), we need to verify two conditions:
- The function \( f(x) \) must be non-negative for all \( x \) in its domain.
- The integral of \( f(x) \) over its domain must equal 1.
Given the function:
\[ f(x) = \begin{cases} 2x - x^2 & \text{for } 0 < x < 2 \ 0 & \text{otherwise} \end{cases} \]
Step 1: Check that \( f(x) \) is non-negative within its domain
Let's analyze \( f(x) \) on the interval \( (0, 2) \).
To check where \( f(x) \) is non-negative, we can set:
\[ 2x - x^2 \geq 0 \]
Rearranging gives:
\[ x(2 - x) \geq 0 \]
The critical points occur when \( x = 0 \) and \( x = 2 \). These points divide the number line into intervals. We can test the sign in these intervals.
- For \( x < 0 \): \( x(2 - x) < 0 \)
- For \( 0 < x < 2 \): Both \( x > 0 \) and \( 2 - x > 0 \) which gives \( x(2 - x) > 0 \)
- For \( x > 2 \): \( x > 0 \) but \( 2 - x < 0 \), so \( x(2 - x) < 0 \)
Thus, \( f(x) \) is non-negative for \( 0 < x < 2 \).
Step 2: Integrate \( f(x) \) over its domain
Next, we need to compute the integral of \( f(x) \) from 0 to 2:
\[ \int_0^2 f(x) , dx = \int_0^2 (2x - x^2) , dx \]
Calculating the integral:
\[ \int_0^2 (2x - x^2) , dx = \int_0^2 2x , dx - \int_0^2 x^2 , dx \]
Calculating each term separately:
- For \( \int_0^2 2x , dx \):
\[ \int 2x , dx = x^2 \quad \text{So: } \quad \left[ x^2 \right]_0^2 = 2^2 - 0^2 = 4 \]
- For \( \int_0^2 x^2 , dx \):
\[ \int x^2 , dx = \frac{x^3}{3} \quad \text{So: } \quad \left[ \frac{x^3}{3} \right]_0^2 = \frac{2^3}{3} - 0 = \frac{8}{3} \]
Now substituting back, we have:
\[ \int_0^2 (2x - x^2) , dx = 4 - \frac{8}{3} = \frac{12}{3} - \frac{8}{3} = \frac{4}{3} \]
Since this result does not equal 1, we realize that \( f(x) \) must be normalized to be a valid probability density function.
Conclusion:
The function \( f(x) \) is not a probability density function as it currently stands because the integral over its domain does not equal 1. To make it a valid PDF, you would need to normalize it. This can be done by dividing the function \( f(x) \) by the integral value \( \frac{4}{3} \):
\[ f_{\text{normalized}}(x) = \frac{3}{4}(2x - x^2) \quad \text{for } 0 < x < 2 \]
This normalized function \( f_{\text{normalized}}(x) \) would then satisfy both conditions of a probability density function.