{
  "id": "characteristic-polynomial",
  "version": "ce3876ffeb0c",
  "status": "published",
  "name": "Characteristic Polynomial Calculator",
  "question": "What is the characteristic polynomial?",
  "summary": "Finds the characteristic polynomial det(λI − A) of a square matrix in exact fractions, factored over the rationals.",
  "category": "math",
  "subcategory": "linear-algebra",
  "url": "https://www.acalculator.org/math/characteristic-polynomial-calculator",
  "markdown": "https://www.acalculator.org/math/characteristic-polynomial-calculator.md",
  "kind": "function",
  "method": "The Faddeev-LeVerrier recurrence in exact fractions; rational roots found numerically and confirmed by exact division.",
  "assumptions": [
    "Cells are exact: 0.1 is 1/10, 1/3 is 1/3.",
    "A factor with no rational root stays whole."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "a": {
        "title": "Matrix A",
        "description": "A square matrix, 1 to 6 rows; cells may be fractions such as 1/3.",
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "number"
          }
        }
      }
    }
  },
  "outputs": {
    "poly": {
      "label": "p(λ) = det(λI − A)",
      "description": "The characteristic polynomial, exact.",
      "format": "text"
    },
    "factored": {
      "label": "Factored",
      "description": "p(λ) with each rational root as a factor (λ − r).",
      "format": "text"
    },
    "signed": {
      "label": "det(A − λI)",
      "description": "The same polynomial times (−1)ⁿ.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "a": "-5,2;-7,4"
    },
    "outputs": {
      "poly": "λ² + λ − 6",
      "factored": "(λ + 3)(λ − 2)",
      "signed": "λ² + λ − 6"
    },
    "text": "The characteristic polynomial is λ² + λ − 6."
  },
  "examples": [
    {
      "given": {
        "a": [
          [
            -5,
            2
          ],
          [
            -7,
            4
          ]
        ]
      },
      "expect": {
        "poly": "λ² + λ − 6",
        "factored": "(λ + 3)(λ − 2)"
      },
      "source": "Kuttler, A First Course in Linear Algebra, 7.1, Example 7.1.2. https://math.libretexts.org/Bookshelves/Linear_Algebra/A_First_Course_in_Linear_Algebra_(Kuttler)/07%3A_Spectral_Theory/7.01%3A_Eigenvalues_and_Eigenvectors_of_a_Matrix"
    },
    {
      "given": {
        "a": [
          [
            5,
            -10,
            -5
          ],
          [
            2,
            14,
            2
          ],
          [
            -4,
            -8,
            6
          ]
        ]
      },
      "expect": {
        "poly": "λ³ − 25λ² + 200λ − 500",
        "factored": "(λ − 5)(λ − 10)²"
      },
      "source": "Kuttler, A First Course in Linear Algebra, 7.1, Example 7.1.3"
    }
  ],
  "sources": [
    "Ken Kuttler, A First Course in Linear Algebra, section 7.1 Eigenvalues and Eigenvectors of a Matrix (LibreTexts, CC BY): https://math.libretexts.org/Bookshelves/Linear_Algebra/A_First_Course_in_Linear_Algebra_(Kuttler)/07%3A_Spectral_Theory/7.01%3A_Eigenvalues_and_Eigenvectors_of_a_Matrix"
  ],
  "related": [
    "eigenvector",
    "matrix-diagonalization",
    "determinant",
    "matrix"
  ],
  "changelog": []
}
