A fair coin is tossed until both heads and tails apear [closed]

A fair coin is tossed until both heads and tails have been obtained. Let x = the number of tosses needed (for example, if the sequence of tosses is HHT, then x = 3; If the sequence is TTTTTH, then x = 6).

Find the expected value of x aka E(x).

I think E(x) = 1/P, where P is the probability of getting a heads or tails.

closed as off-topic by Nate Eldredge, Thomas, Davide Giraudo, azimut, Vedran ŠegoOct 2 '13 at 15:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Thomas, Davide Giraudo, azimut, Vedran Šego
If this question can be reworded to fit the rules in the help center, please edit the question.

• What is your attempt? – tylerc0816 Oct 2 '13 at 14:55
• Look at the definition of the expectation. $E(x) = (0 \times \text{probability of stopping after 0 tosses}) + (1 \times \text{probability of stopping after 1 tosses}) + \ldots$. – utdiscant Oct 2 '13 at 14:58

The waiting time after the first toss has geometric distribution, with mean $\frac{1}{1/2}=2$.
So the expected waiting time until each of head and tail has shown up is $3$.