Can anyone help me solve this problem on probability ? Passengers try repeatedly to get a seat reservation in any train running between two stations until they are successful. If there is 40% chance of getting reservation in any attempt by a passenger, then the average number of attempts that passengers need to make to get a seat reserved is ?
 A: First, think about it like this:
Since 40% of people are successful at getting a reserved train seat, 60% of people aren't. The 60 % of the people who were unsuccessful try again, and $0.6\cdot 0.6 = 0.36$, or 36% fail again. This continues, but there will always be a small percent of people who are unsuccessful at getting a train ticket, but those people don't matter.
Median
The first time, 40% are successful, and the second time, $100-36 = 64$% are now successful, including the 40% who are successful the first time. 
This means that the median person will succeed after 2 attempts.
Mean
The Mean is a little bit more tricky, but we can approximate.


*

*The first time, $40$% were successful.

*The second time, $64-40 = 24$% were successful.

*The third time, after multiplying again, $21.6$% were unsuccessful, so $100-21.6$ = $78.4,$ and $78.4-64 = 14.4$% were successful.
You might notice a trend. $\frac {40}{24} = \frac {5}{3}$, and $\frac {24}{14.4} = \frac {5}{3}$. Assuming this continues, we can calculate the mean.


*

*After counting the first three trips, the average is 1.312.

*Counting only the first five trips, the average is (about) 1.9168.

*After ten trips, the average is (about) 2.4244.

*After 25 trips, the average is (about) 2.4999.

*After 100 trips, the average is (about) 2.5.
We can say that the mean is 2.5.
I used Java Eclipse to calculate Mean. The code is here.
public static double Calc(int x) {
    double answer = 0;
    double power = 0.4;
    for (int i = 1; i < x + 1; i++) {
        answer += i * power;
        power = power * 0.6;
    }
    return answer;
}

