Vectors and Matrices in Python Solutions

Vectors and Matrices in Python Solutions Exercise 1 : Vectors in $\mathbb{R}^7$ Consider the following vectors: $$ u = (0.5, 0.4, 0.4, 0.5, 0.1, 0.4, 0.1), \quad v = (-1, -2, 1, -2, 3, 1, -5) $$Using Python and NumPy: Check whether $u$ and $v$ are unit vectors. Compute the dot product of $u$ and $v$. Determine if $u$ and $v$ are orthogonal. import numpy as np u = np.array([0.5, 0.4, 0.4, 0.5, 0.1, 0.4, 0.1]) v = np.array([-1, -2, 1, -2, 3, 1, -5]) # 1. Check if u and v are unit vectors norm_u = np.linalg.norm(u) norm_v = np.linalg.norm(v) print(norm_u, norm_v) # 2. Dot product dot_uv = np.dot(u, v) print(dot_uv) # 3. Orthogonality print(np.isclose(dot_uv, 0)) Exercise 2 : Norms and Orthogonality Consider the following vectors in $\mathbb{R}^9$: ...

November 9, 2025 · 1298 wierder

Vectors and Matrices in Python

Vectors and Matrices in Python In this worksheet, you will use Python (NumPy) to perform vector and matrix operations. For each exercise, write Python code to compute the required results and verify them numerically. Exercise 1 : Vectors in $\mathbb{R}^7$ Consider the following vectors: $$ u = (0.5, 0.4, 0.4, 0.5, 0.1, 0.4, 0.1), \quad v = (-1, -2, 1, -2, 3, 1, -5) $$Using Python and NumPy: Check whether $u$ and $v$ are unit vectors. Compute the dot product of $u$ and $v$. Determine if $u$ and $v$ are orthogonal. Exercise 2 : Norms and Orthogonality Consider the following vectors in $\mathbb{R}^9$: ...

November 9, 2025 · 732 wierder

Vectors and Matrices

Vectors and Matrices Exercise 1 Consider the following vectors in $ \mathbb{R}^7 $: $$ u = (0.5, 0.4, 0.4, 0.5, 0.1, 0.4, 0.1), \quad v = (-1, -2, 1, -2, 3, 1, -5) $$ Check if $ u $ and $ v $ are unit vectors. Calculate the dot product of the vectors $ u $ and $ v $. Are $ u $ and $ v $ orthogonal? Exercise 2 Consider the following vectors in $ \mathbb{R}^9 $: ...

November 6, 2025 · 742 wierder

Null Spaces and Ranges

Null Spaces and Ranges Exercise 1 Give an example of a linear map \( T \) such that \(\dim \text{null} \, T = 3\) and \(\dim \text{range} \, T = 2\). Exercise 2 Suppose \( V \) is a vector space and \( S, T \in \mathcal{L}(V, V) \) are such that \[\text{range} \, S \subset \text{null} \, T.\] Prove that \((ST)^2 = 0\). Exercise 3 Suppose \( v_1, \ldots, v_m \) is a list of vectors in \( V \). Define \( T \in \mathcal{L}(\mathbb{F}^m, V) \) by ...

September 9, 2025 · 1274 wierder

Vector Space of Linear Maps

Vector Space of Linear Maps Exercise 1 Suppose \( b, c \in \mathbb{R} \). Define \( T: \mathbb{R}^3 \to \mathbb{R}^2 \) by \[T(x, y, z) = (2x - 4y + 3z + b, 6x + cxyz).\] Show that \( T \) is linear if and only if \( b = c = 0 \). Exercise 2 Suppose \( b, c \in \mathbb{R} \). Define \( T: \mathcal{P}(\mathbb{R}) \to \mathbb{R}^2 \) by ...

September 9, 2025 · 476 wierder

Dimension

