diff --git a/source/linear-algebra/exercises/outcomes/GT/GT3/generator.sage b/source/linear-algebra/exercises/outcomes/GT/GT3/generator.sage index 96b9cb671..ca2a8a856 100644 --- a/source/linear-algebra/exercises/outcomes/GT/GT3/generator.sage +++ b/source/linear-algebra/exercises/outcomes/GT/GT3/generator.sage @@ -4,16 +4,26 @@ TBIL.config_matrix_typesetting() class Generator(BaseGenerator): def data(self): while True: - ls = [choice([-1,1])*i for i in range(2,7)] - l1,l2 = sample(ls,2) - S=random_matrix(QQ, 2, 2, algorithm='echelonizable', rank=2, upper_bound=2) + # eigenvalues will be two distinct small integers with + # different absolute values + l1,l2 = sample(range(2,6),2) + l1,l2 = l1*choice([-1,1]),l2*choice([-1,1]) + S=random_matrix(QQ, 2, 2, algorithm='echelonizable', rank=2, upper_bound=6) A=S.inverse()*matrix([[l1,1],[0,l2]])*S - if all(a!=0 for a in A.list()): + # to get roughly consistent difficulty + if all(abs(a)>5 for a in A.list()): break + # Get an eigenvector + eigenvector = column_matrix((A-matrix([[l1,0],[0,l1]])).right_kernel(basis='pivot').basis()[0]) + # Scale to get whole numbers + eigenvector = eigenvector[0].denominator()*eigenvector[1].denominator()*eigenvector + return { "matrix": A, "e1": l1, "e2": l2, "charpoly": A.charpoly('lambda_'), + "eigenvector": eigenvector, + "scaled_eigenvector": l1*eigenvector, } diff --git a/source/linear-algebra/exercises/outcomes/GT/GT3/template.xml b/source/linear-algebra/exercises/outcomes/GT/GT3/template.xml index e9086451c..28690890e 100644 --- a/source/linear-algebra/exercises/outcomes/GT/GT3/template.xml +++ b/source/linear-algebra/exercises/outcomes/GT/GT3/template.xml @@ -1,10 +1,23 @@ - -

Explain and demonstrate how to find the eigenvalues of the matrix {{matrix}}.

-
- -

The characteristic polynomial of {{matrix}} is {{charpoly}}.

-

The eigenvalues of {{matrix}} are {{e1}} and {{e2}}.

-
+ + +

Explain and demonstrate how to find the eigenvalues of the matrix {{matrix}}.

+
+ +

The characteristic polynomial of {{matrix}} is {{charpoly}}.

+

The eigenvalues of {{matrix}} are {{e1}} and {{e2}}.

+
+
+ + +

Explain and demonstrate which of these eigenvalues is associated to the eigenvector {{eigenvector}}.

+
+ +

+ {{eigenvector}} is associated with the eigenvalue {{e1}} because + {{matrix}}{{eigenvector}}={{scaled_eigenvector}}={{e1}}{{eigenvector}} +

+
+
diff --git a/source/linear-algebra/source/05-GT/samples/03.ptx b/source/linear-algebra/source/05-GT/samples/03.ptx index 686b81721..2677baf1e 100644 --- a/source/linear-algebra/source/05-GT/samples/03.ptx +++ b/source/linear-algebra/source/05-GT/samples/03.ptx @@ -1,20 +1,51 @@ + + GT3 + + +

+ Explain and demonstrate how to find the eigenvalues of the matrix \left[\begin{array}{cc} -2 & -2 \\ 10 & 7 \end{array}\right] . +

+
+ +

+ Compute the characteristic polynomial: + + \det(A-\lambda I) = \det \left[\begin{array}{cc} -2 - \lambda & -2 \\ 10 & 7-\lambda \end{array}\right] + + + = (-2-\lambda)(7-\lambda)+20 = \lambda ^2 -5\lambda +6 = (\lambda -2)(\lambda -3) + + The eigenvalues are the roots of the characteristic polynomial, namely 2 and 3. +

+
+
-GT3 - -

-Explain how to find the eigenvalues of the matrix \left[\begin{array}{cc} -2 & -2 \\ 10 & 7 \end{array}\right] . -

-
- -

-Compute the characteristic polynomial: -\det(A-\lambda I) = \det \left[\begin{array}{cc} -2 - \lambda & -2 \\ 10 & 7-\lambda \end{array}\right] -= (-2-\lambda)(7-\lambda)+20 = \lambda ^2 -5\lambda +6 = (\lambda -2)(\lambda -3) -The eigenvalues are the roots of the characteristic polynomial, namely 2 and 3. -

-
+ + + +

+ Explain and demonstrate which of these eigenvalues is associated to the eigenvector \left[\begin{array}{cc} -1 \\ 2 \end{array}\right]. +

+
+ + +

+ We can compute + +\left[\begin{array}{cc} -2 & -2 \\ 10 & 7 \end{array}\right] +\left[\begin{array}{cc} -1 \\ 2 \end{array}\right] = +\left[\begin{array}{cc} -2 \\ 4 \end{array}\right] + and +2\left[\begin{array}{cc} -1 \\ 2 \end{array}\right] = +\left[\begin{array}{cc} -2 \\ 4 \end{array}\right] + + which shows that \left[\begin{array}{cc} -1 \\ 2 \end{array}\right] is an + eigenvector associated with the eigenvalue 2. +

+
+
\ No newline at end of file diff --git a/source/linear-algebra/source/meta/sample-exercises.ptx b/source/linear-algebra/source/meta/sample-exercises.ptx index 3cda48a8b..7d97e37cc 100644 --- a/source/linear-algebra/source/meta/sample-exercises.ptx +++ b/source/linear-algebra/source/meta/sample-exercises.ptx @@ -28,7 +28,6 @@ for a complete solution. -