I'm having issues with understanding exactly how Expected Values work, I understand what they are, just not how to get them in all cases. One of the problems I'm having trouble is involves two teams that play a series of games and ends when one of them has won i games. Each game is, independently, won by team A with probability p. Find the expected number of games that are played when i=2 and i=3, also show how a p=1/2 maximizes this number in both cases. I understand what the expected value represents here and what not, just not sure how to set up the problem using p and i to find E(x). Can anyone help me with this?

Sure! I can help you with that. To find the expected number of games that are played, we need to calculate the sum of all possible outcomes multiplied by their respective probabilities.

Let's start with the case when i = 2. There are three possible outcomes:
1. Team A wins the first game, then wins the second game.
2. Team B wins the first game, then Team A wins the second game.
3. Team B wins the first game, then wins the second game.

Let's denote the expected number of games as E(x). From the problem statement, each game is independently won by Team A with probability p. Therefore, Team B has a probability of (1-p) of winning each game.

For the first outcome, the probability is p * p = p^2, and the number of games played is 2.
For the second outcome, the probability is (1-p) * p, and the number of games played is 2.
For the third outcome, the probability is (1-p) * (1-p) = (1-p)^2, and the number of games played is 2.

To find E(x) when i = 2, we calculate:

E(x) = (p^2 * 2) + ((1-p) * p * 2) + ((1-p)^2 * 2)
= 2p^2 + 2(1-p)p + 2(1-p)^2

Now let's simplify this expression:

E(x) = 2p^2 + 2p - 2p^2 + 2 - 4p + 2p^2
= 4 - 2p

So, when i = 2, the expected number of games played is 4 - 2p.

Now, let's look at the case when i = 3. Similarly, there are four possible outcomes:
1. Team A wins the first game, then wins the second and third games.
2. Team B wins the first game, then Team A wins the second and third games.
3. Team B wins the first and second games, then Team A wins the third game.
4. Team B wins the first and second games, then Team B wins the third game.

Using the same method as before, we calculate:

E(x) = (p^3 * 3) + ((1-p) * p^2 * 3) + ((1-p)^2 * p * 3) + ((1-p)^3 * 3)
= 3p^3 + 3(1-p)p^2 + 3(1-p)^2p + 3(1-p)^3

Simplifying this expression further is a bit more complicated, but we can still determine the optimal value of p that maximizes the number of games played.

To maximize the expected number of games played, we want to find the maximum value of E(x) for i = 2 and i = 3. At this point, it is important to note that p is a probability, so it must be between 0 and 1.

If we substitute p = 1/2 into the above expressions, we get:

E(x) for i = 2: E(x) = 4 - 2(1/2) = 3
E(x) for i = 3: E(x) = 3(1/2)^3 + 3(1-(1/2))(1/2)^2 + 3(1-(1/2))^2(1/2) + 3(1-(1/2))^3 = 2.25

Therefore, p = 1/2 maximizes the expected number of games played in both cases.