# Expected value of uniform discrete distribution

I have this discrete uniform distribution:

(caso contrario = otherwise)

I need to calculate the expected value so I did:

$$\frac{(b-a)}{2} = \frac{4}{2} = 2$$

My professor did (these probabilities are found in another exercise):

$$(1*\frac{1}{6})+(2*\frac{1}{3})+(3*.5) = 2.3333...$$

Which one is correct? Are both correct? The values are nearly the same.

• This isn't a uniform distribution, since the function $f$ isn't constant. Your professor's method is the correct approach. May 21 '20 at 21:59
• That distribution is not uniform. The second method is correct, the first is not.
– lulu
May 21 '20 at 22:01

Note that your distribution is not a uniform distribution (for which $$f(x)$$ is a constant independent of $$x$$), although it is a discrete distribution. Just like all other probability distributions, all probabilities should sum up to be 1 for your random variable too. In your case, this means, $$f(1) + f(2) + f(3) = 1$$ (since the probability is zero for all other values of x). This means, $$c + 2c + 3c = 1 \implies 6c = 1 \implies c = 1/6.$$
So now, the expected value is given by: $$E(X) = P(x=1).x + P(x=2).x + P(x=3).x$$ (Ignoring other values of x above since their probability is zero) $$E(X) = f(1) + 2*f(2) + 3*f(3) = 1/6 + 2 * 2/6 + 3* 3/6 = 14/6 = 2.333 \ldots$$
I think you need to start with computing $$c$$, which is the constant, to normalize the distribution function, which is $$\frac{1}{6}$$ in you case. Since it's a discrete distribution, expectation is $$\mathbf{E}X=\sum_{k=1}^{3}k P(X=k) = \frac{14}{6}$$