# Symbolic manipulation of the moments of an unknown distribution

I'm curious as to whether it's possible to get Mathematica to simplify/manipulate/expand basic expectations, conditional expectations, sums of random variables, etc. A simple example might be:

$$Var(X+Y)=E[(X+Y)^2]-(E[X]+E[Y])^2$$

It's trivial to show this can be expanded to:

$$Var(X+Y)=E[X^2]+2E[XY]+E[Y^2] - E[X]^2-2E[X]E[Y]-E[Y]^2$$

and then simplified to

$$Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y)$$

These sorts of manipulations are easy enough by hand, but when I'm exploring lots of different possibilities, it's easy to get bogged down, make mistakes, etc. It would be nice to get mathematica to do the manipulations for me. However, I haven't been able to figure out how to get Mathematica to perform these sorts of operations without defining an actual distribution. Thoughts?

-