{
  "id": "directional-derivative",
  "version": "59fb633bc0ff",
  "status": "published",
  "name": "Directional Derivative Calculator",
  "question": "What is the directional derivative of f?",
  "summary": "Finds the directional derivative D_u f = ∇f · u of f(x, y) or f(x, y, z) at a point, in the direction of a vector, with the gradient.",
  "category": "math",
  "subcategory": "calculus",
  "url": "https://www.acalculator.org/math/directional-derivative-calculator",
  "markdown": "https://www.acalculator.org/math/directional-derivative-calculator.md",
  "kind": "function",
  "method": "D_u f(P) = ∇f(P) · v/‖v‖, each partial derivative from a computer algebra system, checked numerically.",
  "assumptions": [
    "The direction v is scaled to length 1 first.",
    "Angles in radians. An answer that fails its check is not shown."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "f": {
        "title": "f(x, y, z)",
        "description": "The function, in x and y, or x, y and z.",
        "type": "string",
        "maxLength": 150
      },
      "x0": {
        "title": "Point x",
        "description": "The x coordinate of the point.",
        "type": "number",
        "minimum": -1000000,
        "maximum": 1000000
      },
      "y0": {
        "title": "Point y",
        "description": "The y coordinate of the point.",
        "type": "number",
        "minimum": -1000000,
        "maximum": 1000000
      },
      "z0": {
        "title": "Point z (for f in x, y, z)",
        "description": "The z coordinate; leave empty for f(x, y).",
        "type": "number",
        "minimum": -1000000,
        "maximum": 1000000
      },
      "u1": {
        "title": "Direction, x part",
        "description": "The x component of the direction vector.",
        "type": "number",
        "minimum": -1000000,
        "maximum": 1000000
      },
      "u2": {
        "title": "Direction, y part",
        "description": "The y component of the direction vector.",
        "type": "number",
        "minimum": -1000000,
        "maximum": 1000000
      },
      "u3": {
        "title": "Direction, z part",
        "description": "The z component; empty is 0.",
        "type": "number",
        "minimum": -1000000,
        "maximum": 1000000
      }
    }
  },
  "outputs": {
    "value": {
      "label": "D_u f",
      "description": "How fast f changes at the point, per unit of distance along u.",
      "format": "number"
    },
    "exact": {
      "label": "Exact D_u f",
      "description": "The directional derivative, exactly.",
      "format": "math"
    },
    "gradient": {
      "label": "∇f =",
      "description": "The gradient (f_x, f_y) or (f_x, f_y, f_z).",
      "format": "text"
    },
    "gradientAt": {
      "label": "∇f at the point",
      "description": "The gradient at the point.",
      "format": "text"
    },
    "steepest": {
      "label": "Largest D_u f",
      "description": "‖∇f‖ at the point: the directional derivative along ∇f.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "f": "x^2 - x y + 3y^2",
      "x0": -1,
      "y0": 2,
      "u1": 3,
      "u2": 4
    },
    "outputs": {
      "value": 8,
      "exact": "8",
      "gradient": "(2x - y, -x + 6y)",
      "gradientAt": "(-4, 13)",
      "steepest": 13.601470508735444
    },
    "text": "The directional derivative of x^2 - x y + 3y^2 at the point in the direction (3, 4) is 8."
  },
  "examples": [
    {
      "given": {
        "f": "x^2 - x y + 3y^2",
        "x0": -1,
        "y0": 2,
        "u1": 3,
        "u2": 4
      },
      "expect": {
        "value": 8,
        "exact": "8",
        "gradient": "(2x - y, -x + 6y)",
        "gradientAt": "(-4, 13)"
      },
      "source": "OpenStax, Calculus Volume 3, section 4.6 Directional Derivatives and the Gradient (https://openstax.org/books/calculus-volume-3/pages/4-6-directional-derivatives-and-the-gradient), Example 4.32 (u = (3/5, 4/5))"
    },
    {
      "given": {
        "f": "5x^2 - 2x y + y^2 - 4y z + z^2 + 3x z",
        "x0": 1,
        "y0": -2,
        "z0": 3,
        "u1": -1,
        "u2": 2,
        "u3": 2
      },
      "expect": {
        "value": -8.333333333333334,
        "exact": "-25/3"
      },
      "source": "OpenStax, Calculus Volume 3, section 4.6 Directional Derivatives and the Gradient (https://openstax.org/books/calculus-volume-3/pages/4-6-directional-derivatives-and-the-gradient), Example 4.37"
    },
    {
      "given": {
        "f": "x y",
        "x0": 1,
        "y0": 1,
        "u1": 1,
        "u2": 1
      },
      "expect": {
        "value": 1.4142135623730951,
        "steepest": 1.4142135623730951
      },
      "source": "hand calculation in content.mdx; Python 3"
    }
  ],
  "sources": [
    "OpenStax, Calculus Volume 3, section 4.6 Directional Derivatives and the Gradient (retrieved 2026-10-03): https://openstax.org/books/calculus-volume-3/pages/4-6-directional-derivatives-and-the-gradient"
  ],
  "related": [
    "partial-derivative",
    "jacobian",
    "unit-vector",
    "dot-product"
  ],
  "changelog": []
}
