{
  "index": "2018-A-3",
  "type": "ANA",
  "tag": [
    "ANA",
    "ALG"
  ],
  "difficulty": "",
  "question": "Determine the greatest possible value of $\\sum_{i=1}^{10} \\cos(3x_i)$ for real numbers $x_1,x_2,\\dots,x_{10}$\nsatisfying $\\sum_{i=1}^{10} \\cos(x_i) = 0$.",
  "solution": "The maximum value is $480/49$.\nSince $\\cos(3x_i) = 4 \\cos(x_i)^3 - 3 \\cos(x_i)$, it is equivalent to maximize $4 \\sum_{i=1}^{10} y_i^3$\nfor $y_1,\\dots,y_{10} \\in [-1,1]$ with $\\sum_{i=1}^{10} y_i = 0$; \nnote that this domain is compact, so the maximum value is guaranteed to exist.\nFor convenience, we establish something slightly stronger: we maximize $4 \\sum_{i=1}^{n} y_i^3$\nfor $y_1,\\dots,y_{n} \\in [-1,1]$ with $\\sum_{i=1}^{n} y_i = 0$, where $n$ may be any even nonnegative integer up to $10$,\nand show that the maximum is achieved when $n=10$.\n\nWe first study the effect of varying $y_i$ and $y_j$ while fixing their sum. If that sum is $s$,\nthen the function $y \\mapsto y^3 + (s-y)^3$ has constant second derivative $6s$, so it is either everywhere convex or everywhere concave. Consequently, if $(y_1,\\dots,y_{n})$ achieves the maximum, then for any two indices $i<j$,\nat least one of the following must be true:\n\\begin{itemize}\n\\item one of $y_i$, $y_j$ is extremal (i.e., equal to $1$ or $-1$);\n\\item $y_i = y_j < 0$ (in which case $s<0$ and the local maximum is achieved above);\n\\item $y_i = -y_j$ (in which case $s=0$ above).\n\\end{itemize}\nIn the third case, we may discard $y_i$ and $y_j$ and achieve a case with smaller $n$; we may thus assume that this does not occur. In this case, all of the non-extremal values are equal to some common value $y < 0$, and moreover we cannot have both 1 and -1. We cannot omit 1, as otherwise the condition $\\sum_{i=1}^{n} y_i = 0$ cannot be achieved;\nwe must thus have only the terms 1 and $y$, occurring with some positive multiplicities $a$ and $b$ adding up to $n$. \nSince $a+b=n$ and $a+by = 0$, we can solve for $y$ to obtain $y = -a/b$; we then have\n\\[\n4\\sum_{i=1}^n y_i^3 = a + by^3 = 4a \\left( 1 - \\frac{a^2}{b^2} \\right).\n\\]\nSince $y > -1$, we must have $a < b$. For fixed $a$, the target function increases as $b$ increases,\nso the optimal case must occur when $a+b=10$. The possible pairs $(a,b)$ at this point are\n\\[\n(1,9), (2,8), (3,7), (4,6);\n\\]\ncomputing the target function for these values yields respectively\n\\[\n\\frac{32}{9}, \\frac{15}{2}, \\frac{480}{49}, \\frac{80}{9},\n\\]\nyielding $480/49$ as the maximum value.\n\n\\noindent\n\\textbf{Remark.}\nUsing Lagrange multipliers yields a similar derivation, but with a slight detour required to separate local minima and maxima. For general $n$, the above argument shows that the target function is maximized when $a+b=n$.",
  "vars": [
    "s",
    "x_1",
    "x_2",
    "x_10",
    "x_i",
    "y",
    "y_1",
    "y_10",
    "y_i",
    "y_j"
  ],
  "params": [
    "a",
    "b",
    "i",
    "j",
    "n"
  ],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "s": "sumvalue",
        "x_1": "firstxval",
        "x_2": "secondxv",
        "x_10": "tenthxval",
        "x_i": "genericx",
        "y": "commony",
        "y_1": "firstyval",
        "y_10": "tenthymal",
        "y_i": "genericy",
        "y_j": "alternatey",
        "a": "countone",
        "b": "counttwo",
        "i": "indexone",
        "j": "indextwo",
        "n": "totalnum"
      },
      "question": "Determine the greatest possible value of $\\sum_{indexone=1}^{10} \\cos(3genericx)$ for real numbers $firstxval, secondxv,\\dots, tenthxval$\nsatisfying $\\sum_{indexone=1}^{10} \\cos(genericx) = 0$.",
      "solution": "The maximum value is $480/49$.\nSince $\\cos(3genericx) = 4 \\cos(genericx)^3 - 3 \\cos(genericx)$, it is equivalent to maximize $4 \\sum_{indexone=1}^{10} genericy^3$\nfor $firstyval,\\dots,tenthymal \\in [-1,1]$ with $\\sum_{indexone=1}^{10} genericy = 0$; \nnote that this domain is compact, so the maximum value is guaranteed to exist.\nFor convenience, we establish something slightly stronger: we maximize $4 \\sum_{indexone=1}^{totalnum} genericy^3$\nfor $firstyval,\\dots,y_{totalnum} \\in [-1,1]$ with $\\sum_{indexone=1}^{totalnum} genericy = 0$, where $totalnum$ may be any even nonnegative integer up to $10$,\nand show that the maximum is achieved when $totalnum=10$.\n\nWe first study the effect of varying $genericy$ and $alternatey$ while fixing their sum. If that sum is $sumvalue$,\nthen the function $commony \\mapsto commony^3 + (sumvalue-commony)^3$ has constant second derivative $6sumvalue$, so it is either everywhere convex or everywhere concave. Consequently, if $(firstyval,\\dots,y_{totalnum})$ achieves the maximum, then for any two indices $indexone<indextwo$,\nat least one of the following must be true:\n\\begin{itemize}\n\\item one of $genericy$, $alternatey$ is extremal (i.e., equal to $1$ or $-1$);\n\\item $genericy = alternatey < 0$ (in which case $sumvalue<0$ and the local maximum is achieved above);\n\\item $genericy = -alternatey$ (in which case $sumvalue=0$ above).\n\\end{itemize}\nIn the third case, we may discard $genericy$ and $alternatey$ and achieve a case with smaller $totalnum$; we may thus assume that this does not occur. In this situation, all of the non-extremal values are equal to some common value $commony < 0$, and moreover we cannot have both $1$ and $-1$. We cannot omit $1$, as otherwise the condition $\\sum_{indexone=1}^{totalnum} genericy = 0$ cannot be achieved;\nwe must thus have only the terms $1$ and $commony$, occurring with some positive multiplicities $countone$ and $counttwo$ adding up to $totalnum$. \nSince $countone+counttwo=totalnum$ and $countone+counttwo\\,commony = 0$, we can solve for $commony$ to obtain $commony = -countone/counttwo$; we then have\n\\[\n4\\sum_{indexone=1}^{totalnum} genericy^3 = countone + counttwo\\,commony^3 = 4\\,countone \\left( 1 - \\frac{countone^2}{counttwo^2} \\right).\n\\]\nSince $commony > -1$, we must have $countone < counttwo$. For fixed $countone$, the target function increases as $counttwo$ increases,\nso the optimal case must occur when $countone+counttwo=10$. The possible pairs $(countone,counttwo)$ at this point are\n\\[\n(1,9),\\ (2,8),\\ (3,7),\\ (4,6);\n\\]\ncomputing the target function for these values yields respectively\n\\[\n\\frac{32}{9},\\ \\frac{15}{2},\\ \\frac{480}{49},\\ \\frac{80}{9},\n\\]\nyielding $480/49$ as the maximum value.\n\n\\noindent\n\\textbf{Remark.}\nUsing Lagrange multipliers yields a similar derivation, but with a slight detour required to separate local minima and maxima. For general $totalnum$, the above argument shows that the target function is maximized when $countone+counttwo=totalnum$."
    },
    "descriptive_long_confusing": {
      "map": {
        "s": "shoreline",
        "x_1": "juniperone",
        "x_2": "junipertwo",
        "x_10": "juniperten",
        "x_i": "juniperidx",
        "y": "marigold",
        "y_1": "poppyone",
        "y_10": "poppyten",
        "y_i": "poppyidx",
        "y_j": "poppyalt",
        "a": "thistled",
        "b": "bluebell",
        "i": "irisplant",
        "j": "jasmineb",
        "n": "narcissus"
      },
      "question": "Determine the greatest possible value of $\\sum_{irisplant=1}^{10} \\cos(3\\,juniperidx)$ for real numbers $juniperone,junipertwo,\\dots,juniperten$ satisfying $\\sum_{irisplant=1}^{10} \\cos(juniperidx) = 0$.",
      "solution": "The maximum value is $480/49$.\nSince $\\cos(3\\,juniperidx) = 4 \\cos(juniperidx)^3 - 3 \\cos(juniperidx)$, it is equivalent to maximize $4 \\sum_{irisplant=1}^{10} poppyidx^3$ for $poppyone,\\dots,poppyten \\in [-1,1]$ with $\\sum_{irisplant=1}^{10} poppyidx = 0$; note that this domain is compact, so the maximum value is guaranteed to exist.\nFor convenience, we establish something slightly stronger: we maximize $4 \\sum_{irisplant=1}^{narcissus} poppyidx^3$ for $poppyone,\\dots,y_{narcissus} \\in [-1,1]$ with $\\sum_{irisplant=1}^{narcissus} poppyidx = 0$, where $narcissus$ may be any even nonnegative integer up to $10$, and show that the maximum is achieved when $narcissus = 10$.\n\nWe first study the effect of varying $poppyidx$ and $poppyalt$ while fixing their sum. If that sum is $shoreline$, then the function $marigold \\mapsto marigold^3 + (shoreline-marigold)^3$ has constant second derivative $6shoreline$, so it is either everywhere convex or everywhere concave. Consequently, if $(poppyone,\\dots,y_{narcissus})$ achieves the maximum, then for any two indices $irisplant<jasmineb$, at least one of the following must be true:\n\\begin{itemize}\n\\item one of $poppyidx$, $poppyalt$ is extremal (i.e., equal to $1$ or $-1$);\n\\item $poppyidx = poppyalt < 0$ (in which case $shoreline<0$ and the local maximum is achieved above);\n\\item $poppyidx = -poppyalt$ (in which case $shoreline=0$ above).\n\\end{itemize}\nIn the third case, we may discard $poppyidx$ and $poppyalt$ and achieve a case with smaller $narcissus$; we may thus assume that this does not occur. In this case, all of the non-extremal values are equal to some common value $marigold < 0$, and moreover we cannot have both $1$ and $-1$. We cannot omit $1$, as otherwise the condition $\\sum_{irisplant=1}^{narcissus} poppyidx = 0$ cannot be achieved; we must thus have only the terms $1$ and $marigold$, occurring with some positive multiplicities $thistled$ and $bluebell$ adding up to $narcissus$. Since $thistled+bluebell=narcissus$ and $thistled+bluebell\\,marigold = 0$, we can solve for $marigold$ to obtain $marigold = -thistled/bluebell$; we then have\n\\[\n4\\sum_{irisplant=1}^{narcissus} poppyidx^3 = thistled + bluebell\\,marigold^3 = 4\\,thistled \\left( 1 - \\frac{thistled^2}{bluebell^2} \\right).\n\\]\nSince $marigold > -1$, we must have $thistled < bluebell$. For fixed $thistled$, the target function increases as $bluebell$ increases, so the optimal case must occur when $thistled+bluebell=10$. The possible pairs $(thistled,bluebell)$ at this point are\n\\[\n(1,9),\\ (2,8),\\ (3,7),\\ (4,6);\n\\]\ncomputing the target function for these values yields respectively\n\\[\n\\frac{32}{9},\\ \\frac{15}{2},\\ \\frac{480}{49},\\ \\frac{80}{9},\n\\]\nyielding $480/49$ as the maximum value.\n\n\\noindent\n\\textbf{Remark.}\nUsing Lagrange multipliers yields a similar derivation, but with a slight detour required to separate local minima and maxima. For general $narcissus$, the above argument shows that the target function is maximized when $thistled+bluebell=narcissus$. "
    },
    "descriptive_long_misleading": {
      "map": {
        "s": "difference",
        "x_1": "straightone",
        "x_2": "straighttwo",
        "x_10": "straightten",
        "x_i": "straightvar",
        "y": "sinevalue",
        "y_1": "sineoneval",
        "y_10": "sinetenval",
        "y_i": "sinevarval",
        "y_j": "sineothval",
        "a": "scarcity",
        "b": "rarityval",
        "i": "contentidx",
        "j": "contextidx",
        "n": "odditynum"
      },
      "question": "Determine the greatest possible value of $\\sum_{contentidx=1}^{10} \\cos(3straightvar)$ for real numbers $straightone, straighttwo,\\dots, straightten$ satisfying $\\sum_{contentidx=1}^{10} \\cos(straightvar) = 0$.",
      "solution": "The maximum value is $480/49$.\nSince $\\cos(3straightvar) = 4 \\cos(straightvar)^3 - 3 \\cos(straightvar)$, it is equivalent to maximize $4 \\sum_{contentidx=1}^{10} sinevarval^3$\nfor $sineoneval,\\dots,sinetenval \\in [-1,1]$ with $\\sum_{contentidx=1}^{10} sinevarval = 0$; \nnote that this domain is compact, so the maximum value is guaranteed to exist.\nFor convenience, we establish something slightly stronger: we maximize $4 \\sum_{contentidx=1}^{odditynum} sinevarval^3$\nfor $sineoneval,\\dots,sinevalue_{odditynum} \\in [-1,1]$ with $\\sum_{contentidx=1}^{odditynum} sinevarval = 0$, where $odditynum$ may be any even nonnegative integer up to $10$, and show that the maximum is achieved when $odditynum=10$.\n\nWe first study the effect of varying $sinevarval$ and $sineothval$ while fixing their sum. If that sum is $difference$, then the function $sinevalue \\mapsto sinevalue^3 + (difference-sinevalue)^3$ has constant second derivative $6difference$, so it is either everywhere convex or everywhere concave. Consequently, if $(sineoneval,\\dots,sinevalue_{odditynum})$ achieves the maximum, then for any two indices $contentidx<contextidx$, at least one of the following must be true:\n\\begin{itemize}\n\\item one of $sinevarval$, $sineothval$ is extremal (i.e., equal to $1$ or $-1$);\n\\item $sinevarval = sineothval < 0$ (in which case $difference<0$ and the local maximum is achieved above);\n\\item $sinevarval = -sineothval$ (in which case $difference=0$ above).\n\\end{itemize}\nIn the third case, we may discard $sinevarval$ and $sineothval$ and achieve a case with smaller $odditynum$; we may thus assume that this does not occur. In this case, all of the non-extremal values are equal to some common value $sinevalue < 0$, and moreover we cannot have both 1 and -1. We cannot omit 1, as otherwise the condition $\\sum_{contentidx=1}^{odditynum} sinevarval = 0$ cannot be achieved; we must thus have only the terms 1 and $sinevalue$, occurring with some positive multiplicities $scarcity$ and $rarityval$ adding up to $odditynum$.\nSince $scarcity+rarityval=odditynum$ and $scarcity+rarityval\\,sinevalue = 0$, we can solve for $sinevalue$ to obtain $sinevalue = -scarcity/rarityval$; we then have\n\\[\n4\\sum_{contentidx=1}^{odditynum} sinevarval^3 = scarcity + rarityval\\,sinevalue^3 = 4scarcity \\left( 1 - \\frac{scarcity^2}{rarityval^2} \\right).\n\\]\nSince $sinevalue > -1$, we must have $scarcity < rarityval$. For fixed $scarcity$, the target function increases as $rarityval$ increases, so the optimal case must occur when $scarcity+rarityval=10$. The possible pairs $(scarcity,rarityval)$ at this point are\n\\[\n(1,9),\\ (2,8),\\ (3,7),\\ (4,6);\n\\]\ncomputing the target function for these values yields respectively\n\\[\n\\frac{32}{9},\\ \\frac{15}{2},\\ \\frac{480}{49},\\ \\frac{80}{9},\n\\]\nyielding $480/49$ as the maximum value.\n\n\\noindent\n\\textbf{Remark.} Using Lagrange multipliers yields a similar derivation, but with a slight detour required to separate local minima and maxima. For general $odditynum$, the above argument shows that the target function is maximized when $scarcity+rarityval=odditynum$. "
    },
    "garbled_string": {
      "map": {
        "s": "vntqyxoba",
        "x_1": "qlifmnopa",
        "x_2": "ztrbglsme",
        "x_10": "whdcexqlo",
        "x_i": "psojdrnew",
        "y": "kefzratul",
        "y_1": "mbxqrozeh",
        "y_10": "tjkwlvudc",
        "y_i": "sdhvrkmao",
        "y_j": "lqnpafzui",
        "a": "rxohmltge",
        "b": "cvjadpsiz",
        "i": "htgnoolse",
        "j": "yrazfbguh",
        "n": "qpzskweto"
      },
      "question": "Determine the greatest possible value of $\\sum_{htgnoolse=1}^{10} \\cos(3psojdrnew)$ for real numbers $qlifmnopa, ztrbglsme, \\dots, whdcexqlo$ satisfying $\\sum_{htgnoolse=1}^{10} \\cos(psojdrnew) = 0$.",
      "solution": "The maximum value is $480/49$.\nSince $\\cos(3psojdrnew) = 4 \\cos(psojdrnew)^3 - 3 \\cos(psojdrnew)$, it is equivalent to maximize $4 \\sum_{htgnoolse=1}^{10} sdhvrkmao^3$\nfor $mbxqrozeh,\\dots,tjkwlvudc \\in [-1,1]$ with $\\sum_{htgnoolse=1}^{10} sdhvrkmao = 0$; \nnote that this domain is compact, so the maximum value is guaranteed to exist.\nFor convenience, we establish something slightly stronger: we maximize $4 \\sum_{htgnoolse=1}^{qpzskweto} sdhvrkmao^3$\nfor $mbxqrozeh,\\dots,kefzratul_{qpzskweto} \\in [-1,1]$ with $\\sum_{htgnoolse=1}^{qpzskweto} sdhvrkmao = 0$, where $qpzskweto$ may be any even nonnegative integer up to $10$,\nand show that the maximum is achieved when $qpzskweto=10$.\n\nWe first study the effect of varying $sdhvrkmao$ and $lqnpafzui$ while fixing their sum. If that sum is $vntqyxoba$,\nthen the function $kefzratul \\mapsto kefzratul^3 + (vntqyxoba-kefzratul)^3$ has constant second derivative $6vntqyxoba$, so it is either everywhere convex or everywhere concave. Consequently, if $(mbxqrozeh,\\dots,kefzratul_{qpzskweto})$ achieves the maximum, then for any two indices $htgnoolse<yrazfbguh$,\nat least one of the following must be true:\n\\begin{itemize}\n\\item one of $sdhvrkmao$, $lqnpafzui$ is extremal (i.e., equal to $1$ or $-1$);\n\\item $sdhvrkmao = lqnpafzui < 0$ (in which case $vntqyxoba<0$ and the local maximum is achieved above);\n\\item $sdhvrkmao = -lqnpafzui$ (in which case $vntqyxoba=0$ above).\n\\end{itemize}\nIn the third case, we may discard $sdhvrkmao$ and $lqnpafzui$ and achieve a case with smaller $qpzskweto$; we may thus assume that this does not occur. In this case, all of the non-extremal values are equal to some common value $kefzratul < 0$, and moreover we cannot have both 1 and -1. We cannot omit 1, as otherwise the condition $\\sum_{htgnoolse=1}^{qpzskweto} sdhvrkmao = 0$ cannot be achieved;\nwe must thus have only the terms 1 and $kefzratul$, occurring with some positive multiplicities $rxohmltge$ and $cvjadpsiz$ adding up to $qpzskweto$. \nSince $rxohmltge+cvjadpsiz=qpzskweto$ and $rxohmltge+cvjadpsiz\\,kefzratul = 0$, we can solve for $kefzratul$ to obtain $kefzratul = -rxohmltge/cvjadpsiz$; we then have\n\\[\n4\\sum_{htgnoolse=1}^{qpzskweto} sdhvrkmao^3 = rxohmltge + cvjadpsiz\\,kefzratul^3 = 4rxohmltge \\left( 1 - \\frac{rxohmltge^2}{cvjadpsiz^2} \\right).\n\\]\nSince $kefzratul > -1$, we must have $rxohmltge < cvjadpsiz$. For fixed $rxohmltge$, the target function increases as $cvjadpsiz$ increases,\nso the optimal case must occur when $rxohmltge+cvjadpsiz=10$. The possible pairs $(rxohmltge,cvjadpsiz)$ at this point are\n\\[\n(1,9), (2,8), (3,7), (4,6);\n\\]\ncomputing the target function for these values yields respectively\n\\[\n\\frac{32}{9}, \\frac{15}{2}, \\frac{480}{49}, \\frac{80}{9},\n\\]\nyielding $480/49$ as the maximum value.\n\n\\noindent\n\\textbf{Remark.}\nUsing Lagrange multipliers yields a similar derivation, but with a slight detour required to separate local minima and maxima. For general $qpzskweto$, the above argument shows that the target function is maximized when $rxohmltge+cvjadpsiz=qpzskweto$. "
    },
    "kernel_variant": {
      "question": "Let  \n\\[\nx_{1},x_{2},\\dots ,x_{18}\\in\\mathbb R\n\\]  \nsatisfy the two simultaneous constraints  \n\\[\n\\sum_{i=1}^{18}\\cos x_{i}=0 ,\\qquad \n\\sum_{i=1}^{18}\\cos(2x_{i})=0 .\n\\]  \nDefine  \n\\[\nS=\\sum_{i=1}^{18}\\cos(4x_{i}).\n\\]  \nDetermine the quantity  \n\\[\nS_{\\max }=\\max_{(x_{1},\\dots ,x_{18})\\in\\mathbb R^{18}} S ,\n\\]  \nand describe \\emph{all} $18$–tuples $(x_{1},\\dots ,x_{18})$ for which this\nmaximum is attained.",
      "solution": "Step 1.  Polynomial reformulation.  \nPut  \n\\[\ny_{i}:=\\cos x_{i}\\quad(1\\le i\\le18),\\qquad -1\\le y_{i}\\le1 .\n\\]  \nUsing  \n\\[\n\\cos(2\\theta)=2\\cos^{2}\\theta-1,\\qquad \n\\cos(4\\theta)=8\\cos^{4}\\theta-8\\cos^{2}\\theta+1\n\\]  \nwe obtain the constraints  \n\\[\n\\sum_{i=1}^{18}y_{i}=0,\\qquad \n\\sum_{i=1}^{18}y_{i}^{2}=9, \\tag{1}\n\\]  \nand the objective  \n\\[\nS=8T-54,\\qquad T:=\\sum_{i=1}^{18}y_{i}^{4}. \\tag{2}\n\\]  \nHence maximising $S$ is equivalent to maximising $T$ subject to (1) and\n$|y_{i}|\\le1$.\n\n\\medskip\nStep 2.  Karush–Kuhn–Tucker (KKT) set–up.  \nIntroduce multipliers $\\lambda,\\mu\\in\\mathbb R$ for the two equalities\nand $\\alpha_{i},\\beta_{i}\\ge0$ for the box constraints $y_{i}\\le1$ and\n$-y_{i}\\le1$.  The Lagrangian is  \n\\[\n\\mathcal L(\\mathbf y)=\\sum_{i=1}^{18}y_{i}^{4}\n-\\lambda\\sum_{i=1}^{18}y_{i}\n-\\mu\\Bigl(\\sum_{i=1}^{18}y_{i}^{2}-9\\Bigr)\n+\\sum_{i=1}^{18}\\alpha_{i}(1-y_{i})\n+\\sum_{i=1}^{18}\\beta_{i}(1+y_{i}).\n\\]  \nAt every maximiser $(y_{1},\\dots ,y_{18})$ the KKT relations read, for\n$1\\le i\\le18$,  \n\\[\n4y_{i}^{3}-\\lambda-2\\mu y_{i}-\\alpha_{i}+\\beta_{i}=0, \\qquad\n\\alpha_{i}(1-y_{i})=0,\\qquad\n\\beta_{i}(1+y_{i})=0. \\tag{3}\n\\]\n\n\\medskip\nStep 3.  Showing $\\boxed{\\lambda=0}$.  \nAssume first that $\\lambda\\neq0$.  Multiplying the whole vector\n$\\mathbf y=(y_{1},\\dots ,y_{18})$ by $-1$ (which preserves (1)) would\nreplace $\\lambda$ by $-\\lambda$ in (3); hence we may and shall suppose\n$\\lambda>0$.\n\n\\medskip\n3.1  Interior coordinates.  \nFor $-1<y_{i}<1$ we have $\\alpha_{i}=\\beta_{i}=0$, so (3) becomes  \n\\[\n4y_{i}^{3}-2\\mu y_{i}=\\lambda>0. \\tag{4}\n\\]\nThe cubic $f(t)=4t^{3}-2\\mu t$ is strictly increasing on\n$[0,1]$ and strictly decreasing on $[-1,0]$.  Consequently, equation\n(4) admits \\emph{at most one} solution in $(-1,0)$ and \\emph{at most\none} solution in $(0,1)$.  Whenever two interior coordinates $y_{i}$\nand $y_{j}$ solve (4), subtracting the two copies of (3) eliminates\n$\\lambda$ and $\\mu$ and forces $y_{i}=y_{j}$.  Denoting this common\nvalue by $p\\in(-1,1)\\setminus\\{0\\}$, we therefore conclude:\n\n\\begin{itemize}\n\\item every interior coordinate equals the \\emph{same} number $p$;\n\\item every negative (resp. positive) boundary coordinate equals $-1$\n(resp. $1$).\n\\end{itemize}\n\n\\medskip\n3.2  Notation and constraints.  \nSet  \n\\[\nu:=\\#\\{y_{i}=1\\},\\quad\nv:=\\#\\{y_{i}=-1\\},\\quad\na:=\\#\\{y_{i}=p\\},\\qquad u+v+a=18. \\tag{5}\n\\]\nWith this notation (1) becomes\n\\[\nu+ap-v=0,\\qquad\nu+ap^{2}+v=9. \\tag{6}\n\\]\nThe two equalities (5)–(6) yield\n\\[\n2u+a(1+p)=18,\\qquad\n2u+a(p+p^{2})=9. \\tag{7}\n\\]\nSubtracting gives\n\\[\na(1-p^{2})=9\\qquad\\Longrightarrow\\qquad\np^{2}=1-\\frac{9}{a},\\qquad a>9. \\tag{8}\n\\]\n\n\\medskip\n3.3  Value of $T$ with $\\lambda\\neq0$.  \nUsing (5)–(8) one computes\n\\[\nT=u+ap^{4}+v\n  =18-a+ap^{4}\n  =18-a+a\\!\\left(1-\\frac{18}{a}+\\frac{81}{a^{2}}\\right)\n  =\\frac{81}{a}. \\tag{9}\n\\]\nBecause $a$ is an integer and $a\\ge10$,  \n\\[\nT\\le\\frac{81}{10}=8.1. \\tag{10}\n\\]\nLater (Step 7) we shall construct a feasible point with\n$T=\\dfrac{17}{2}=8.5$, contradicting (10).  Hence our original\nassumption is impossible, so  \n\n\\[\n\\boxed{\\lambda=0}. \\tag{11}\n\\]\n\n\\medskip\nStep 4.  Structure with $\\lambda=0$.  \nWith $\\lambda=0$, (3) for $|y_{i}|<1$ reduces to\n\\[\ny_{i}\\bigl(2y_{i}^{2}-\\mu\\bigr)=0. \\tag{12}\n\\]\nThus every interior coordinate equals $0$ or\n\\[\n\\pm c,\\qquad c:=\\sqrt{\\mu/2}\\in(0,1]. \\tag{13}\n\\]\nConsequently each $y_{i}$ belongs to  \n\\[\n\\{1,-1,c,-c,0\\}.\n\\]\n\n\\medskip\nStep 5.  Combinatorial bookkeeping.  \nLet  \n\\[\n\\begin{aligned}\nu&:=\\#\\{y_{i}=1\\}, & v&:=\\#\\{y_{i}=-1\\}, & k&:=u+v,\\\\\na&:=\\#\\{y_{i}=c\\}, & b&:=\\#\\{y_{i}=-c\\}, & m&:=a+b,\\\\\nw&:=18-k-m\\quad(\\text{zeros}),& d&:=u-v .\n\\end{aligned}\n\\]\nIn these terms (1) becomes\n\\[\nd+c(a-b)=0,\\qquad\nk+c^{2}m=9, \\tag{14}\n\\]\nwhereas the objective is\n\\[\nT=k+c^{4}m. \\tag{15}\n\\]\n\n\\medskip\nStep 6.  The imbalance $d$ must vanish.  \n\nAssume $d\\neq0$.  From the first relation in (14) we get  \n\\[\nc=\\frac{|d|}{|a-b|}=\\frac{1}{t},\\qquad\nt:=\\frac{|a-b|}{|d|}>1. \\tag{16}\n\\]\nBecause $|d|$ and $|a-b|$ are integers of opposite parity (the second\nequality in (14) forces $k$ and $m$ to be even), one in fact has\n$t\\ge2$.  Substituting $c=1/t$ into the second relation of (14) gives\n\\[\nm=(9-k)t^{2}. \\tag{17}\n\\]\nNow (15), (16) and (17) imply\n\\[\nT=k+\\frac{9-k}{t^{2}}. \\tag{18}\n\\]\nSince $k\\le8$ (otherwise $k+c^{2}m>9$), the right–hand side of\n(18) is maximised by $k=8$ and the \\emph{smallest} admissible $t$, viz.\n$t=2$.  Thus  \n\\[\nT\\le 8+\\frac{1}{4}=8.25<8.5. \\tag{19}\n\\]\nTherefore any optimal solution must satisfy\n\\[\n\\boxed{d=0,\\qquad a=b}. \\tag{20}\n\\]\n\n\\medskip\nStep 7.  Eliminating $c$ and finishing the optimisation.  \nWith $d=0$ we obtain from (14)\n\\[\nc^{2}=\\frac{9-k}{m},\\qquad\n1\\le k\\le8,\\ k,m\\text{ even},\\ k+m\\le18. \\tag{21}\n\\]\nInserting this into (15) yields\n\\[\nT(k,m)=k+\\frac{(9-k)^{2}}{m}. \\tag{22}\n\\]\nFor fixed $k$, $T(k,m)$ decreases with $m$, so we want the\nsmallest admissible even $m$.  Writing $r:=9-k\\in\\{1,3,5,7,9\\}$,\nparity considerations give\n\\[\nm_{\\min}(k)=\n\\begin{cases}\nr+1,& r \\text{ odd},\\\\[4pt]\nr+2,& r \\text{ even}.\n\\end{cases} \\tag{23}\n\\]\nEvaluating (22) at these $m_{\\min}$ for $k=0,2,4,6,8$ produces\n\\[\n\\begin{array}{c|ccccc}\nk & 0 & 2 & 4 & 6 & 8\\\\ \\hline\nT(k) &\n8.1 &\n8.125 &\n8.\\overline{16} &\n8.25 &\n8.5\n\\end{array}\n\\]\nHence\n\\[\n\\boxed{T_{\\max}=\\dfrac{17}{2}\\quad\\text{attained for }k=8}. \\tag{24}\n\\]\n\nFor $k=8$ we have $r=1$, so $m=2$ and\n\\[\nc^{2}=\\frac{1}{2}\\quad\\Longrightarrow\\quad c=\\frac{1}{\\sqrt2}. \\tag{25}\n\\]\nMultiplicity table:\n\\[\nu=v=4,\\qquad a=b=1,\\qquad w=8. \\tag{26}\n\\]\n\n\\medskip\nStep 8.  Verifying the KKT multipliers.  \nWith $\\lambda=0$ and $c^{2}=1/2$, (12) gives $\\mu=1$.  Putting these\nvalues into (3) yields $\\alpha_{i}=2$ for $y_{i}=1$ and\n$\\beta_{i}=2$ for $y_{i}=-1$; all multipliers are non–negative, so the\nKKT conditions are indeed satisfied.\n\n\\medskip\nStep 9.  Back to the $x$–variables.  \nFrom (2) and (24) we conclude\n\\[\nS_{\\max}=8T_{\\max}-54\n        =8\\cdot\\frac{17}{2}-54\n        =68-54\n        =\\boxed{14}. \\tag{27}\n\\]\n\nEvery maximising vector $(y_{1},\\dots ,y_{18})$ consists, up to\nreordering, of  \n\\[\n\\bigl(1,1,1,1,-1,-1,-1,-1,\n      \\tfrac1{\\sqrt2},-\\tfrac1{\\sqrt2},\n      0,0,0,0,0,0,0,0\\bigr).\n\\]\nTranslating back to angles $x_{i}$,\n\\[\n\\begin{aligned}\ny_{i}=1 &\\Longleftrightarrow x_{i}\\equiv0\\pmod{2\\pi},\\\\\ny_{i}=-1&\\Longleftrightarrow x_{i}\\equiv\\pi\\pmod{2\\pi},\\\\\ny_{i}= \\tfrac1{\\sqrt2}\n        &\\Longleftrightarrow x_{i}\\equiv\\tfrac{\\pi}{4}\\pmod{2\\pi},\\\\\ny_{i}=-\\tfrac1{\\sqrt2}\n        &\\Longleftrightarrow x_{i}\\equiv\\tfrac{3\\pi}{4}\\pmod{2\\pi},\\\\\ny_{i}=0 &\\Longleftrightarrow x_{i}\\equiv\\tfrac{\\pi}{2}\\pmod{\\pi}.\n\\end{aligned}\n\\]\nAny permutation of these $18$ numbers is optimal, and every maximiser\narises in this way. \\hfill$\\square$\n\n\\bigskip",
      "metadata": {
        "replaced_from": "harder_variant",
        "replacement_date": "2025-07-14T19:09:31.851568",
        "was_fixed": false,
        "difficulty_analysis": "• More variables.  The problem escalates from 16 to 18 unknown angles, expanding the feasible set and complicating case analysis.  \n• Additional constraint structure.  Requiring both\n\\(\\sum\\cos x_{i}=0\\) and \\(\\sum\\cos 2x_{i}=0\\) forces simultaneous control\nof the first two Chebyshev moments; this couples linear, quadratic and\nquartic relations and prevents the one-parameter “extreme-point” trick\nthat solves the original problem.  \n• Higher algebraic degree.  The objective involves \\(\\cos 4\\theta\\),\ni.e. a quartic polynomial in \\(\\cos\\theta\\); maximising it under a quadratic\nmoment constraint necessitates non-elementary optimisation, including a\nquantitative balance between extreme points (\\(\\pm1\\)) and interior\npoints.  \n• Multi-value extremal configuration.  Unlike the original, whose\noptimiser uses only two cosine values, the new optimum genuinely\nrequires four distinct values \\(\\{+1,-1,+t,-t\\}\\) with \\(t\\notin\\{0,1\\}\\),\nand integer multiplicity conditions must be reconciled with real\n$a$-\\(p$-\\(t$ parameters.  This demands an additional discrete analysis layer beyond Lagrange multipliers.  \n\nOverall, the enhanced variant adds both theoretical depth (moment\nproblems, Lagrange systems, convex-extreme arguments) and computational\nlength (five non-trivial candidate evaluations) while preserving\nsolvability within a contest setting."
      }
    },
    "original_kernel_variant": {
      "question": "Let  \n\\[\nx_{1},x_{2},\\dots ,x_{18}\\in\\mathbb R\n\\]  \nsatisfy the two simultaneous constraints  \n\\[\n\\sum_{i=1}^{18}\\cos x_{i}=0 ,\n\\qquad \n\\sum_{i=1}^{18}\\cos(2x_{i})=0 .\n\\]  \nPut  \n\\[\nS=\\sum_{i=1}^{18}\\cos(4x_{i}).\n\\]  \n\nDetermine  \n\\[\nS_{\\max }=\\max_{(x_{1},\\dots ,x_{18})\\in\\mathbb R^{18}}S\n\\]\nand describe \\emph{all} $18$–tuples \\((x_{1},\\dots ,x_{18})\\) for which this\nmaximum is attained.",
      "solution": "1.  Polynomial reformulation.  \n   Define  \n   \\[\n     y_{i}:=\\cos x_{i}\\qquad(1\\le i\\le 18),\\qquad -1\\le y_{i}\\le 1 .\n   \\]\n   Using  \n   \\[\n     \\cos(2\\theta)=2\\cos^{2}\\theta-1 ,\\qquad \n     \\cos(4\\theta)=8\\cos^{4}\\theta-8\\cos^{2}\\theta+1 ,\n   \\]\n   the two constraints and the objective become  \n   \\[\n     \\sum_{i=1}^{18}y_{i}=0 ,\\qquad\n     \\sum_{i=1}^{18}y_{i}^{2}=9 ,\\tag{1}\n   \\]\n   \\[\n     S=8T-54,\\qquad\n     T:=\\sum_{i=1}^{18}y_{i}^{4}. \\tag{2}\n   \\]\n   Hence maximising $S$ is equivalent to maximising $T$ under (1) and\n   $\\lvert y_{i}\\rvert\\le 1$.\n\n2.  Karush–Kuhn–Tucker analysis.  \n   Fix a maximiser \\(\\mathbf y=(y_{1},\\dots ,y_{18})\\).\n   Introduce multipliers \\(\\lambda,\\mu\\) for the two equalities in (1)\n   and $\\alpha_i,\\beta_i\\ge 0$ for the box constraints\n   $y_i\\le 1,\\,-y_i\\le 1$.\n   Writing the Lagrangian\n   \\[\n      \\mathcal L(\\mathbf y)=\\sum_{i=1}^{18}y_i^{4}\n           -\\lambda\\Bigl(\\sum_{i=1}^{18}y_i\\Bigr)\n           -\\mu\\Bigl(\\sum_{i=1}^{18}y_i^{2}-9\\Bigr)\n           +\\sum_{i=1}^{18}\\alpha_i(1-y_i)\n           +\\sum_{i=1}^{18}\\beta_i(1+y_i),\n   \\]\n   the stationarity condition for every \\emph{interior} coordinate\n   ($\\lvert y_i\\rvert<1\\Longrightarrow\\alpha_i=\\beta_i=0$) is  \n   \\[\n     4y_i^{3}-\\lambda-2\\mu y_i=0.\\tag{3}\n   \\]\n   In particular, all interior values are roots of the cubic\n   \\(\\;4t^{3}-2\\mu t-\\lambda=0.\\)\n\n   Suppose that both some \\(y\\) and its opposite \\(-y\\) occur with\n   \\(\\lvert y\\rvert<1\\).  Plugging them into (3) and subtracting we get\n   \\(-2\\lambda=0\\); hence\n\n   \\[\n        \\boxed{\\;\\lambda=0\\;}. \\tag{4}\n   \\]\n\n   With $\\lambda=0$, (3) factorises as  \n   \\[\n        4y_i\\bigl(y_i^{2}-\\tfrac{\\mu}{2}\\bigr)=0. \\tag{5}\n   \\]\n   Therefore every interior entry belongs to\n\n   \\[\n        \\{\\,0,\\;c,\\;-c\\},\\qquad c:=\\sqrt{\\mu/2}\\in(0,1]. \\tag{6}\n   \\]\n\n   Consequently a maximiser involves \\emph{at most three} different\n   magnitudes: $1,\\;c,\\;0$ (together with the corresponding signs).\n\n3.  Combinatorial parametrisation.  \n   Let\n   \\[\n     \\begin{aligned}\n        u&:=\\#\\{i:y_i=1\\}, & v&:=\\#\\{i:y_i=-1\\}, & k&:=u+v,\\\\\n        a&:=\\#\\{i:y_i=c\\}, & b&:=\\#\\{i:y_i=-c\\}, & m&:=a+b,\\\\\n        w&:=18-k-m\\ (\\text{zeros}).\n     \\end{aligned}\n   \\]\n   All the counts are non–negative integers.  By construction\n   $k+m+w=18$.  With $d:=u-v$ we can rewrite the constraints (1) as\n   \\[\n       d+c(a-b)=0,\\qquad\n       k+c^{2}m=9. \\tag{7}\n   \\]\n   The fourth–power sum is\n   \\[\n       T=k+c^{4}m.\\tag{8}\n   \\]\n\n4.  Symmetry of the maximiser.  \n   The first relation in (7) shows that the contribution of the\n   $\\pm1$–coordinates to the total sum must be compensated by the\n   $\\pm c$–coordinates. Because $|c|<1$, \\emph{using any imbalance\n   $d\\neq0$ forces $m$ to be large}, which is unfavourable for~$T$.\n   A direct comparison (replace one $+1$ and one $-1$ by two $\\pm c$\n   chosen so that (7) is preserved) confirms that $T$ strictly\n   decreases when $|d|$ is increased.  Hence every maximiser must have\n   \\[\n        \\boxed{d=0,\\;a=b\\;( \\text{i.e.\\ }u=v,\\;a=b)}. \\tag{9}\n   \\]\n   Consequently $k$ and $m$ are even.\n\n5.  Eliminating $c$.  \n   With $d=0$ we may solve (7) for $c^{2}$:\n   \\[\n        c^{2}=\\frac{9-k}{m}. \\tag{10}\n   \\]\n   Insert this in (8):\n   \\[\n        T(k,m)=k+\\frac{(9-k)^{2}}{m}. \\tag{11}\n   \\]\n   For fixed $k$ the expression is strictly \\emph{decreasing} in $m$,\n   so we need the \\emph{smallest} admissible $m$.  Write\n   \\[\n        r:=9-k\\qquad(0\\le r\\le 9).\n   \\]\n   Because $m$ is even and must exceed $r$ whenever $c<1$, the minimal\n   choice is\n   \\[\n        m_{\\min}(k)=\n          \\begin{cases}\n               r+2,& r\\ \\text{even},\\\\[2pt]\n               r+1,& r\\ \\text{odd}.\n          \\end{cases}\\tag{12}\n   \\]\n   (If $m=r$, then $c^{2}=1$ so the $\\pm c$–coordinates would actually\n   be additional $\\pm1$’s, contradicting the minimality of~$m$.)\n\n   Substituting $m_{\\min}(k)$ in (11) gives\n   \\[\n        T(k):=\n        \\begin{cases}\n          k+\\dfrac{r^{2}}{r+2}, & r\\ \\text{even},\\\\[12pt]\n          k+\\dfrac{r^{2}}{r+1}, & r\\ \\text{odd}.\n        \\end{cases}\\tag{13}\n   \\]\n\n6.  Exhausting the nine possibilities $0\\le k\\le 9$.  \n   A short table (or monotonicity check) yields  \n\n   \\[\n   \\begin{array}{c|ccccccccc}\n      k & 0&1&2&3&4&5&6&7&8\\\\ \\hline\n      T(k) & 7.875 & 8 & 8.0625 & 8.125 & 8.1667 & 8.2 & 8.25 & 8.333\\ldots & 8.5\n   \\end{array}\n   \\]\n\n   The maximum is reached at  \n   \\[\n        \\boxed{k_{\\max}=8,\\qquad T_{\\max}=8.5=\\frac{17}{2}}. \\tag{14}\n   \\]\n   From $k_{\\max}=8$ we have $r=1$, so by (12) $m_{\\min}=2$ and then\n   (10) gives $c^{2}=1/2$, i.e.\n   \\[\n      \\boxed{c=\\frac{1}{\\sqrt 2}}. \\tag{15}\n   \\]\n\n7.  The maximal value of $S$.  \n   By (2) and (14)\n   \\[\n        S_{\\max}=8T_{\\max}-54=8\\cdot\\frac{17}{2}-54=68-54=\\boxed{14}. \\tag{16}\n   \\]\n\n8.  Description of \\emph{all} maximisers.  \n   The equalities $k=8,\\;m=2,\\;w=8$ together with (9) read\n   \\[\n        u=v=4,\\qquad a=b=1,\\qquad w=8. \\tag{17}\n   \\]\n   Hence every maximising $(y_1,\\dots ,y_{18})$ contains exactly\n   \\[\n        4\\text{ times }1,\\;\n        4\\text{ times }-1,\\;\n        1\\text{ time }\\tfrac1{\\sqrt2},\\;\n        1\\text{ time }-\\tfrac1{\\sqrt2},\\;\n        8\\text{ zeros},\n   \\]\n   in arbitrary order.\n\n   Translating back to the angles,\n   \\[\n      \\begin{aligned}\n        y_i=1 &\\Longleftrightarrow x_i\\equiv 0\\pmod{2\\pi},\\\\\n        y_i=-1&\\Longleftrightarrow x_i\\equiv \\pi\\pmod{2\\pi},\\\\\n        y_i=\\tfrac1{\\sqrt2}\n              &\\Longleftrightarrow x_i\\equiv \\tfrac{\\pi}{4}\\pmod{2\\pi},\\\\\n        y_i=-\\tfrac1{\\sqrt2}\n              &\\Longleftrightarrow x_i\\equiv \\tfrac{3\\pi}{4}\\pmod{2\\pi},\\\\\n        y_i=0 &\\Longleftrightarrow x_i\\equiv \\tfrac{\\pi}{2}\\pmod{\\pi}.\n      \\end{aligned}\n   \\]\n   Choosing any permutation of the multiset in (17) yields a maximiser,\n   and every maximiser arises in this way.  \\(\\blacksquare\\)",
      "metadata": {
        "replaced_from": "harder_variant",
        "replacement_date": "2025-07-14T01:37:45.650758",
        "was_fixed": false,
        "difficulty_analysis": "• More variables.  The problem escalates from 16 to 18 unknown angles, expanding the feasible set and complicating case analysis.  \n• Additional constraint structure.  Requiring both\n\\(\\sum\\cos x_{i}=0\\) and \\(\\sum\\cos 2x_{i}=0\\) forces simultaneous control\nof the first two Chebyshev moments; this couples linear, quadratic and\nquartic relations and prevents the one-parameter “extreme-point” trick\nthat solves the original problem.  \n• Higher algebraic degree.  The objective involves \\(\\cos 4\\theta\\),\ni.e. a quartic polynomial in \\(\\cos\\theta\\); maximising it under a quadratic\nmoment constraint necessitates non-elementary optimisation, including a\nquantitative balance between extreme points (\\(\\pm1\\)) and interior\npoints.  \n• Multi-value extremal configuration.  Unlike the original, whose\noptimiser uses only two cosine values, the new optimum genuinely\nrequires four distinct values \\(\\{+1,-1,+t,-t\\}\\) with \\(t\\notin\\{0,1\\}\\),\nand integer multiplicity conditions must be reconciled with real\n$a$-\\(p$-\\(t$ parameters.  This demands an additional discrete analysis layer beyond Lagrange multipliers.  \n\nOverall, the enhanced variant adds both theoretical depth (moment\nproblems, Lagrange systems, convex-extreme arguments) and computational\nlength (five non-trivial candidate evaluations) while preserving\nsolvability within a contest setting."
      }
    }
  },
  "checked": true,
  "problem_type": "calculation"
}