{
  "index": "1974-A-4",
  "type": "COMB",
  "tag": [
    "COMB",
    "ALG"
  ],
  "difficulty": "",
  "question": "A-4. An unbiased coin is tossed \\( n \\) times. What is the expected value of \\( |H-T| \\), where \\( H \\) is the number of heads and \\( T \\) is the number of tails? In other words, evaluate in closed form:\n\\[\n\\frac{1}{2^{n-1}} \\sum_{k<n / 2}(n-2 k)\\binom{n}{k} .\n\\]\n(In this problem, \"closed form\" means a form not involving a series. The given series can be reduced to a single term involving only binomial coefficients, rational functions of \\( n \\) and \\( 2^{n} \\), and the greatest integer function \\( [x] \\).)",
  "solution": "A-4.\nThe answer is\n\\[\n\\frac{n}{2^{n-1}}\\binom{n-1}{[(n-1) / 2]}\n\\]\nsince\n\\[\n\\begin{aligned}\n\\sum_{k<n / 2}(n-2 k)\\binom{n}{k} & =\\sum_{k<n / 2}\\left\\{(n-k)\\binom{n}{k}-k\\binom{n}{k}\\right\\} \\\\\n& =\\sum_{k<n / 2}\\left\\{n\\binom{n-1}{k}-n\\binom{n-1}{k-1}\\right\\}=n \\sum_{k<n / 2}\\left\\{\\binom{n-1}{k}-\\binom{n-1}{k-1}\\right\\} \\\\\n& =n\\binom{n-1}{[(n-1) / 2]} .\n\\end{aligned}\n\\]",
  "vars": [
    "n",
    "H",
    "T",
    "k"
  ],
  "params": [],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "n": "trials",
        "H": "headsct",
        "T": "tailsct",
        "k": "chooser"
      },
      "question": "A-4. An unbiased coin is tossed \\( trials \\) times. What is the expected value of \\( |headsct - tailsct| \\), where \\( headsct \\) is the number of heads and \\( tailsct \\) is the number of tails? In other words, evaluate in closed form:\n\\[\n\\frac{1}{2^{trials-1}} \\sum_{chooser<trials / 2}(trials-2 chooser)\\binom{trials}{chooser} .\n\\]\n(In this problem, \"closed form\" means a form not involving a series. The given series can be reduced to a single term involving only binomial coefficients, rational functions of \\( trials \\) and \\( 2^{trials} \\), and the greatest integer function \\( [x] \\).)",
      "solution": "A-4.\nThe answer is\n\\[\n\\frac{trials}{2^{trials-1}}\\binom{trials-1}{[(trials-1) / 2]}\n\\]\nsince\n\\[\n\\begin{aligned}\n\\sum_{chooser<trials / 2}(trials-2 chooser)\\binom{trials}{chooser} & =\\sum_{chooser<trials / 2}\\left\\{(trials-chooser)\\binom{trials}{chooser}-chooser\\binom{trials}{chooser}\\right\\} \\\\\n& =\\sum_{chooser<trials / 2}\\left\\{trials\\binom{trials-1}{chooser}-trials\\binom{trials-1}{chooser-1}\\right\\}=trials \\sum_{chooser<trials / 2}\\left\\{\\binom{trials-1}{chooser}-\\binom{trials-1}{chooser-1}\\right\\} \\\\\n& =trials\\binom{trials-1}{[(trials-1) / 2]} .\n\\end{aligned}\n\\]"
    },
    "descriptive_long_confusing": {
      "map": {
        "n": "centipede",
        "H": "blueberry",
        "T": "sunflower",
        "k": "harmonic"
      },
      "question": "A-4. An unbiased coin is tossed \\( centipede \\) times. What is the expected value of \\( |blueberry-sunflower| \\), where \\( blueberry \\) is the number of heads and \\( sunflower \\) is the number of tails? In other words, evaluate in closed form:\n\\[\n\\frac{1}{2^{centipede-1}} \\sum_{harmonic<centipede / 2}(centipede-2 harmonic)\\binom{centipede}{harmonic} .\n\\]\n(In this problem, \"closed form\" means a form not involving a series. The given series can be reduced to a single term involving only binomial coefficients, rational functions of \\( centipede \\) and \\( 2^{centipede} \\), and the greatest integer function \\( [x] \\).)",
      "solution": "A-4.\nThe answer is\n\\[\n\\frac{centipede}{2^{centipede-1}}\\binom{centipede-1}{[(centipede-1) / 2]}\n\\]\nsince\n\\[\n\\begin{aligned}\n\\sum_{harmonic<centipede / 2}(centipede-2 harmonic)\\binom{centipede}{harmonic} & =\\sum_{harmonic<centipede / 2}\\left\\{(centipede-harmonic)\\binom{centipede}{harmonic}-harmonic\\binom{centipede}{harmonic}\\right\\} \\\\\n& =\\sum_{harmonic<centipede / 2}\\left\\{centipede\\binom{centipede-1}{harmonic}-centipede\\binom{centipede-1}{harmonic-1}\\right\\}=centipede \\sum_{harmonic<centipede / 2}\\left\\{\\binom{centipede-1}{harmonic}-\\binom{centipede-1}{harmonic-1}\\right\\} \\\\\n& =centipede\\binom{centipede-1}{[(centipede-1) / 2]} .\n\\end{aligned}\n\\]"
    },
    "descriptive_long_misleading": {
      "map": {
        "n": "zeroings",
        "H": "tailscount",
        "T": "headscount",
        "k": "complete"
      },
      "question": "A-4. An unbiased coin is tossed \\( zeroings \\) times. What is the expected value of \\(|tailscount-headscount|\\), where \\( tailscount \\) is the number of heads and \\( headscount \\) is the number of tails? In other words, evaluate in closed form:\n\\[\n\\frac{1}{2^{zeroings-1}} \\sum_{complete<zeroings / 2}(zeroings-2 complete)\\binom{zeroings}{complete} .\n\\]\n(In this problem, \"closed form\" means a form not involving a series. The given series can be reduced to a single term involving only binomial coefficients, rational functions of \\( zeroings \\) and \\( 2^{zeroings} \\), and the greatest integer function \\( [x] \\).)",
      "solution": "A-4.\nThe answer is\n\\[\n\\frac{zeroings}{2^{zeroings-1}}\\binom{zeroings-1}{[(zeroings-1) / 2]}\n\\]\nsince\n\\[\n\\begin{aligned}\n\\sum_{complete<zeroings / 2}(zeroings-2 complete)\\binom{zeroings}{complete} & =\\sum_{complete<zeroings / 2}\\left\\{(zeroings-complete)\\binom{zeroings}{complete}-complete\\binom{zeroings}{complete}\\right\\} \\\\\n& =\\sum_{complete<zeroings / 2}\\left\\{zeroings\\binom{zeroings-1}{complete}-zeroings\\binom{zeroings-1}{complete-1}\\right\\}=zeroings \\sum_{complete<zeroings / 2}\\left\\{\\binom{zeroings-1}{complete}-\\binom{zeroings-1}{complete-1}\\right\\} \\\\\n& =zeroings\\binom{zeroings-1}{[(zeroings-1) / 2]} .\n\\end{aligned}\n\\]"
    },
    "garbled_string": {
      "map": {
        "n": "xqrvzlpa",
        "H": "mbczrlyo",
        "T": "gjksnuqe",
        "k": "hvydpqom"
      },
      "question": "A-4. An unbiased coin is tossed \\( xqrvzlpa \\) times. What is the expected value of \\( |mbczrlyo-gjksnuqe| \\), where \\( mbczrlyo \\) is the number of heads and \\( gjksnuqe \\) is the number of tails? In other words, evaluate in closed form:\n\\[\n\\frac{1}{2^{xqrvzlpa-1}} \\sum_{hvydpqom<xqrvzlpa / 2}(xqrvzlpa-2 hvydpqom)\\binom{xqrvzlpa}{hvydpqom} .\n\\]\n(In this problem, \"closed form\" means a form not involving a series. The given series can be reduced to a single term involving only binomial coefficients, rational functions of \\( xqrvzlpa \\) and \\( 2^{xqrvzlpa} \\), and the greatest integer function \\( [x] \\).)",
      "solution": "A-4.\nThe answer is\n\\[\n\\frac{xqrvzlpa}{2^{xqrvzlpa-1}}\\binom{xqrvzlpa-1}{[(xqrvzlpa-1) / 2]}\n\\]\nsince\n\\[\n\\begin{aligned}\n\\sum_{hvydpqom<xqrvzlpa / 2}(xqrvzlpa-2 hvydpqom)\\binom{xqrvzlpa}{hvydpqom} & =\\sum_{hvydpqom<xqrvzlpa / 2}\\left\\{(xqrvzlpa-hvydpqom)\\binom{xqrvzlpa}{hvydpqom}-hvydpqom\\binom{xqrvzlpa}{hvydpqom}\\right\\} \\\\\n& =\\sum_{hvydpqom<xqrvzlpa / 2}\\left\\{xqrvzlpa\\binom{xqrvzlpa-1}{hvydpqom}-xqrvzlpa\\binom{xqrvzlpa-1}{hvydpqom-1}\\right\\}=xqrvzlpa \\sum_{hvydpqom<xqrvzlpa / 2}\\left\\{\\binom{xqrvzlpa-1}{hvydpqom}-\\binom{xqrvzlpa-1}{hvydpqom-1}\\right\\} \\\\\n& =xqrvzlpa\\binom{xqrvzlpa-1}{[(xqrvzlpa-1) / 2]} .\n\\end{aligned}\n\\]"
    },
    "kernel_variant": {
      "question": "Two players, A and B, each toss an unbiased coin n times, the two experiments being independent.  \nLet H₁ (resp. H₂) be A’s (resp. B’s) number of heads and set  \n\n  Δₙ = |H₁ − H₂|.\n\n1.  Show that the expectation  \n  E[Δₙ] = 2^{-2n} ∑_{k=0}^{n} ∑_{ℓ=0}^{n} |k−ℓ| \\(\\binom{n}{k}\\)\\(\\binom{n}{ℓ}\\)  \n   has the closed form  \n   E[Δₙ]= n·2^{-(2n-1)} \\(\\binom{2n-1}{\\,n-1}\\).\n\n2.  Deduce the binomial identity  \n   ∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\)= n \\(\\binom{2n-1}{\\,n-1}\\).\n\n(You must give a result that involves no summations over k or ℓ and contains only elementary functions of n and a single binomial coefficient.)",
      "solution": "Step 1 – Expressing the expectation  \nBecause every pair (H₁,H₂)=(k,ℓ) occurs with probability \\(2^{-2n}\\binom{n}{k}\\binom{n}{ℓ}\\),\n\n E[Δₙ]=2^{-2n} ∑_{k=0}^{n} ∑_{ℓ=0}^{n}|k−ℓ|\\(\\binom{n}{k}\\)\\(\\binom{n}{ℓ}\\). (1)\n\nStep 2 – Symmetry reduction  \nSince |k−ℓ|=|ℓ−k|,\n\n ∑_{k,ℓ}|k−ℓ|\\binom{n}{k}\\binom{n}{ℓ}\n  =2 ∑_{0≤k<ℓ≤n}(ℓ−k)\\binom{n}{k}\\binom{n}{ℓ}. (2)\n\nStep 3 – Introducing the distance j=ℓ−k  \nWrite j=ℓ−k (1≤j≤n) and keep k.  Then (2) becomes  \n\n 2 ∑_{j=1}^{n} j ∑_{k=0}^{\\,n-j}\\binom{n}{k}\\binom{n}{k+j}. (3)\n\nStep 4 – Evaluating the inner sum (correct Vandermonde use)  \nBecause k+j≤n, we may replace \\(\\binom{n}{k+j}\\) by \\(\\binom{n}{\\,n-(k+j)}\\).  \nSet m=n−j.  Then\n\n ∑_{k=0}^{\\,n-j}\\binom{n}{k}\\binom{n}{k+j}\n =∑_{k=0}^{m}\\binom{n}{k}\\binom{n}{m-k} (with m=n−j)  \n = \\(\\binom{2n}{m}\\) (by the classical Vandermonde convolution)  \n = \\(\\binom{2n}{\\,n-j}\\)=\\(\\binom{2n}{\\,n+j}\\) (by symmetry r↦2n−r). (4)\n\nInsert (4) into (3):\n\n ∑_{k,ℓ}|k−ℓ|\\binom{n}{k}\\binom{n}{ℓ}\n  = 2 ∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\). (5)\n\nDenote  \n\n Sₙ:=∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\). (6)\n\nStep 5 – A telescoping evaluation of Sₙ  \nWe claim  \n\n j \\(\\binom{2n}{\\,n+j}\\)= n\\,[\\(\\binom{2n-1}{\\,n+j-1}\\) − \\(\\binom{2n-1}{\\,n+j}\\)]. (7)\n\nProof of (7).  Using \\(\\binom{2n}{\\,n+j}=\\dfrac{2n}{n+j}\\binom{2n-1}{\\,n+j-1}\\),\n\n j \\(\\binom{2n}{\\,n+j}\\)=\\dfrac{2nj}{n+j}\\binom{2n-1}{\\,n+j-1}\\)\n = n\\!\\left[\\binom{2n-1}{\\,n+j-1}-\\binom{2n-1}{\\,n+j}\\right],  \n\nsince  \n\\(\\binom{2n-1}{\\,n+j}\\)=\\dfrac{n-j}{n+j}\\binom{2n-1}{\\,n+j-1}\\).  □\n\nInsert (7) into (6):\n\n Sₙ = n ∑_{j=1}^{n}\\left[\\binom{2n-1}{\\,n+j-1}-\\binom{2n-1}{\\,n+j}\\right]. (8)\n\nThe inner sum telescopes:\n\n ∑_{j=1}^{n}\\bigl(\\binom{2n-1}{\\,n+j-1}-\\binom{2n-1}{\\,n+j}\\bigr)\n = \\(\\binom{2n-1}{\\,n}\\) − \\(\\binom{2n-1}{\\,2n}\\)=\\(\\binom{2n-1}{\\,n}\\). (9)\n\n(Here \\(\\binom{2n-1}{\\,2n}\\)=0.)  \nBecause \\(\\binom{2n-1}{\\,n}=\\binom{2n-1}{\\,n-1}\\) the final form is\n\n Sₙ = n \\(\\binom{2n-1}{\\,n-1}\\). (10)\n\nStep 6 – Completing the expectation  \nFrom (5) and (10)\n\n ∑_{k,ℓ}|k−ℓ|\\binom{n}{k}\\binom{n}{ℓ}=2 Sₙ\n  = 2n \\(\\binom{2n-1}{\\,n-1}\\). (11)\n\nInsert (11) into (1):\n\n E[Δₙ] = 2^{-2n}·2n \\(\\binom{2n-1}{\\,n-1}\\)\n    = n 2^{-(2n-1)} \\(\\binom{2n-1}{\\,n-1}\\). (12)\n\nThis is the required closed form with a single binomial coefficient.\n\nStep 7 – The announced binomial identity  \nEquation (5) together with (10) reads\n\n 2 ∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\)=2n \\(\\binom{2n-1}{\\,n-1}\\),\n\nand dividing by 2 gives\n\n ∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\)= n \\(\\binom{2n-1}{\\,n-1}\\),\n\nwhich is exactly the identity requested in part 2. □",
      "metadata": {
        "replaced_from": "harder_variant",
        "replacement_date": "2025-07-14T19:09:31.612572",
        "was_fixed": false,
        "difficulty_analysis": "• Higher dimensionality: the original problem involved one random variable; the new variant involves the joint distribution of two independent binomial variables, producing a genuine two–dimensional double sum.  \n• Additional combinatorial structure: evaluation requires both a telescoping argument and the Chu–Vandermonde convolution, an identity that is unnecessary in the original one–dimensional case.  \n• Deeper techniques: the proof of the single–sum formula (8) makes use of generating functions (or a slick algebraic manipulation of binomial coefficients) beyond the elementary telescoping used originally.  \n• More steps: the solution passes through symmetry reduction, index transformation, convolution, and a generating–function argument before arriving at the closed form, whereas the original problem is settled by a single elementary telescoping.  \nThus the enhanced variant is significantly more technically demanding while preserving the core idea of “distance between two binomial counts.”"
      }
    },
    "original_kernel_variant": {
      "question": "Two players, A and B, each toss an unbiased coin n times, the two experiments being independent.  \nLet H₁ (resp. H₂) be A’s (resp. B’s) number of heads and set  \n\n  Δₙ = |H₁ − H₂|.\n\n1.  Show that the expectation  \n  E[Δₙ] = 2^{-2n} ∑_{k=0}^{n} ∑_{ℓ=0}^{n} |k−ℓ| \\(\\binom{n}{k}\\)\\(\\binom{n}{ℓ}\\)  \n   has the closed form  \n   E[Δₙ]= n·2^{-(2n-1)} \\(\\binom{2n-1}{\\,n-1}\\).\n\n2.  Deduce the binomial identity  \n   ∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\)= n \\(\\binom{2n-1}{\\,n-1}\\).\n\n(You must give a result that involves no summations over k or ℓ and contains only elementary functions of n and a single binomial coefficient.)",
      "solution": "Step 1 – Expressing the expectation  \nBecause every pair (H₁,H₂)=(k,ℓ) occurs with probability \\(2^{-2n}\\binom{n}{k}\\binom{n}{ℓ}\\),\n\n E[Δₙ]=2^{-2n} ∑_{k=0}^{n} ∑_{ℓ=0}^{n}|k−ℓ|\\(\\binom{n}{k}\\)\\(\\binom{n}{ℓ}\\). (1)\n\nStep 2 – Symmetry reduction  \nSince |k−ℓ|=|ℓ−k|,\n\n ∑_{k,ℓ}|k−ℓ|\\binom{n}{k}\\binom{n}{ℓ}\n  =2 ∑_{0≤k<ℓ≤n}(ℓ−k)\\binom{n}{k}\\binom{n}{ℓ}. (2)\n\nStep 3 – Introducing the distance j=ℓ−k  \nWrite j=ℓ−k (1≤j≤n) and keep k.  Then (2) becomes  \n\n 2 ∑_{j=1}^{n} j ∑_{k=0}^{\\,n-j}\\binom{n}{k}\\binom{n}{k+j}. (3)\n\nStep 4 – Evaluating the inner sum (correct Vandermonde use)  \nBecause k+j≤n, we may replace \\(\\binom{n}{k+j}\\) by \\(\\binom{n}{\\,n-(k+j)}\\).  \nSet m=n−j.  Then\n\n ∑_{k=0}^{\\,n-j}\\binom{n}{k}\\binom{n}{k+j}\n =∑_{k=0}^{m}\\binom{n}{k}\\binom{n}{m-k} (with m=n−j)  \n = \\(\\binom{2n}{m}\\) (by the classical Vandermonde convolution)  \n = \\(\\binom{2n}{\\,n-j}\\)=\\(\\binom{2n}{\\,n+j}\\) (by symmetry r↦2n−r). (4)\n\nInsert (4) into (3):\n\n ∑_{k,ℓ}|k−ℓ|\\binom{n}{k}\\binom{n}{ℓ}\n  = 2 ∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\). (5)\n\nDenote  \n\n Sₙ:=∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\). (6)\n\nStep 5 – A telescoping evaluation of Sₙ  \nWe claim  \n\n j \\(\\binom{2n}{\\,n+j}\\)= n\\,[\\(\\binom{2n-1}{\\,n+j-1}\\) − \\(\\binom{2n-1}{\\,n+j}\\)]. (7)\n\nProof of (7).  Using \\(\\binom{2n}{\\,n+j}=\\dfrac{2n}{n+j}\\binom{2n-1}{\\,n+j-1}\\),\n\n j \\(\\binom{2n}{\\,n+j}\\)=\\dfrac{2nj}{n+j}\\binom{2n-1}{\\,n+j-1}\\)\n = n\\!\\left[\\binom{2n-1}{\\,n+j-1}-\\binom{2n-1}{\\,n+j}\\right],  \n\nsince  \n\\(\\binom{2n-1}{\\,n+j}\\)=\\dfrac{n-j}{n+j}\\binom{2n-1}{\\,n+j-1}\\).  □\n\nInsert (7) into (6):\n\n Sₙ = n ∑_{j=1}^{n}\\left[\\binom{2n-1}{\\,n+j-1}-\\binom{2n-1}{\\,n+j}\\right]. (8)\n\nThe inner sum telescopes:\n\n ∑_{j=1}^{n}\\bigl(\\binom{2n-1}{\\,n+j-1}-\\binom{2n-1}{\\,n+j}\\bigr)\n = \\(\\binom{2n-1}{\\,n}\\) − \\(\\binom{2n-1}{\\,2n}\\)=\\(\\binom{2n-1}{\\,n}\\). (9)\n\n(Here \\(\\binom{2n-1}{\\,2n}\\)=0.)  \nBecause \\(\\binom{2n-1}{\\,n}=\\binom{2n-1}{\\,n-1}\\) the final form is\n\n Sₙ = n \\(\\binom{2n-1}{\\,n-1}\\). (10)\n\nStep 6 – Completing the expectation  \nFrom (5) and (10)\n\n ∑_{k,ℓ}|k−ℓ|\\binom{n}{k}\\binom{n}{ℓ}=2 Sₙ\n  = 2n \\(\\binom{2n-1}{\\,n-1}\\). (11)\n\nInsert (11) into (1):\n\n E[Δₙ] = 2^{-2n}·2n \\(\\binom{2n-1}{\\,n-1}\\)\n    = n 2^{-(2n-1)} \\(\\binom{2n-1}{\\,n-1}\\). (12)\n\nThis is the required closed form with a single binomial coefficient.\n\nStep 7 – The announced binomial identity  \nEquation (5) together with (10) reads\n\n 2 ∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\)=2n \\(\\binom{2n-1}{\\,n-1}\\),\n\nand dividing by 2 gives\n\n ∑_{j=1}^{n} j \\(\\binom{2n}{\\,n+j}\\)= n \\(\\binom{2n-1}{\\,n-1}\\),\n\nwhich is exactly the identity requested in part 2. □",
      "metadata": {
        "replaced_from": "harder_variant",
        "replacement_date": "2025-07-14T01:37:45.490304",
        "was_fixed": false,
        "difficulty_analysis": "• Higher dimensionality: the original problem involved one random variable; the new variant involves the joint distribution of two independent binomial variables, producing a genuine two–dimensional double sum.  \n• Additional combinatorial structure: evaluation requires both a telescoping argument and the Chu–Vandermonde convolution, an identity that is unnecessary in the original one–dimensional case.  \n• Deeper techniques: the proof of the single–sum formula (8) makes use of generating functions (or a slick algebraic manipulation of binomial coefficients) beyond the elementary telescoping used originally.  \n• More steps: the solution passes through symmetry reduction, index transformation, convolution, and a generating–function argument before arriving at the closed form, whereas the original problem is settled by a single elementary telescoping.  \nThus the enhanced variant is significantly more technically demanding while preserving the core idea of “distance between two binomial counts.”"
      }
    }
  },
  "checked": true,
  "problem_type": "calculation"
}