Dimension Exercise 1 Suppose \( V \) is finite-dimensional and \( U \) is a subspace of \( V \) such that \[\dim U = \dim V \] Prove that \( U = V \) Exercise 2 Show that the subspaces of \( \mathbb{R}^2 \) are precisely \(\{0\}, \mathbb{R}^2\), and all lines in \( \mathbb{R}^2 \) through the origin. Exercise 3 Show that the subspaces of \( \mathbb{R}^3 \) are precisely \(\{0\}, \mathbb{R}^3\), all lines in \( \mathbb{R}^3 \) through the origin, and all planes in \( \mathbb{R}^3 \) through the origin. ...

September 9, 2025 · 685 wierder

Bases

Bases Exercise 1 Find all vector spaces that have exactly one basis. Exercise 2 Verify all the assertions: The list \((1,0,\ldots,0), (0,1,0,\ldots,0), \ldots, (0,\ldots,0,1)\) is a basis of \(\mathbb{F}^n\), called the standard basis of \(\mathbb{F}^n\). The list \((1,2), (3,5)\) is a basis of \(\mathbb{F}^2\). The list \((1,2,-4), (7,-5,6)\) is linearly independent in \(\mathbb{F}^3\) but is not a basis of \(\mathbb{F}^3\) because it does not span \(\mathbb{F}^3\). The list \((1,2), (3,5), (4,13)\) spans \(\mathbb{F}^2\) but is not a basis of \(\mathbb{F}^2\) because it is not linearly independent. ...

September 9, 2025 · 477 wierder

Subspaces

Subspaces Exercise 1 For each of the following subsets of $\mathbb{F}^3$, determine whether it is a subspace of $\mathbb{F}^3$: ${(x_1, x_2, x_3) \in \mathbb{F}^3 : x_1 + 2x_2 + 3x_3 = 0}$ ${(x_1, x_2, x_3) \in \mathbb{F}^3 : x_1 + 2x_2 + 3x_3 = 4}$ ${(x_1, x_2, x_3) \in \mathbb{F}^3 : x_1 x_2 x_3 = 0}$ ${(x_1, x_2, x_3) \in \mathbb{F}^3 : x_1 = 5x_3}$ Exercise 2 Show that the set of differentiable real-valued functions $f$ on the interval $(-4, 4)$ such that $f’( -1) = 3f(2)$ is a subspace of $\mathbb{R}^{(-4, 4)}$. ...

September 9, 2025 · 887 wierder

Span and Linear Independence

Span and Linear Independence Exercise 1 Suppose $v_1, v_2, v_3, v_4$ spans $V$. Prove that the list $$v_1 - v_2, v_2 - v_3, v_3 - v_4, v_4$$ also spans $V$. Exercise 2 Verify the assertions: A list $v$ of one vector $v \in V$ is linearly independent if and only if $v \neq 0$. A list of two vectors in $V$ is linearly independent if and only if neither vector is a scalar multiple of the other. ...

September 8, 2025 · 544 wierder

Eigenvalues and Eigenvectors

Eigenvalues and Eigenvectors Exercise 1 Confirm by multiplication that x is an eigenvector of A, and find the corresponding eigenvalue. \( A = \begin{bmatrix} 1 & 2 \\ 3 & 2 \end{bmatrix}, \quad x = \begin{bmatrix} 1 \\ -1 \end{bmatrix} \) \( A = \begin{bmatrix} 5 & -1 \\ 3 & 2 \end{bmatrix}, \quad x = \begin{bmatrix} 1 \\ 1 \end{bmatrix} \) \( A = \begin{bmatrix} 4 & 0 & 0 \\ 2 & 3 & 2 \\ 1 & 0 & 4 \end{bmatrix}, \quad x = \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} \) \( A = \begin{bmatrix} 2 & -1 & -1 \\ -1 & 2 & -1 \\ -1 & -1 & 2 \end{bmatrix}, \quad x = \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} \) Exercise 2 Find the characteristic equation, the eigenvalues, and bases for the eigenspaces of the matrix. ...

September 7, 2025 · 2121 wierder