A student tosses a fair coin times and lets be the number of heads observed. Thus
For a complicated risk measure, the student needs the value of the fourth moment . Define
Compute the exact integer value of .
[PYTHON] import math
def compute_k(): n = 20 # Calculate the sum S = sum(k^4 * binom(n, k)) S = 0 for k in range(n + 1): term = (k**4) * math.comb(n, k) S += term
# E[N^4] = S / 2^20
# K = 1000 * E[N^4] = 1000 * S / 2^20
# Let's compute K using floating point first to check
expected_value_n4 = S / (2**20)
K = 1000 * expected_value_n4
print(f"{S=}")
print(f"{expected_value_n4=}")
print(f"{K=}")
# Check if it's an integer
if K.is_integer():
print(f"Integer K: {int(K)}")
else:
print("K is not an integer directly?")
compute_k() [/PYTHON]
The random variable follows a binomial distribution with and . The fourth moment of a binomial distribution can be expressed using Stirling numbers of the second kind, , as: [ \mathbb{E}[N^k] = \sum_{j=0}^k S(k, j) (n)_j p^j ] where is the falling factorial. For , the Stirling numbers are . Thus, [ \mathbb{E}[N^4] = 1 \cdot (n)_1 p + 7 \cdot (n)_2 p^2 + 6 \cdot (n)_3 p^3 + 1 \cdot (n)_4 p^4 ] Substituting and : \begin{align*} (n)_1 p &= 20 \cdot 0.5 = 10 \ (n)_2 p^2 &= 20 \cdot 19 \cdot 0.25 = 95 \ (n)_3 p^3 &= 20 \cdot 19 \cdot 18 \cdot 0.125 = 855 \ (n)_4 p^4 &= 20 \cdot 19 \cdot 18 \cdot 17 \cdot 0.0625 = 7267.5 \end{align*} Now summing these terms weighted by Stirling numbers: \begin{align*} \mathbb{E}[N^4] &= 1(10) + 7(95) + 6(855) + 1(7267.5) \ &= 10 + 665 + 5130 + 7267.5 \ &= 13072.5 \end{align*} Finally, we compute : [ K = 1000 \cdot \mathbb{E}[N^4] = 1000 \cdot 13072.5 = 13072500 ] The Python code confirmed this result directly by summing .
\boxed{13072500}