Skip to main content
Mathematics LibreTexts

19.2: Solving Eigenproblems - A 2x2 Example

  • Page ID
    67887
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    from urllib.request import urlretrieve
    
    urlretrieve('https://raw.githubusercontent.com/colbrydi/jupytercheck/master/answercheck.py', 
                'answercheck.py');
    from IPython.display import YouTubeVideo
    YouTubeVideo("0UbkMlTu1vo",width=640,height=360, cc_load_policy=True)

    Consider calculating eigenvalues for any \(2 \times 2\) matrix. We want to solve:

    \[|A - \lambda I_2 | = 0 \nonumber \]

    \[\begin{split}
    \left|
    \left[
    \begin{matrix}
    a_{11} & a_{12} \\
    a_{21} & a_{22}
    \end{matrix}
    \right]
    - \lambda \left[
    \begin{matrix}
    1 & 0 \\
    0 & 1
    \end{matrix}
    \right]
    \right|
    =
    \left|
    \left[
    \begin{matrix}
    a_{11}-\lambda & a_{12} \\
    a_{21} & a_{22}-\lambda
    \end{matrix}
    \right]
    \right|
    =0
    \end{split} \nonumber \]

    We know this determinant:

    \[(a_{11}-\lambda)(a_{22}-\lambda) - a_{12} a_{21} = 0 \nonumber \]

    If we expand the above, we get:

    \[a_{11}a_{22}+\lambda^2-a_{11}\lambda-a_{22}\lambda - a_{12} a_{21} = 0 \nonumber \]

    and

    \[\lambda^2-(a_{11}+a_{22})\lambda+a_{11}a_{22} - a_{12} a_{21} = 0 \nonumber \]

    This is a simple quadratic equation. The roots of \(A\lambda^2 + B\lambda + C = 0 \) can be solved using the quadratic formula:

    \[ \frac{-B \pm \sqrt{B^2 - 4AC}}{2A} \nonumber \]

    Question

    Using the above equation. What are the eigenvalues for the following \(2 \times 2\) matrix. Try calculating this by hand and then store the lower value in a variable namede1 and the larger value in e2 to check your answer:

    \[\begin{split}A =
    \left[
    \begin{matrix}
    -4 & -6 \\
    3 & 5
    \end{matrix}
    \right]
    \end{split} \nonumber \]

    # Put your answer here
    from answercheck import checkanswer
    
    checkanswer.float(e1,'c54490d3480079138c8c027a87a366e3');
    from answercheck import checkanswer
    
    checkanswer.float(e2,'d1bd83a33f1a841ab7fda32449746cc4');
    Do This

    Find a numpy function that will calculate eigenvalues and verify the answers from above.

    # Put your answer here
    Question

    What are the corresponding eigenvectors to the matrix \(A\)? This time you can try calculating by hand or just used the function you found in the previous answer. Store the eigenvector associated with the e1 value in a vector named v1 and the eigenvector associated with the eigenvalue e2 in a vector named v2 to check your answer.

    # Put your answer here
    from answercheck import checkanswer
    
    checkanswer.eq_vector(v1,'35758bc2fa8ff4f04cfbcd019844f93d');
    from answercheck import checkanswer
    
    checkanswer.eq_vector(v2,'90b0437e86d2cf70050d1d6081d942f4');
    Question

    Both sympy and numpy can calculate many of the same things. What is the fundamental difference between these two libraries?


    This page titled 19.2: Solving Eigenproblems - A 2x2 Example is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Dirk Colbry via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?