Write down the probability density function
f(x)=3−01=31,0≤x≤3 For a rectangular distribution the height of the density is one over the width of the interval.
Write down the integral defining E((X+1)2)
E((X+1)2)=∫03(x+1)2×31dx The expectation of a function of X weights g(x) by the density.
Integrate
E((X+1)2)=[9x(x2+3x+3)]03 The constant density 31 can be taken outside the integral.
Substitute the limits
E((X+1)2)=7−0 Upper limit minus lower limit.
Note that this is not the same as substituting the mean
E((X+1)2)=g(E(X)) The expectation of a function is not the function of the expectation unless g is linear.
Compare with the value of g at the mean
g(E(X))=g(23)=425=7 Substituting the mean into g is a common error; the two values differ.
Identify the antiderivative used
∫(x+1)2×31dx=9x(x2+3x+3)+c Only a single power rule is needed once the density is taken outside.
Interpret the answer as a weighted average
E((X+1)2)=31∫03(x+1)2dx Because the density is constant, E((X+1)2) is just the average value of g(x) across the interval.
Check the answer numerically
E((X+1)2)≈7.0 A decimal check confirms the exact value is of a sensible size.
Find the width of the interval
b−a=3−0=3 Every result for a rectangular distribution is built from this width.
Note the danger of leaving out the density
∫03(x+1)2dx=21=7 Integrating g(x) without the factor f(x) gives the wrong answer.
Note the mean and the variance of X
E(X)=23,Var(X)=43 These are the standard results for the interval in the question.
Integrate the density to obtain the cumulative distribution function
F(x)=∫0x31dt=3x The cdf is the accumulated area under the density up to x.
Recall the probability density function of a rectangular distribution
f(x)=b−a1,a≤x≤b,f(x)=0 otherwise The density is constant on the interval, which is what makes the distribution rectangular.
Recall that the total area under the density must be 1
∫abb−a1dx=b−ab−a=1 The graph is a rectangle of width b−a and height b−a1, so its area is 1.
State the exact value
E((X+1)2)=7 This is the exact value of E((X+1)2).