6
$\begingroup$

I.e., if I flipped five non-absolute values, then averaged them, then got the absolute value as the result, and I did that infinite times, what would be the average value of the result?

What mathematical method would I use to calculate this? I've only taken up to precalculus and I anticipate that calculating this would involve something I haven't learned yet but I don't know what it is.

$\endgroup$
5
  • 2
    $\begingroup$ See en.wikipedia.org/wiki/Binomial_distribution and en.wikipedia.org/wiki/Law_of_the_unconscious_statistician $\endgroup$ Commented Feb 26, 2023 at 21:12
  • $\begingroup$ Disregarding the theoretical answers, if you flipped a coin a certain number of times, picking it up the same way every time and flipping it the same way every time, it would not be truly random. If you used a machine to flip the coin, it would be even less random. $\endgroup$
    – D4VE77
    Commented Feb 28, 2023 at 1:49
  • $\begingroup$ Please add the self-study tag & read its wiki. Then tell us what you understand thus far, what you've tried & where you're stuck. We'll provide hints to help you get unstuck. Please make these changes as just posting your homework & hoping someone will do it for you is grounds for closing. $\endgroup$ Commented Feb 28, 2023 at 13:55
  • 1
    $\begingroup$ @kjetil b halvorsen Why do you think it's self-study or a homework question? I'm giving a concrete question because it's simpler and easier to read than the general problem I'm getting at. This question does not resemble anything I've ever seen in any subject. Your presumption is also contradicted by the second paragraph. I am not even aware of what mathemtical "subject" this would involve so it could not be perceived as a "routine exercise". $\endgroup$
    – user84614
    Commented Mar 3, 2023 at 8:40
  • $\begingroup$ @D4E77 I gave a concrete example because it's easier than the abstract generalization I am hoping to understand through it. Thank you for your comments though. $\endgroup$
    – user84614
    Commented Mar 3, 2023 at 8:42

5 Answers 5

13
$\begingroup$

The distribution is binomial distributed and with that you can compute this manually.

If $X$ is the average of five coin flips (which I assume are fair) then

$$\begin{array}{} P(X = -1) &=& \frac{1}{2^5}\\ P(X = -0.6) &=& \frac{5}{2^5}\\ P(X = -0.2) &=& \frac{10}{2^5}\\ P(X = 0.2)& =& \frac{10}{2^5}\\ P(X = 0.6) &=& \frac{5}{2^5}\\ P(X = 1) &=& \frac{1}{2^5} \end{array}$$

And the expectation value for any function of the variable is

$$E[f(X)] = \sum_x P(X=x) \cdot f(x)$$

with $f(X) = |X|$ you can get your answer which should be close to the approximation below.


In the limit, you can estimate this with the half normal distribution, which has an expectation value of $\sigma \sqrt{\frac{2}{\pi}}$ and the distribution of the mean of $n$ coin flips is approximated by taking $\sigma = 1/ \sqrt{ n}$ giving

$$E[|X_n|] \approx \sqrt{\frac{2}{n\pi}}$$

which is equal to about $0.3568248$ in the case of $n = 5$, a bit less than 5% away from the exact answer.

$\endgroup$
4
  • $\begingroup$ @thegreatemu the question is a beginner's question and it is a good exercise for any readers to perform the computation. $\endgroup$ Commented Feb 28, 2023 at 6:29
  • $\begingroup$ Seems my original comment was unpopular enough to be deleted. I understand the sentiment, but the only thing you've omitted is a mechanical calculation step, which I would argue is the least educationally useful step $\endgroup$ Commented Feb 28, 2023 at 19:17
  • $\begingroup$ @thegreatemu originally I did have the final computation in the answer. I deleted it a couple of minutes later because it would make it too easy to arrive at a solution to a question which is probably some exercise. I didn't want to generate the possibility that my answer will lead to a short cut. Doing the computation manually may not be very educational, but it does ensure that any readers will be forced to read the full answer and try to understand it, rather than copy-pasting the final conclusion. It is not just the computation, but also the understanding of performing the computation. $\endgroup$ Commented Feb 28, 2023 at 19:51
  • $\begingroup$ fair enough. Thanks for the response $\endgroup$ Commented Feb 28, 2023 at 19:55
10
$\begingroup$

In addition to the excellent answers by Sextus Empiricus and Dave, when you don't know how to approach a problem, a naive but very effective way to get an approximate answer is by just simulating the process you describe.

In R you could do this as follows:

