Exercises 4.10 Exercises
1.
Draw the parallelogram having as sides the vector \(v=\begin{pmatrix}2\cr4\cr\end{pmatrix}\) and \(w=\begin{pmatrix}3\cr0\cr\end{pmatrix}\) and evaluate its area. Then write the matrix having these two vectors as its columns and evaluate its determinant. Verify that the two numbers are equal.2.
Every pair of vectors on the plane that span a parallellogram with non-zero area can be used as a basis for the plane. Given the vector \(u=\begin{pmatrix}\phantom{-}3\cr-2\cr\end{pmatrix}\text{,}\) write \(u\) with respect to vectors \(v,w\) defined in the problem above. In other words, find two real numbers \(s,t\) such that \(u=s v+t w\text{.}\) Notice that you will need to solve a \(2\times2\) linear system to find \(s\) and \(t\text{.}\)3.
Denote by \(C^0(\mathbb R)\) the set of all continuous functions of one real variable. Show that \(C^0(\mathbb R)\) is a real vector space, namely it satisfies the 8 properties listed at the beginning of Section 4.1. Then show that, given a point \(x_0\in\mathbb R\text{,}\) the map \(f\mapsto f(x_0)\) defines a linear function on the vector space \(C^0(\mathbb R)\text{.}\) Notice that \(C^0(\mathbb R)\) has infinite dimension since all monomials \(x^n\) are linearly independent, namely none of them can be written as linear combination of the other ones.4.
Denote by \(C^1(\mathbb R)\) the set of all functions in one real variable that are differentiable at every point and whose derivative is continuous. Notice that every \(C^1\) function is continuous but not all continuous functions are \(C^1\) (for instance \(f(x)=|x|\) is continuous but not \(C^1\)). Show that \(C^1(\mathbb R)\) is a real vector space, namely it satisfies the 8 properties listed at the beginning of Section 4.1. Then show that, given a point \(x_0\in\mathbb R\text{,}\) the map \(f\mapsto f'(x_0)\) defines a linear function on the vector space \(C^1(\mathbb R)\text{.}\) Notice that \(C^1(\mathbb R)\) has infinite dimension since all monomials \(x^n\) are $C^1$ and are linearly independent, namely none of them can be written as linear combination of the other ones.5.
Consider the linear function \(f(x,y,z) = 2x-6y+z\text{.}\)- Evaluate "by hand" \(f\) at the points \((0,1,2)\) and \((-1,2,3)\text{.}\)
- Verify your calculations with Python modifying the code used in Section 4.1 to evaluate \(x+2y\) at \((-2,4)\text{.}\)
6.
Evaluate the determinant of the matrix
\begin{equation*}
\begin{pmatrix}2&1&0\cr -4&2&3\cr 6&-1&1\cr\end{pmatrix}
\end{equation*}
in the following two ways: - Using the standard definition (if you do not remember it, you can find it in the determinant's wikipedia page).
- Performing by hand the Gaussian Elimination algorithm and evaluating the determinant of the upper triangular matrix you will end up with.
7.
Use any of the codes in Subsection 4.2.3 to find the LU decomposition of the \(5\times5\) matrix
\begin{equation*}
\begin{pmatrix}3&2&1&0&-1\cr 0&-4&2&3&0\cr 10&6&-1&1&8\cr 5&1&7&1&-3\cr 1&1&1&1&1\cr\end{pmatrix}
\end{equation*}
8.
Find the LU decomposition of the matrix
\begin{equation*}
\begin{pmatrix}a&a&a&a\cr a&b&b&b\cr a&b&c&c\cr a&b&c&d\cr\end{pmatrix}
\end{equation*}
9.
Apply the Gaussian elimination algorithm to the matrix
\begin{equation*}
\begin{pmatrix}1&2&3\cr 3&6&9\cr 7&1&2\cr\end{pmatrix}
\end{equation*}
and explain why the algorithm fails.10.
Use the Gaussian elimination algorithm in the floating point system \(D_3\) (namely keep three digits to represent numbers at every step of the algorithm) to solve the system
\begin{equation*}
\begin{pmatrix}0.780&0.562\cr 0.912&0.659\cr \end{pmatrix} \begin{pmatrix}x\cr y\end{pmatrix} = \begin{pmatrix}0.217\cr0.254\end{pmatrix}.
\end{equation*}
Then use Python to solve the equation in double precision and compare the two numerical solutions.11.
Apply by hand the LU decomposition algorithm in our python implementation to the matrix
\begin{equation*}
\begin{pmatrix}1&2&3\cr 3&6&9\cr 7&1&2\cr\end{pmatrix}
\end{equation*}
Show every step in your answer.12.
Apply by hand the LU decomposition algorithm with partial pivoting in our python implementation to the matrix
\begin{equation*}
\begin{pmatrix}0&1&1\cr 1&2&2\cr 1&2&3\end{pmatrix}.
\end{equation*}
Show every step in your answer.13.
Find the computational complexity of the multiplication of two \(n\times n\) matrices.14.
Given a process that takes time \(O(n^k)\) to be completed, what happens to the runtime if we double the input size (i.e. double \(n\))? What if we triple it?15.
Let \(x,y,z\) be three column \(n\)-vectors, namely \(n\times 1\) matrices, and denote by \(y^T\) the transpose of \(y\) (hence, \(y^T\) is a row \(n\)-vector). Evaluate the computational complexity of the following two ways to evaluate the product \(x y^T z\text{:}\)- \((x y^T) z\text{;}\)
- \(x(y^T z)\text{.}\)