Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 1427
Kernel: SageMath (stable)

%html

Linear Algebra

Vectors

To create a vector in Sage, use the vector command.

Exercise: Create the vector x=(1,2,,100)x = (1, 2, \ldots, 100).

%html

Note: vectors in Sage are row vectors!

Exercise: Create the vector y=(12,22,,1002)y = (1^2, 2^2, \ldots, 100^2).

%html <p><strong>Exercise: </strong>Type <strong>x.</strong> and hit tab to see the available methods for vectors. Find the <em>norm</em> (length) of the vectors <strong>x</strong> and <strong>y</strong>.</p>

%html

Exercise: Find the dot product of x and y.

%html

[The above problems are essentially the first problem on Exercise Set 1 of William Stein's Math 480b.]

Matrices

Exercise: Use the matrix command to create the following matrix over the rational numbers (hint: in Sage, QQ denotes the field of rational numbers).

$$\left(\begin{array}{rrrrrr}
3 & 2 & 2 & 1 & 1 & 0 \\
2 & 3 & 1 & 0 & 2 & 1 \\
2 & 1 & 3 & 2 & 0 & 1 \\
1 & 0 & 2 & 3 & 1 & 2 \\
1 & 2 & 0 & 1 & 3 & 2 \\
0 & 1 & 1 & 2 & 2 & 3
\end{array}\right)$$

  1. Find the echelon form of the above matrix.
  2. Find the right kernel of the matrix.
  3. Find the eigenvalues of the matrix.
  4. Find the left eigenvectors of the matrix.
  5. Find the right eigenspaces of the matrix.

%html

Exercise: For what values of kk is the determinant of the following matrix 00?

$$\left(\begin{array}{rrr}
1 & 1 & -1 \\
2 & 3 & k \\
1 & k & 3
\end{array}\right)$$

[K. R. Matthews, Elementary Linear Algebra, Chapter 4, Problem 8]

%html

Exercise: Prove that the determinant of the following matrix is 8-8.

$$\left(\begin{array}{rrr}
{n}^{2} & {\left( n + 1 \right)}^{2} & {\left( n + 2
\right)}^{2} \\
{\left( n + 1 \right)}^{2} & {\left( n + 2 \right)}^{2} &
{\left( n + 3 \right)}^{2} \\
{\left( n + 2 \right)}^{2} & {\left( n + 3 \right)}^{2} & {\left( n + 4 \right)}^{2}\end{array}\right)$$

[K. R. Matthews, Elementary Linear Algebra, Chapter 4, Problem 3]

%html

Exercise: Prove that if aca \neq c, then the line through the points (a,b)(a,b) and (c,d)(c,d) is given by the following equation.

$$\det\left(\begin{array}{rrr}
x & y & 1 \\
a & b & 1 \\
c & d & 1
\end{array}\right) = 0.$$

%html

Exercise: Find the determinant of the following matrices.

$$\left(\begin{array}{r}
1
\end{array}\right),
\left(\begin{array}{rr}
1 & 1 \\
r & 1
\end{array}\right),
\left(\begin{array}{rrr}
1 & 1 & 1 \\
r & 1 & 1 \\
r & r & 1
\end{array}\right),
\left(\begin{array}{rrrr}
1 & 1 & 1 & 1 \\
r & 1 & 1 & 1 \\
r & r & 1 & 1 \\
r & r & r & 1
\end{array}\right),
\left(\begin{array}{rrrrr}
1 & 1 & 1 & 1 & 1 \\
r & 1 & 1 & 1 & 1 \\
r & r & 1 & 1 & 1 \\
r & r & r & 1 & 1 \\
r & r & r & r & 1
\end{array}\right)$$

Make a conjecture about the determinant of an arbitrary matrix in this sequence. Can you prove it your conjecture?

[Adapted from: K. R. Matthews, Elementary Linear Algebra, Chapter 4, Problem 19]

%html

Exercise: What is the largest determinant possible for a 3×33\times3 matrix whose entries are 1,2,,91, 2, \dots, 9 (each occurring exactly once, in any order). How many matrices MM achieve this maximum?

(Hint: You might find the command Permutations useful. The following code will construct all the lists that have the entries 1,2,3,41, 2, 3, 4, each appearing exactly once.)

for P in Permutations(4):
L = list(P)
print L
for P in Permutations(4): L = list(P) print L