A continuous random variable has probability density function
Find and .
Check that really is a density. A legitimate pdf is non-negative and integrates to :
Geometrically this is a triangle with base and height , area . Confirming this first is cheap insurance against a mis-copied piece.
Compute piece by piece. Because the density is defined in two pieces, the expectation integral splits at :
Notice the shortcut you could have used. The triangle is symmetric about : and for . For any density symmetric about a point, the mean is that point, so without integrating at all. The integral above is then just a check.
Compute , which symmetry cannot give you.
Evaluating the bracket at gives ; at it gives . So the second integral is and
Apply the shortcut formula for the variance.
The standard deviation is .
Check that the answer is plausible. All the probability lives in , an interval of length , so the standard deviation must be well under ; is comfortable. It is also smaller than the of a uniform distribution on , which is exactly right — the triangular density concentrates mass near its centre instead of spreading it evenly.
Need to solve a different problem like this? Open the solver →