Expected value of $3 \circ 3 \circ 3 \circ \dotsc \circ 3$, with $\circ \in \{+,-,\times,\div\}$

120 Views Asked by At

You are given an expression with $n$ 3's and $n-1$ $\circ$'s and you wish to evaluate the expected value of $3 \circ 3 \circ 3 \circ \dotsc \circ 3$, with $\circ \in \{+,-,\times,\div\}$.

What I did was notice that we really only care about "blocks" of numbers where each block only has the multiplication and division operators, since multiplication and division have the same precedence, the "sum" can be "grouped" into those different blocks as $$\sum_{b \in B} b$$ where each block has some sort of sign attached to it by the first element in that respective block.

Then, we only care about the first block since each block after that has an equal chance of being positive or negative, thus the expected value of them all will sum to 0. So we need to figure out the expected value of the first block. The way I tried doing this was using a sum to iterate over all blocks of size $k$. That would yield $$\mathbb{E}[k] = \frac{1}{4^{k-1}} \cdot \sum_{j=0}^{k-1} \binom{k-1}{j} 3^{k-2j}$$ because there are $k-1$ operators in there, they all either must be $\times,\div$ out of 4 possible operators, and I just iterated over all possible combinations of $\times$ and $\div$. That simplifies to $\mathbb{E}[k] = \frac{18}{5} \cdot \left(\frac{5}{6}\right)^k$

Now, since I have the expected value of each block of size $k$, I figured all I had to do was sum it up and weight it with the probability of that block occurring, which should be $$\sum_{k=1}^n \mathbb{E}[k] \cdot \frac{1}{2^k}$$ but this is wrong.

The correct answer is the solution to the recurrence $$\mathbb{E}[n] = \frac{5}{6}\mathbb{E}[n-1] + \frac{3}{2}, \mathbb{E}[1] = 3$$.

What's wrong with my method?

2

There are 2 best solutions below

0
On BEST ANSWER

Your strategy works but you made some minor mistakes.

1. Let $\star_i$, $i=1,2,\ldots$, be independent random operators which takes values $\times$ and $\div$ with equal probabilities. In light of the operator precedence, we can write:

$$ 3 \star_1 3 \star_2 \cdots \star_k 3 = 3 \cdot \prod_{i=1}^{k} (1 \star_i 3). $$

is three times the product of $k$ i.i.d. RVs that takes values $3$ or $\frac{1}{3}$ with equal probabilities. Therefore, the expected value of the product is:

$$ \mathbf{E}[3 \star_1 3 \star_2 \cdots \star_k 3] = 3 \cdot\prod_{i=1}^{k} \mathbf{E}[1 \star_i 3] = 3 \left( \frac{5}{3} \right)^k. $$

2. Now let $A_n$ denote the outcome of $n$ random arithmetic operations as in OP's setting. By applying the same reasoning as in the OP, we get:

\begin{align*} \mathbf{E}[A_n] &= \sum_{k=0}^{n} \mathbf{E}[A_n ; \text{1st block has $k$ operators}] \\ &= \sum_{k=0}^{n-1} 3 \left( \frac{5}{3} \right)^k \frac{1}{2^{k+1}} + 3 \left( \frac{5}{3} \right)^n \frac{1}{2^n} \\ &= 9 - 6 \left(\frac{5}{6}\right)^n. \end{align*}

(Note: The cases $k < n$ and $k = n$ are handled separately, as the determination of the first block differs depending on the scenario.)

3. As a sanity check, the Mathematica code below compares the direct computation and the formula for the value of $\mathbf{E}[A_n]$, $n = 1,\ldots,10$.

Comparison

0
On

Two things.

  • In each block the operators are $\times$ and $\div$ each with probability$\frac12$. So your denominator $4^{k-1}$ should be $2^{k-1}$.
  • In your final sum, the probability is $1/2^k$ when $k=1,2,\ldots,n-1$, but when $k=n$ it is $1/2^{n-1}$ not $1/2^n$.