{
  "id": "lhopitals-rule",
  "version": "006ae888d59c",
  "status": "published",
  "name": "L'Hopital's Rule Calculator",
  "question": "What is the limit by L'Hopital's rule?",
  "summary": "Finds the limit of f(x)/g(x) at a number or infinity with L'Hopital's rule for 0/0 and ∞/∞ forms, checked numerically.",
  "category": "math",
  "subcategory": "calculus",
  "url": "https://www.acalculator.org/math/lhopitals-rule-calculator",
  "markdown": "https://www.acalculator.org/math/lhopitals-rule-calculator.md",
  "kind": "function",
  "method": "If f/g is 0/0 or ∞/∞ at a, lim f/g = lim f′/g′ (L'Hôpital's rule), applied up to 3 times.",
  "assumptions": [
    "The limit is two-sided at a number.",
    "x in radians; ln is the natural logarithm."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "f": {
        "title": "Numerator f(x)",
        "description": "The top of the quotient, typed like 1 - cos(x) or ln(x).",
        "type": "string",
        "maxLength": 200
      },
      "g": {
        "title": "Denominator g(x)",
        "description": "The bottom of the quotient, typed like x, x^2 or ln(x).",
        "type": "string",
        "maxLength": 200
      },
      "a": {
        "title": "x approaches",
        "description": "A number or a constant such as pi, or inf or -inf.",
        "type": "string",
        "maxLength": 40
      }
    }
  },
  "outputs": {
    "limit": {
      "label": "Limit",
      "description": "The limit of f(x)/g(x), written exactly.",
      "format": "math"
    },
    "value": {
      "label": "As a decimal",
      "description": "The limit to 10 significant figures.",
      "format": "number"
    },
    "form": {
      "label": "Form",
      "description": "0/0 or ∞/∞ when the rule applies; otherwise the rule does not apply.",
      "format": "text"
    },
    "ratio": {
      "label": "f′(x)/g′(x) =",
      "description": "The quotient of the derivatives, whose limit is the same.",
      "format": "math"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "f": "sin(pi x)",
      "g": "ln(x)",
      "a": "1"
    },
    "outputs": {
      "limit": "-π",
      "value": -3.141592653589793,
      "form": "0/0",
      "ratio": "π x cos(π x)"
    },
    "text": "The limit of (sin(pi x))/(ln(x)) as x approaches 1 is -π."
  },
  "examples": [
    {
      "given": {
        "f": "sin(pi x)",
        "g": "ln(x)",
        "a": "1"
      },
      "expect": {
        "limit": "-π",
        "value": -3.141592653589793,
        "form": "0/0"
      },
      "source": "OpenStax, Calculus Volume 1, section 4.8 L'Hôpital's Rule, Example 4.38(b). https://openstax.org/books/calculus-volume-1/pages/4-8-lhopitals-rule"
    },
    {
      "given": {
        "f": "1 - cos(x)",
        "g": "x",
        "a": "0"
      },
      "expect": {
        "limit": "0",
        "value": 0,
        "form": "0/0"
      },
      "source": "OpenStax, Calculus Volume 1, section 4.8 L'Hôpital's Rule, Example 4.38(a)"
    },
    {
      "given": {
        "f": "3x + 5",
        "g": "2x + 1",
        "a": "inf"
      },
      "expect": {
        "limit": "3/2",
        "value": 1.5,
        "form": "∞/∞"
      },
      "source": "OpenStax, Calculus Volume 1, section 4.8 L'Hôpital's Rule, Example 4.39(a)"
    }
  ],
  "sources": [
    "OpenStax, Calculus Volume 1, section 4.8 L'Hôpital's Rule: https://openstax.org/books/calculus-volume-1/pages/4-8-lhopitals-rule"
  ],
  "related": [
    "tangent-line",
    "instantaneous-rate-of-change",
    "integral",
    "end-behavior"
  ],
  "changelog": []
}
