# Expectation of 2 random variable, E(|X-Y|^a)

#### Micle

Hi, anyone help please.

Let X and Y are independent uniform random variables over the interval [0,1]
E[|X-Y|a]=?

where, a>0

#### jambaugh

Science Advisor
Gold Member
Do you have any restrictions on a? Is it integer or any real number?

I suggest you start with the definition of the expectation value... you sum or integrate over values times the probability distribution:

$$E(g(X,Y)) = \int_{x,y\in[0,1]} g(x,y)\cdot f(x,y) dxdy$$
where f(x,y) is the joint probability distribution. Since X and Y are both uniform the joint distribution will be f(x,y) = constant. You can determine this constant by normalization:
$$\int_{x,y\in [0,1]} f(x,y) dx dy = 1$$

As far as doing the integral involving the absolute value you should break the square over which you are integrating into the region where (x-y)>0 and (x-y)<0.

#### Micle

The exercise doesn't tell that a is interger or real number, then I just consider it as real number.

As your suggestion, I do following,
Let Z = X-Y, where |Z|>0 and Z $$\in$$[-1,1]

E[|Z|a] = $$\int$$$$^{1}_{-1}$$Zadz
= $$\int$$$$^{1}_{0}$$Zadz - $$\int$$$$^{0}_{-1}$$Zadz
= $$\frac{1}{a+1}$$ - $$\frac{1}{a+1}$$(-1)a+1

=$$\frac{1}{a+1}$$(1-(-1)a+1).

Sorry for my poorness, this is corrected or not?

#### jambaugh

Science Advisor
Gold Member
Not quite. You still have to integrate over an area so you need two variables. I would stick to x and y but use the substitution for for finding indefinite integral.

Consider the area over which you must integrate is the square 0<x<1,0<y<1.
|y
|___
|.....|
|___|___ x

The boundary at which the absolute value changes from equal, to negative of is the line y=x which is the diagonal of this square.

You integrate over each of the two triangles separately.
__
| / /|
|/ / | (hope the spacing comes out right)
In the upper triangle y>x so |x-y| = (y-x).
In the lower triangle x>y so |x-y| = (x-y).

So integrate |x-y|^a over each triangle making the above substitutions.

Something like:
$$\int_{y=0}^1\int_{x=0}^y(y-x)^a dx dy$$
for the lower triangle.
You may use (z=x-y) or (z=y-x) as a variable substitution to do the indefinite integrals but convert your answer back to x's and y's to evaluate at the limits.

#### Micle

Thanks for your advice, let me try!

### The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving