<s>[INST] probability: continuous uniform distribution mean by symmetry I am trying to show that the mean of the uniform continuous distribution is $(b+a)/2$ by symmetry. The direct method is fairly simple but, for some reason, I cant get this one.
\begin{align}
E[X] &= \int_{-\infty}^{\infty}xp_X(x)dx\\
&= \int_{-\infty}^{\frac{b+a}{2}}xp_X(x)dx + \int_{\frac{b+a}{2}}^{\infty}xp_X(x)dx
\end{align}
Now let $u = x-\frac{b+a}{2}$ for the first integral and $u = \frac{b+a}{2}-x$ for the second integral. Then
$$
\int_{-\infty}^0\Big(\frac{b+a}{2} + u\Big)p_X\Big(\frac{b+a}{2} + u\Big)du + \int_0^{\infty}\Big(\frac{b+a}{2} - u\Big)p_X\Big(\frac{b+a}{2} - u\Big)du
$$
In the uniform distribution on the interval $a$ to $b$, $p_X(x) = \frac{1}{b - a}$. 

At this point, I have just been winging it. For the first integral, $\frac{a-b}{2} < u < \frac{b-a}{2}$. For the second integral, we have $\frac{a-b}{2} < -u < \frac{b-a}{2}\Rightarrow \frac{a-b}{2} < u < \frac{b-a}{2}$. Therefore, $p_X\Big(\frac{b+a}{2} + u\Big) = p_X\Big(\frac{b+a}{2} - u\Big) = \frac{1}{b - a} = p_X(x)$ Then I have
$$
\int_{-\infty}^0up_X(x)du - \int_0^{\infty}up_X(x)dx + \int_{-\infty}^{\infty}\frac{b + a}{2(b - a)}du
$$

but I need 
$$
\int_{-\infty}^0up_X(x)du + \int_0^{\infty}up_X(x)dx = \int_{-\infty}^{\infty}up_X(x)du = \frac{b + a}{2}
$$


Edit 1:
I then tried integrating from $(a, (a+b)/2)$ and $((a+b)/2, b)$ but I end up with
$$
\frac{a+b}{2(b-a)}\int_a^bdu + \int_a^{(a+b)/2}\frac{u}{b-a}du - \int_{(a+b)/2}^b\frac{u}{b-a}du = \frac{a+b}{2} + \frac{ab}{b - a}
$$
so apparently I am missing something.

Edit 2:
Could I say
$$
\int_a^{(a+b)/2}\frac{u}{b-a}du
$$
and
$$
\int_{(a+b)/2}^b\frac{u}{b-a}du
$$
are both half of area so there subtraction is zero? It is very cavalier though. I would like to be able to prove this assertation not just state it and conclude the correct answer. 
 [/INST] Sorry, I didn't read your question carefully enough.
The limit on the second of your integrals after doing the substitutions is wrong.  Since $u=-x + (b+a)/2$ and $x$ runs from $(b+a)/2$ to $\infty$, you should have $u$ running from $0$ to $-\infty$.  I think this is what has mislead you.  The two integrals evaluate to $(3a+b)/8$ and $(a+3b)/8$, so their sum is $(a+b)/2$ as required.
</s>