{
  "version": "1.0",
  "resource": "Calculus: find the first error",
  "created": "2026-11-18",
  "provenance": "Eight original teaching examples authored for InkDraft R008. The ambiguous note is an original generated stroke drawing, not student handwriting.",
  "assumptions": "Differentiate with respect to real x. Trigonometric arguments are in radians. A caret indicates a power: x^2 means x squared. Work only on the stated domain.",
  "instructions": "For each worked example, identify the earliest incorrect numbered line, or write no error. Explain why and give a corrected derivative. If the source is ambiguous, ask for clarification instead of guessing. Some examples are correct.",
  "exercises": [
    {
      "id": 1,
      "title": "A power of a polynomial",
      "function": "f(x) = (2x^3 - 5)^4",
      "domain": "all real x",
      "work": ["u = 2x^3 - 5;  f(x) = u^4", "f'(x) = 4u^3", "f'(x) = 4(2x^3 - 5)^3"],
      "first_error": 2,
      "rule": "Chain rule",
      "reason": "Line 2 differentiates with respect to x but omits du/dx. Since du/dx = 6x^2, the outer derivative must be multiplied by 6x^2.",
      "repair": "f'(x) = 24x^2(2x^3 - 5)^3",
      "check": "At x = 1 the derivative is -648; the proposed result is -108."
    },
    {
      "id": 2,
      "title": "A trigonometric composition",
      "function": "f(x) = sin(3x^2 + 1)",
      "domain": "all real x",
      "work": ["u = 3x^2 + 1;  du/dx = 6x", "f'(x) = cos(u) * 6x", "f'(x) = 6x cos(3x^2 + 1)"],
      "first_error": null,
      "rule": "Chain rule; correct-work control",
      "reason": "No error. The cosine is evaluated at the whole inner expression, and the inner derivative 6x is included. Do not change correct work just because other examples contain mistakes.",
      "repair": "f'(x) = 6x cos(3x^2 + 1)",
      "check": "The derivative is 0 at x = 0. That single value alone does not prove the formula."
    },
    {
      "id": 3,
      "title": "A product",
      "function": "f(x) = x^2 cos(x)",
      "domain": "all real x",
      "work": ["u = x^2;  v = cos(x)", "f'(x) = u'v'", "f'(x) = -2x sin(x)"],
      "first_error": 2,
      "rule": "Product rule",
      "reason": "Line 2 uses a product of derivatives. The derivative of uv is u'v + uv'. Keep the undifferentiated factor in each term.",
      "repair": "f'(x) = 2x cos(x) - x^2 sin(x)",
      "check": "At x = pi, the derivative is -2pi; the proposed result is 0."
    },
    {
      "id": 4,
      "title": "An exponential factor",
      "function": "f(x) = x e^(2x)",
      "domain": "all real x",
      "work": ["u = x;  v = e^(2x)", "u' = 1;  v' = e^(2x)", "f'(x) = e^(2x) + x e^(2x)"],
      "first_error": 2,
      "rule": "Chain rule inside a product",
      "reason": "The product-rule structure in line 3 is consistent with line 2, but line 2 first goes wrong: v' needs the inner derivative 2. Locate that earlier mistake rather than blaming the product rule.",
      "repair": "f'(x) = e^(2x) + 2x e^(2x)",
      "check": "At x = 1, the derivative is 3e^2; the proposed result is 2e^2."
    },
    {
      "id": 5,
      "title": "A quotient",
      "function": "f(x) = (x^2 + 1) / (x - 2)",
      "domain": "x != 2",
      "work": ["u = x^2 + 1;  v = x - 2", "f'(x) = (u'v - uv') / v", "f'(x) = [2x(x - 2) - (x^2 + 1)] / (x - 2)"],
      "first_error": 2,
      "rule": "Quotient rule",
      "reason": "Line 2 is missing the square on the denominator. The rule is (u'v - uv') / v^2, where v is nonzero. The numerator's order is already correct.",
      "repair": "f'(x) = (x^2 - 4x - 1) / (x - 2)^2",
      "check": "At x = 0, the derivative is -1/4; the proposed result is 1/2."
    },
    {
      "id": 6,
      "title": "Check before correcting",
      "function": "f(x) = (3x + 2) / (x^2 + 1)",
      "domain": "all real x",
      "work": ["u = 3x + 2; v = x^2 + 1; u' = 3; v' = 2x", "f'(x) = [3(x^2 + 1) - (3x + 2)2x] / (x^2 + 1)^2", "f'(x) = (-3x^2 - 4x + 3) / (x^2 + 1)^2"],
      "first_error": null,
      "rule": "Quotient rule; correct-work control",
      "reason": "No error, with u = 3x + 2 and v = x^2 + 1. Expanding the numerator gives 3x^2 + 3 - 6x^2 - 4x. The denominator is positive for every real x.",
      "repair": "f'(x) = (-3x^2 - 4x + 3) / (x^2 + 1)^2",
      "check": "At x = 0, the derivative is 3."
    },
    {
      "id": 7,
      "title": "The rule or the algebra?",
      "function": "f(x) = (x^2 - 4) / (x + 1)",
      "domain": "x != -1",
      "work": ["u = x^2 - 4; v = x + 1; u' = 2x; v' = 1", "f'(x) = [2x(x + 1) - (x^2 - 4)] / (x + 1)^2", "f'(x) = (x^2 + 2x - 4) / (x + 1)^2"],
      "first_error": 3,
      "rule": "Correct quotient rule; algebra error",
      "reason": "With u = x^2 - 4 and v = x + 1, lines 1 and 2 are correct. In line 3, subtracting (x^2 - 4) gives -x^2 + 4. The constant must be +4, not -4.",
      "repair": "f'(x) = (x^2 + 2x + 4) / (x + 1)^2",
      "check": "At x = 0, the derivative is 4; the proposed result is -4."
    },
    {
      "id": 8,
      "title": "When the source is unclear",
      "function": "See the handwritten-style note below.",
      "domain": "all real x under either proposed reading",
      "work": [],
      "first_error": "clarification_required",
      "rule": "Clarification before calculation",
      "reason": "The raised 2 is between sin and x in this deliberately ambiguous copied note. Ask whether the writer means sin(x^2) or (sin(x))^2; ask them to rewrite it with parentheses. Do not select either reading from context or declare a unique derivative.",
      "repair": "If sin(x^2): f'(x) = 2x cos(x^2). If (sin(x))^2: f'(x) = 2 sin(x) cos(x).",
      "check": "Both conditional derivatives are valid. At x = 1 they are 2 cos(1) and 2 sin(1) cos(1), respectively, and are different.",
      "prompt": "The exponent placement is unclear. What would you ask the writer? Give both possible readings and their conditional derivatives, without choosing one."
    }
  ]
}
