# Homework Help: Problem with unknown functions in integrals

1. Apr 6, 2014

### pat804

1. The problem statement, all variables and given/known data
I often have a problem dealing with unknown functions in derivations. Recently I was looking at variance of pdf's and tried to do the integral below with no success. Could someone suggest a method, or point out where I am going wrong.

2. Relevant equations
Show ∫(x - μ)2 f(x) dx = ∫x2 f(x) dx - μ2

3. The attempt at a solution
∫x2 f(x) dx -2μ∫x f(x) dx + μ2 ∫f(x) dx

then i try to solve by parts,
x2F(x) - 2∫xF(x)dx - 2μ(xF(x) - ∫F(x)dx) + μ2F(x)
where F(x) = ∫f(x)dx

this doesn't really get me anywhere, does anyone have any suggestions??

2. Apr 6, 2014

### PeroK

Try f(x) = 1 and the equation does not hold.

3. Apr 6, 2014

### Ray Vickson

The result is fasle as written, but it can be made true if written properly (and is then an elementary property developed in Probability 101). I assume that μ is the mean of the distribution f(x)---is that right?

You need to specify limits on all the integrations. If f(x) is the pdf of a random variable on the whole line, the limits are -∞ to +∞. If the random variable is non-negative the limits are 0 and +∞, etc. In any case, for a random variable on $(a,b)$ just substitute in the known values of $\int_a^b f(x) \, dx$ and $\int_a^b x f(x) \, dx$.

4. Apr 6, 2014

### pat804

thanks, yes you're correct μ is the mean. So for definite integrals you just sub in μ=∫xf(x)dx and ∫f(x)=1.

5. Apr 6, 2014

### Ray Vickson

Yes, exactly!

For the record: the result is true in general for any random variable X having finite variance---whether X is continuous, discrete or mixed. The discrete case involves sums instead of integrals, and the mixed case involves both (or Stieltjes' integrals instead of Riemann integrals). The general result is that
$$\text{Var} X \equiv E(X - EX)^2 = E(X^2) - (EX)^2$$

Last edited: Apr 6, 2014
6. Apr 6, 2014

### HallsofIvy

Note that
$$\int (x- \mu)^2f(x)dx= \int (x^2- 2\mu x+ \mu^2)f(x) dx= \int x^2f(x)dx- 2\mu\int xf(x)dx+ \mu^2\int f(x)dx$$

Now use the fact that, as you say, $\int f(x)dx= 1$ and $\int xf(x)dx= \mu$.