{
  "id": "linear-approximation",
  "version": "ae22cff4dee9",
  "status": "published",
  "name": "Linear Approximation Calculator",
  "question": "What is the linear approximation of f?",
  "summary": "Finds the linearization L(x) of f at x = a and uses it to estimate f at a nearby x, checked numerically.",
  "category": "math",
  "subcategory": "calculus",
  "url": "https://www.acalculator.org/math/linear-approximation-calculator",
  "markdown": "https://www.acalculator.org/math/linear-approximation-calculator.md",
  "kind": "function",
  "method": "L(x) = f(a) + f′(a)(x − a). A computer algebra system finds f′(a); it is shown only when f′ matches a difference quotient at 20 points and at a.",
  "assumptions": [
    "The variable is x; angles are in radians; ln is the natural logarithm.",
    "An answer that fails its check is not shown."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "f": {
        "title": "Function f(x)",
        "description": "The function to approximate, typed like sqrt(x), sin(x) or x^3.",
        "type": "string",
        "maxLength": 200
      },
      "a": {
        "title": "Centre a",
        "description": "The point where L(x) touches f: a number or a constant such as pi/3.",
        "type": "string",
        "maxLength": 40
      },
      "x": {
        "title": "Estimate f at x = (optional)",
        "description": "A value of x near a where L(x) estimates f(x).",
        "type": "string",
        "maxLength": 40
      }
    }
  },
  "outputs": {
    "line": {
      "label": "L(x) =",
      "description": "The linear approximation L(x) = f(a) + f′(a)(x − a), expanded, with exact numbers.",
      "format": "math"
    },
    "estimate": {
      "label": "Estimate L(x)",
      "description": "L at the chosen x.",
      "format": "number"
    },
    "actual": {
      "label": "Exact f(x)",
      "description": "f at the chosen x, to compare.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "f": "sqrt(x)",
      "a": "9",
      "x": "9.1"
    },
    "outputs": {
      "line": "x/6 + 3/2",
      "estimate": 3.0166666666666666,
      "actual": 3.016620625799671
    },
    "text": "The linear approximation of sqrt(x) at x = 9 is L(x) = x/6 + 3/2."
  },
  "examples": [
    {
      "given": {
        "f": "sqrt(x)",
        "a": "9",
        "x": "9.1"
      },
      "expect": {
        "line": "x/6 + 3/2",
        "estimate": 3.0166666666666666,
        "actual": 3.0166206257996713
      },
      "source": "OpenStax, Calculus Volume 1, section 4.2 Linear Approximations and Differentials, Example 4.5. https://openstax.org/books/calculus-volume-1/pages/4-2-linear-approximations-and-differentials"
    },
    {
      "given": {
        "f": "sin(x)",
        "a": "pi/3",
        "x": "31pi/90"
      },
      "expect": {
        "line": "sqrt(3)/2 - π/6 + x/2",
        "estimate": 0.8834786963043819,
        "actual": 0.8829475928589269
      },
      "source": "OpenStax, Calculus Volume 1, section 4.2 Linear Approximations and Differentials, Example 4.6 (sin 62°, 62° = 31π/90)"
    }
  ],
  "sources": [
    "OpenStax, Calculus Volume 1, section 4.2 Linear Approximations and Differentials: https://openstax.org/books/calculus-volume-1/pages/4-2-linear-approximations-and-differentials"
  ],
  "related": [
    "tangent-line",
    "instantaneous-rate-of-change",
    "integral",
    "square-root"
  ],
  "changelog": []
}
