To find the variance of a probability density function (PDF), you need to calculate the expected value of the squared difference between each value and the mean (expected value) of the distribution. Here's a step-by-step explanation:
Steps to Calculate Variance
-
Determine the Probability Density Function (PDF): You must have the PDF, denoted as f(x), which describes the probability distribution of the continuous random variable.
-
Calculate the Expected Value (Mean): The expected value, often denoted as μ or E(X), is the mean of the distribution. For a continuous PDF, it is calculated as:
μ = E(X) = ∫x * f(x) dx
where the integral is taken over the entire range of possible values of x.
-
Calculate the Variance: The variance, denoted as σ2 or Var(X), measures the spread or dispersion of the distribution around its mean. It is calculated as:
σ2 = Var(X) = E[(X - μ)2] = ∫(x - μ)2 * f(x) dx
Again, the integral is taken over the entire range of possible values of x. This formula calculates the weighted average of the squared differences between each value and the mean, using the PDF as the weight.
-
Alternatively Calculate the Variance: You can also use the following formula, which is mathematically equivalent and often easier to compute:
σ2 = E(X2) - [E(X)]2 = ∫x2 * f(x) dx - μ2
This involves calculating the expected value of X2 and subtracting the square of the expected value of X (which you already calculated in step 2).
Example
Let's say you have a probability density function f(x) = 2x for 0 ≤ x ≤ 1.
-
PDF: f(x) = 2x
-
Expected Value (Mean):
μ = ∫01 x * (2x) dx = ∫01 2x2 dx = [2x3/3]01 = 2/3 -
Variance (using the first formula):
σ2 = ∫01 (x - 2/3)2 (2x) dx = ∫01 (x2 - (4/3)x + 4/9) (2x) dx = ∫01 (2x3 - (8/3)x2 + (8/9)x) dx
σ2 = [x4/2 - (8/9)x3 + (4/9)x2]01 = 1/2 - 8/9 + 4/9 = 1/2 - 4/9 = 1/18 -
Variance (using the alternative formula):
E(X2) = ∫01 x2 * (2x) dx = ∫01 2x3 dx = [x4/2]01 = 1/2
σ2 = E(X2) - [E(X)]2 = 1/2 - (2/3)2 = 1/2 - 4/9 = 1/18
Therefore, the variance of this probability density function is 1/18.
Key Considerations
- Integration: The calculations involve integration. Make sure you know how to integrate the expressions correctly.
- Range: Ensure you correctly define the range over which the PDF is defined. The integration limits are determined by this range.
- PDF Properties: The PDF must integrate to 1 over its entire range. If it doesn't, it's not a valid PDF.
By following these steps, you can accurately calculate the variance of any probability density function.