# Discrete Random Variable - basic question in probability.

## Homework Statement

If X is a discrete random variable having a probability mass function p(x), the expectation or the
expected value of X, denoted E[X], is defined to be

E[X]=Σ x*p(x)

A biased coin is tossed until “heads” appears for the first time. If the probability of a “head” for
the coin is 2
5 , the expected number of tosses needed to get “heads” for the first time is given b
Σ(n*2/5*(3/5)^(n-1)

the summation is from n=1 to infinite.

Compute the expected value. (the expected value need not be an integer.)

## Homework Equations

Σ(n*2/5*(3/5)^(n-1)=5/2

## The Attempt at a Solution

First I found the number of tosses needed to get heads, but I don't understand how to interpret this in the E[X] formula.
I know that my
p(x)=.40
what is my x ? "tails for the first time" ? how to translate it in a numerical representation ?

and the summation is from n=0 to n=2.5 ??

Thanks,
Roni.

Seems like a geometric distribution.

Let's define X = number of tosses needed until the first head appears.

When x=1, it means that you get a head in your very first toss. So, p(x=1) = 0.4
When x =2, it means that you get a tail in your first toss and a head in your second toss, so p(x=2) = (0.6)(0.4).
When x = 3, ..., p(x=3) = (0.6)^2 (0.4)
...until...
When x = n, ..., p (x=n) = (0.6)^(n-1) x (0.4)

So, your E(X) = summation of x times p(x) [values of x is from 1 to infinity]
= 1 x p(x=1) + 2 x p(x=2) + 3 x p(x=3) + ... + n x p(x=n)
=1x0.4 + 2 x (0.6)(0.4) + 3 x (0.6)^2 x (0.4) + ... + n x (0.6)^(n-1) x (0.4)

Factor out 0.4.

Now, either the E(X) is a value or it might not be convergent. If it's the latter, than E(X) does not exist.

Hope that helps. ;)

Okay, I find the formula for calculating E(X) for a geometric distribution.

E(X) = 1/p. (obtained by using the moment generating function)

So in this case the answer is simply E(X) = 1/0.4 = 2.5 ;)

Last edited:
Okay, I find the formula for calculating E(X) for a geometric distribution.

E(X) = 1/p. (obtained by using the moment generating function)

So in this case the answer is simply E(X) = 1/0.4 = 2.5 ;)

Thank you for your help, it did help me understand.
I just forgot to mention one thing. We should use calculus in our answers.
I don't think we are supposed to use geometric distribution.

However, geometric series might work here.
I just don't know what to do with the 'n'.
the sum of a geometric series is
S=a/(1-r)
the 'r' is 3/5
but I can't figure out the 'a' since it's a constant number.

Thanks.

Last edited:
You're welcome. ;)

I am still not able to solve the problem with the geometric series formula (a/(1-r)).
Is it even possible ?

Thanks

up :)

I think you can use the moment generating function method to compute the sum. It's about differentiation and summation.

The mean is:

E(X) =

∑ x * P(X = x)
x = 0

∑ x * p * q ^ x
x = 0

change the index, the first terms of the sum is zero so we can start the index from 1

∑ x * p * q ^ (x - 1)
x = 1

factor out a p

. . . ∞
p * ∑ x * q ^ (x - 1)
. . x = 1

note that the arguement in the sum is a derivative:
∂ q^x / ∂q = x q ^ (x-1)

. . . ∞
p * ∑ ∂[q ^ (x - 1)] / ∂q
. . x = 1

it is not a trivial task to interchange a sumation and differentiation but it is valid in this case.

. . . . . . . ∞
p * ∂/∂q ∑ q ^ (x - 1)
. . . . . . x = 1

the sum is a geometric sum missing the first term and will evaluate to (1 / (1 - q) - 1)

p * ∂/∂q * (1 / (1 - q) - 1)

take the derivative

p * (1 / (1 - q)²)

write in terms of p

p * ( 1/ (1 - (1-p)² )) = p / p² = 1/p

qed.

You can substitute in the value of p = 0.4 into the working shown above. ;)

I am still not able to solve the problem with the geometric series formula (a/(1-r)).
Is it even possible ?

Thanks

Yes, it is possible. Your expectation for this particular X is

$$\sum_{n=1}^{\infty}n\left( \frac{2}{5} \right) \left( \frac{3}{5} \right)^{n-1} = \frac{2}{5} \sum_{n=1}^{\infty}n \left( \frac{3}{5} \right)^{n-1}$$

The sumation is the derivative of the geometric power series $\sum x^n$ evaluated at 3/5. Since that series sums to 1/(1-x) then our series is 1/(1-x)2.

So

$$\frac{2}{5} \sum_{n=1}^{\infty}n \left( \frac{3}{5} \right)^{n-1} =\frac{2}{5} \cdot \frac{1}{(1 - 3/5)^2} = \frac{2}{5} \cdot \frac{25}{4} = \frac{5}{2}$$.

--Elucidus

Yes, it is possible. Your expectation for this particular X is

$$\sum_{n=1}^{\infty}n\left( \frac{2}{5} \right) \left( \frac{3}{5} \right)^{n-1} = \frac{2}{5} \sum_{n=1}^{\infty}n \left( \frac{3}{5} \right)^{n-1}$$

The sumation is the derivative of the geometric power series $\sum x^n$ evaluated at 3/5. Since that series sums to 1/(1-x) then our series is 1/(1-x)2.

So

$$\frac{2}{5} \sum_{n=1}^{\infty}n \left( \frac{3}{5} \right)^{n-1} =\frac{2}{5} \cdot \frac{1}{(1 - 3/5)^2} = \frac{2}{5} \cdot \frac{25}{4} = \frac{5}{2}$$.

--Elucidus

I was wondering if it's possible to solve it with Riemann Sums ?

I know it's going to give me a good approximation.

Thanks.

Yes, it is possible. Your expectation for this particular X is

$$\sum_{n=1}^{\infty}n\left( \frac{2}{5} \right) \left( \frac{3}{5} \right)^{n-1} = \frac{2}{5} \sum_{n=1}^{\infty}n \left( \frac{3}{5} \right)^{n-1}$$

The sumation is the derivative of the geometric power series $\sum x^n$ evaluated at 3/5. Since that series sums to 1/(1-x) then our series is 1/(1-x)2.

So

$$\frac{2}{5} \sum_{n=1}^{\infty}n \left( \frac{3}{5} \right)^{n-1} =\frac{2}{5} \cdot \frac{1}{(1 - 3/5)^2} = \frac{2}{5} \cdot \frac{25}{4} = \frac{5}{2}$$.

--Elucidus

Now that I am looking at your answer again... I don't think I understand how you are getting 1/(1-x)^2.
I understand that 1/(1-x) would be perfect here if we didn't have the 'n'
....
EDIT:

Now, that I am looking at it again, I noticed that it's the derivative of 1/(1-x).

Thanks.

Last edited: