Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132928 views
License: OTHER
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<!-- Sage and Linear Algebra Worksheets -->
4
<!-- Robert A. Beezer -->
5
<!-- Copyright 2017-2019 License: CC BY-SA -->
6
<!-- See COPYING for more information -->
7
8
<pretext xmlns:xi="http://www.w3.org/2001/XInclude">
9
10
<xi:include href="../worksheetinfo.xml" />
11
12
<article xml:id="MISLE">
13
<title>Sage and Linear Algebra Worksheet</title>
14
<subtitle>FCLA Section MISLE</subtitle>
15
16
<!-- header inclusion needs -xinclude switch on xsltproc -->
17
<frontmatter>
18
<xi:include href="../header.xml" />
19
</frontmatter>
20
21
<section>
22
<title>An Invertible Matrix</title>
23
24
<p>An invertible <m>6\times 6</m> matrix.</p>
25
26
<sage>
27
<input>
28
A = matrix(QQ, [[ 1, 2, -1, -2, -1, -6],
29
[-2, -3, 1, 3, 1, 6],
30
[ 2, 4, -1, -4, 0, -7],
31
[ 0, -1, 1, 2, -1, 1],
32
[ 2, 4, -2, -4, -1, -8],
33
[ 1, 0, 0, 0, -1, 2]])
34
A
35
</input>
36
</sage>
37
38
<sage>
39
<input>
40
Ainv = A.inverse()
41
Ainv
42
</input>
43
</sage>
44
45
<sage>
46
<input>
47
Ainv*A
48
</input>
49
</sage>
50
51
<sage>
52
<input>
53
A*Ainv
54
</input>
55
</sage>
56
57
<p>Building the inverse, now column by column, by solving systems of equations with the vector of constants equal to columns of an identity matrix.</p>
58
59
<exercise>
60
<statement>
61
<p>Edit and re-run the next cell, using several different columns of the identity matrix. Compare the solution vectors with the columns of the inverse of <c>A</c> above.</p>
62
</statement>
63
</exercise>
64
65
<sage>
66
<input>
67
y = vector(QQ, [1,0,0,0,0,0])
68
P = A.augment(y, subdivide=True)
69
P.rref()
70
</input>
71
</sage>
72
73
<p>Consolidating the above as the following illustrates Theorem CINM and its proof.</p>
74
75
<sage>
76
<input>
77
B = A.augment(identity_matrix(6), subdivide=True)
78
B
79
</input>
80
</sage>
81
82
<sage>
83
<input>
84
B.rref()
85
</input>
86
</sage>
87
88
</section>
89
90
<section>
91
<title>A Matrix Without an Inverse</title>
92
93
<p>Now, a non-invertible <m>6\times 6</m> matrix.</p>
94
95
<sage>
96
<input>
97
C = matrix(QQ, [[-1, 0, 2, 8, 8, 0],
98
[-1, -1, 0, 1, 0, 3],
99
[-1, -2, -1, -4, -4, 5],
100
[ 1, 2, 1, 4, 5, -5],
101
[-1, -1, -1, -1, -8, 4],
102
[ 0, 1, 0, 3, 5, -1]])
103
C
104
</input>
105
</sage>
106
107
<sage>
108
<input>
109
C.inverse()
110
</input>
111
</sage>
112
113
<exercise>
114
<statement>
115
<p>Edit and re-run the next cell, using several different columns of the identity matrix, in attempts to construct columns of the inverse. Just one of these failures is enough to be certain that <c>A</c> does not have an inverse, following the logic of Example MWIAA.</p>
116
</statement>
117
</exercise>
118
119
<sage>
120
<input>
121
y = vector(QQ, [1,0,0,0,0,0])
122
P = C.augment(y, subdivide=True)
123
P.rref()
124
</input>
125
</sage>
126
127
<p>It is the case that <em>no</em> column of the identity matrix leads to a consistent system (for this matrix). We can see all six systems with a computation reminiscent of Theorem CINM.</p>
128
129
<sage>
130
<input>
131
D = C.augment(identity_matrix(6), subdivide=True)
132
D
133
</input>
134
</sage>
135
136
<sage>
137
<input>
138
D.rref()
139
</input>
140
</sage>
141
142
<exercise>
143
<statement>
144
<p>You might struggle to find <em>any</em> vector of constants that will combine with <c>C</c> to be a consistent systems. (Though there are some. And I can think of seven that are real easy to find if you think about it a bit.)</p>
145
</statement>
146
</exercise>
147
148
<sage>
149
<input>
150
w = vector(QQ, [ ])
151
P = C.augment(w, subdivide=True)
152
P.rref()
153
</input>
154
</sage>
155
156
<exercise>
157
<statement>
158
<p>Do you see the fundamental difference between the matrices <c>A</c> and <c>B</c>?</p>
159
</statement>
160
</exercise>
161
162
<sage />
163
</section>
164
165
<xi:include href="../legal.xml" />
166
167
</article>
168
169
</pretext>
170
171