set.seed(1234)
MC <- 1e5
x  <- numeric(MC)
for(i in 1:MC){
    x[i] <- abs(mean(sample(c(-1, 1), 5, replace = TRUE)))
}
mean(x)

Which results in 0.37564, fairly close to the actual answer. Even when you think you know how to answer a question, simulation can still be useful to 'check' your results.

$\endgroup$
5
$\begingroup$

Since this appears to be a question, I will give some guidance rather than solve it all.

You can be very formal about how to define average value (what statisticians and mathematicians would call an expected value), to which the linked content about the law of the unconscious statisticians refers. However, taking advanced proofs as given (they are, after all, true), the average you seek is the sum of the values resulting from your procedure (add up the values, then take the absolute value), with each value weighted by the probability of it occurring.

Define $v_i$ as the value arising from applying your procedure to flipping $i$ heads, so $v_5 = 5$, $v_0=5$, $v_2 = 1$, etc. Next, define $p_i$ as the probability of flipping $i$ heads, so $p_5 = p_0 = 0.5^5 = 0.03125$, etc.

Then the sum of the values weighted by the probability of obtaining that value, is:

$$ \overset{5}{\underset{i=0}{\sum}} p_iv_i = p_0v_0 + p_1v_1 + p_2v_2+p_3v_3 + p_4v_4 + p_5v_5 $$

Now just calculate those $p_i$ and $v_i$ values, and I've already given you some (but make sure you know how to calculate them). I think you will find $v_i$ trivial. For $p_i$, you will find life easier if you use the PMF of the binomial distribution, which is contained in the linked Wikipedia article in the comments (and again here).

$\endgroup$
5
$\begingroup$

There are 32 different equally probable outcomes of 5 throws, of which two have absolute value of sum of throws equal to 5, 10 have 3, and 20 have 1, so total sum of all these cases is $5\times2 + 3\times10 + 1\times20 = 60$. To get average, we need to devide 60 by number of total cases which is 32. $\frac{60}{32} = \frac{15}{8}$. That is expectation of sums, average is sum divided by 5, so if you want to get expectation of averages, then you divide expectation of sums by 5 and get $\frac{3}{8}$.

$\endgroup$
1
  • $\begingroup$ Is there a way you could figure out what all the possibilities are simply. $\endgroup$
    – user84614
    Commented Jun 3, 2023 at 4:49
-1
$\begingroup$

I get zero by two methods, a Mathematica simulation, and a counting argument. Mathematica simulation:

results = {}; results2={};
Module[{n = 10000000, outer, inner},
 AbsoluteTiming[
  For[k = 1, k <= 5, ++k,
   sum1 = 0;
   For[outer = 1, outer <= n, ++outer,
    sum2 = 0;
    For[inner = 1, inner <= 5, ++inner,
     sum2 += RandomChoice[{-1, 1}]
     ];
    AppendTo[results,sum2];
    sum1 += sum2/5.0;
    ];
   Print["{n, sum2, sum1/n}", {n, sum2, sum1/N[n]}];
   AppendTo[results, {n, sum2, sum1/N[n]}];
   ]
  ]
 ]
results:
n = # Flips  Sum last       Average of n flips
              5 flips
10000,          1,        0.0006400000000000063
10000,         -3,       -0.007840000000000005
10000,         -1,       -0.004319999999999987
10000,         -3,       -0.0022799999999999947
10000,          1,        0.00899999999999997
100000,        -1,        0.0005719999999999979
100000,         3,        0.0025119999999999774
100000,        -1,       -0.000683999999999993
100000,        -3,       -0.0034999999999999923
100000,        -1,        0.0016439999999999894
1000000,       -3,       -0.00005719999999999856
1000000,        1,        0.0005504000000000307
1000000,        1,        0.000036799999999996686
1000000,       -1,        0.00013999999999999622
1000000,        1,        0.0006572000000000153
10000000,      -1,       -0.00001588000000000591
10000000,       3,       -2.8800000000038654e-6
10000000,       1,       -0.00011363999999998875
10000000,       3,        0.00022167999999998797
10000000,      -1,        0.000014039999999994434

The counting argument: only six sums are possible -5,-3,-1,+1,+3,+5 and the averages are those divided by 5. The sums of equal absolute value have an equal number of terms. Since the negative and positive values cancel each other out, the average is zero.

Here is a count of the number of sums of each kind: Tally[results2] -> {{-1, 312475}, {1, 312595}, {5, 31378}, {-3, 155964}, {3, 156121}, {-5, 31467}}

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.