{
  "index": "1992-A-1",
  "type": "ALG",
  "tag": [
    "ALG"
  ],
  "difficulty": "",
  "question": "defined on the integers that satisfies the following conditions.\n\\begin{itemize}\n\\item[(i)] $f(f(n)) = n$, for all integers $n$;\n\\item[(ii)] $f(f(n+2)+2) = n$ for all integers $n$;\n\\item[(iii)] $f(0) = 1$.\n\\end{itemize}",
  "solution": "Solution. If \\( f(n)=1-n \\), then \\( f(f(n))=f(1-n)=1-(1-n)=n \\), so (i) holds. Similarly, \\( f(f(n+2)+2)=f((-n-1)+2)=f(1-n)=n \\), so (ii) holds. Clearly (iii) holds, and so \\( f(n)=1-n \\) satisfies the conditions.\n\nConversely, suppose \\( f \\) satisfies the three given conditions. By (i), \\( f(0)=1 \\) and \\( f(1)=0 \\). From condition (ii), \\( f(f(f(n+2)+2))=f(n) \\), and applying (i) yields \\( f(n+2)+2=f(n) \\), or equivalently \\( f(n+2)=f(n)-2 \\). Easy inductions in both directions yields \\( f(n)=1-n \\).",
  "vars": [
    "n",
    "f"
  ],
  "params": [],
  "sci_consts": [],
  "variants": {
    "descriptive_long": {
      "map": {
        "n": "integer",
        "f": "function"
      },
      "question": "defined on the integers that satisfies the following conditions.\n\\begin{itemize}\n\\item[(i)] $function(function(integer)) = integer$, for all integers $integer$;\n\\item[(ii)] $function(function(integer+2)+2) = integer$ for all integers $integer$;\n\\item[(iii)] $function(0) = 1$.\n\\end{itemize}",
      "solution": "Solution. If \\( function(integer)=1-integer \\), then \\( function(function(integer))=function(1-integer)=1-(1-integer)=integer \\), so (i) holds. Similarly, \\( function(function(integer+2)+2)=function((-integer-1)+2)=function(1-integer)=integer \\), so (ii) holds. Clearly (iii) holds, and so \\( function(integer)=1-integer \\) satisfies the conditions.\n\nConversely, suppose \\( function \\) satisfies the three given conditions. By (i), \\( function(0)=1 \\) and \\( function(1)=0 \\). From condition (ii), \\( function(function(function(integer+2)+2))=function(integer) \\), and applying (i) yields \\( function(integer+2)+2=function(integer) \\), or equivalently \\( function(integer+2)=function(integer)-2 \\). Easy inductions in both directions yields \\( function(integer)=1-integer \\)."
    },
    "descriptive_long_confusing": {
      "map": {
        "n": "lilyfield",
        "f": "shadowbeam"
      },
      "question": "defined on the integers that satisfies the following conditions.\n\\begin{itemize}\n\\item[(i)] $shadowbeam(shadowbeam(lilyfield)) = lilyfield$, for all integers $lilyfield$;\n\\item[(ii)] $shadowbeam(shadowbeam(lilyfield+2)+2) = lilyfield$ for all integers $lilyfield$;\n\\item[(iii)] $shadowbeam(0) = 1$.\n\\end{itemize}",
      "solution": "Solution. If \\( shadowbeam(lilyfield)=1-lilyfield \\), then \\( shadowbeam(shadowbeam(lilyfield))=shadowbeam(1-lilyfield)=1-(1-lilyfield)=lilyfield \\), so (i) holds. Similarly, \\( shadowbeam(shadowbeam(lilyfield+2)+2)=shadowbeam((-lilyfield-1)+2)=shadowbeam(1-lilyfield)=lilyfield \\), so (ii) holds. Clearly (iii) holds, and so \\( shadowbeam(lilyfield)=1-lilyfield \\) satisfies the conditions.\n\nConversely, suppose \\( shadowbeam \\) satisfies the three given conditions. By (i), \\( shadowbeam(0)=1 \\) and \\( shadowbeam(1)=0 \\). From condition (ii), \\( shadowbeam(shadowbeam(shadowbeam(lilyfield+2)+2))=shadowbeam(lilyfield) \\), and applying (i) yields \\( shadowbeam(lilyfield+2)+2=shadowbeam(lilyfield) \\), or equivalently \\( shadowbeam(lilyfield+2)=shadowbeam(lilyfield)-2 \\). Easy inductions in both directions yields \\( shadowbeam(lilyfield)=1-lilyfield \\)."
    },
    "descriptive_long_misleading": {
      "map": {
        "n": "noninteger",
        "f": "constantmap"
      },
      "question": "defined on the integers that satisfies the following conditions.\n\\begin{itemize}\n\\item[(i)] $constantmap(constantmap(noninteger)) = noninteger$, for all integers $noninteger$;\n\\item[(ii)] $constantmap(constantmap(noninteger+2)+2) = noninteger$ for all integers $noninteger$;\n\\item[(iii)] $constantmap(0) = 1$.\n\\end{itemize}",
      "solution": "Solution. If \\( constantmap(noninteger)=1-noninteger \\), then \\( constantmap(constantmap(noninteger))=constantmap(1-noninteger)=1-(1-noninteger)=noninteger \\), so (i) holds. Similarly, \\( constantmap(constantmap(noninteger+2)+2)=constantmap((-noninteger-1)+2)=constantmap(1-noninteger)=noninteger \\), so (ii) holds. Clearly (iii) holds, and so \\( constantmap(noninteger)=1-noninteger \\) satisfies the conditions.\n\nConversely, suppose \\( constantmap \\) satisfies the three given conditions. By (i), \\( constantmap(0)=1 \\) and \\( constantmap(1)=0 \\). From condition (ii), \\( constantmap(constantmap(constantmap(noninteger+2)+2))=constantmap(noninteger) \\), and applying (i) yields \\( constantmap(noninteger+2)+2=constantmap(noninteger) \\), or equivalently \\( constantmap(noninteger+2)=constantmap(noninteger)-2 \\). Easy inductions in both directions yields \\( constantmap(noninteger)=1-noninteger \\)."
    },
    "garbled_string": {
      "map": {
        "n": "qzxwvtnp",
        "f": "hjgrksla"
      },
      "question": "Problem:\n<<<\ndefined on the integers that satisfies the following conditions.\n\\begin{itemize}\n\\item[(i)] $hjgrksla(hjgrksla(qzxwvtnp)) = qzxwvtnp$, for all integers $qzxwvtnp$;\n\\item[(ii)] $hjgrksla(hjgrksla(qzxwvtnp+2)+2) = qzxwvtnp$ for all integers $qzxwvtnp$;\n\\item[(iii)] $hjgrksla(0) = 1$.\n\\end{itemize}\n>>>\n",
      "solution": "Solution:\n<<<\nSolution. If \\( hjgrksla(qzxwvtnp)=1-qzxwvtnp \\), then \\( hjgrksla(hjgrksla(qzxwvtnp))=hjgrksla(1-qzxwvtnp)=1-(1-qzxwvtnp)=qzxwvtnp \\), so (i) holds. Similarly, \\( hjgrksla(hjgrksla(qzxwvtnp+2)+2)=hjgrksla((-qzxwvtnp-1)+2)=hjgrksla(1-qzxwvtnp)=qzxwvtnp \\), so (ii) holds. Clearly (iii) holds, and so \\( hjgrksla(qzxwvtnp)=1-qzxwvtnp \\) satisfies the conditions.\n\nConversely, suppose \\( hjgrksla \\) satisfies the three given conditions. By (i), \\( hjgrksla(0)=1 \\) and \\( hjgrksla(1)=0 \\). From condition (ii), \\( hjgrksla(hjgrksla(hjgrksla(qzxwvtnp+2)+2))=hjgrksla(qzxwvtnp) \\), and applying (i) yields \\( hjgrksla(qzxwvtnp+2)+2=hjgrksla(qzxwvtnp) \\), or equivalently \\( hjgrksla(qzxwvtnp+2)=hjgrksla(qzxwvtnp)-2 \\). Easy inductions in both directions yields \\( hjgrksla(qzxwvtnp)=1-qzxwvtnp \\).\n>>>\n"
    },
    "kernel_variant": {
      "question": "Let   f : ℤ → ℤ   be a function that fulfils\n(i)  f(f(n)) = n                for every n ∈ ℤ;\n(ii) f( f(n+5) + 5 ) = n        for every n ∈ ℤ;\n(iii) f(0) = 7.\nDetermine all such functions f.",
      "solution": "Throughout we work with integers only.\n\n1.  A first recursion coming from (i) and (ii)\n------------------------------------------------\nApply (i) to the inner occurrence of f in (ii):\n      f( f(n+5) + 5 ) = n   ⇒   f(n+5)+5 = f(n).\nHence, for every n ∈ ℤ,\n      (∗)  f(n+5) = f(n) − 5.\nCondition (ii) is therefore equivalent to (∗).\n\n2.  Reduction to the five residue classes mod 5\n----------------------------------------------\nWrite n = r + 5k with r ∈ {0,1,2,3,4} and k ∈ ℤ.  Repeated use of (∗) gives\n      f(r + 5k) = f(r) − 5k. (1)\nConsequently the whole function is determined as soon as the five values f(0), … , f(4) are known.\n\n3.  Looking at the values modulo 5\n----------------------------------\nPut s_r := f(r) (r = 0,…,4).  From (i) we have\n      f(f(r)) = r   ⇒   f(s_r) = r. (2)\nReduce (2) modulo 5 and define the map\n      σ : {0,1,2,3,4} → {0,1,2,3,4}, σ(r) ≡ s_r (mod 5).\nBecause f(f(r)) = r we also have σ(σ(r)) = r, i.e. σ is an involution.  In particular\n      f(0) = 7 ≡ 2 (mod 5)  ⇒  σ(0) = 2 and σ(2) = 0. (3)\nThe values of σ on 1,3,4 can be chosen arbitrarily, subject only to the involution condition.\n\n4.  Splitting off the integer part of f(r)\n-----------------------------------------\nWrite\n      f(r) = σ(r) + 5a_r  (a_r ∈ ℤ). (4)\nUsing (1) we then obtain, for any k ∈ ℤ,\n      f(r + 5k) = σ(r) + 5(a_r − k). (5)\nApply f to (4) and substitute (5) with k = a_r:\n      f(f(r)) = f(σ(r) + 5a_r)\n               = σ(σ(r)) + 5(a_{σ(r)} − a_r)\n               = r.\nBecause σ is an involution, σ(σ(r)) = r, whence\n      a_{σ(r)} = a_r  for all r. (6)\nTaking r = 0 and using (3) gives\n      7 = f(0) = σ(0) + 5a_0 = 2 + 5a_0 ⇒ a_0 = 1,\nso, by (6), a_2 = 1 as well.\n\n5.  General description of all solutions\n----------------------------------------\nConversely, choose\n• an involution σ of {0,1,2,3,4} with σ(0)=2, σ(2)=0; \n• integers a_r satisfying a_0 = 1 and (6), i.e. the two members of every 2-cycle of σ receive the same a–value.\n\nDefine f by (5): for n = r + 5k with r ∈ {0,…,4} and k ∈ ℤ let\n      f(n) = σ(r) + 5(a_r − k). (7)\nThe calculations above can now be traced backwards to see that (7) satisfies (i), (ii) and (iii).  Conversely, every function satisfying the three given conditions must arise in this way.  Hence (7) with the stated requirements on σ and the a_r gives the full set of solutions.\n\n6.  A concrete example (now corrected)\n--------------------------------------\nChoose the involution\n      σ(r) ≡ 2 − r (mod 5),\nso that 0 ↔ 2,   1 is fixed,   3 ↔ 4.  (Written explicitly: σ(0)=2, σ(1)=1, σ(2)=0, σ(3)=4, σ(4)=3.)\nSelect the integers a_r as follows\n      a_0 = a_1 = a_2 = 1, a_3 = a_4 = 0.\n(This respects a_{σ(r)} = a_r and a_0 = 1.)\nWith these data, (7) becomes, for n = r + 5k,\n      f(n) = σ(r) + 5(a_r − k) = (2 − r) + 5(1 − k) = 7 − (r + 5k) = 7 − n.\nThus\n      f(n) = 7 − n  (n ∈ ℤ),\nwhich indeed obeys conditions (i)–(iii).\n\nTherefore the set of all functions satisfying (i)–(iii) is precisely the family given in Section 5.",
      "_meta": {
        "core_steps": [
          "Exhibit f(n)=1−n and check it satisfies (i)–(iii).",
          "From (i) and (iii) deduce f(1)=0.",
          "Apply f to (ii) and use (i) to get the linear relation f(n+2)=f(n)−2.",
          "Solve this recurrence by induction, using the known value at n=0, to obtain f(n)=1−n for all n.",
          "Conclude this is the unique function satisfying the three conditions."
        ],
        "mutable_slots": {
          "slot_shift": {
            "description": "The fixed increment '2' that appears both as +2 in the argument (n+2) and as the external +2 in condition (ii). Replacing 2 by any integer k leaves the derivation f(n+k)=f(n)−k and the rest of the argument unchanged.",
            "original": "2"
          },
          "slot_base_value": {
            "description": "The prescribed value f(0)=1.  Any specification f(0)=c (and consequently the target function c−n) works; the same constant re-appears in the candidate solution and in step 2.",
            "original": "1"
          }
        }
      }
    }
  },
  "checked": true,
  "problem_type": "proof",
  "iteratively_fixed": true
}