---
# System prepended metadata

title: week3

---

### Quiz 1: Term Similarity Using Cosine Similarity

**Concept:** Term similarity is measured by the cosine of the angle between term vectors.

For vectors $\mathbf{T_1}, \mathbf{T_2}, \mathbf{T_3}$:

$$
\cos(\theta) = \frac{\mathbf{T_1} \cdot \mathbf{T_i}}{|\mathbf{T_1}| \, |\mathbf{T_i}|}, \quad i = 2,3
$$

Term 1 is more similar to Term 2 than Term 3 if:

$$
\cos(\theta_{1,2}) > \cos(\theta_{1,3})
$$

**Example:**  
$\mathbf{T_1} = (1,2), \mathbf{T_2} = (2,4), \mathbf{T_3} = (1,-1)$  

$$
\cos(\theta_{1,2}) = 1, \quad \cos(\theta_{1,3}) \approx -0.32
$$

So Term 1 is closer to Term 2.


### Quiz 2: Special Collection of Documents

A "special collection" can only be made using all four columns of the matrix.  

This means if the columns are $\mathbf{c}_1, \mathbf{c}_2, \mathbf{c}_3, \mathbf{c}_4$, then any document $\mathbf{d}$ in this collection is:

$$
\mathbf{d} = a_1 \mathbf{c}_1 + a_2 \mathbf{c}_2 + a_3 \mathbf{c}_3 + a_4 \mathbf{c}_4
$$

No subset of fewer columns can make this document, so the columns are linearly independent.  
The "special collection" is just the span of all four columns.

### Quiz 3: Columns are Linearly Independent

**Concept:** A set of columns is linearly independent if no column can be written as a combination of the others.

If a matrix has columns $\mathbf{c}_1, \mathbf{c}_2, \dots, \mathbf{c}_n$, they are independent if:

$$
a_1 \mathbf{c}_1 + a_2 \mathbf{c}_2 + \dots + a_n \mathbf{c}_n = 0 \implies a_1 = a_2 = \dots = a_n = 0
$$

**Example:**  
Matrix with columns:

$$
\mathbf{c}_1 = 
\begin{bmatrix}1\\0\end{bmatrix}, \quad
\mathbf{c}_2 = 
\begin{bmatrix}0\\1\end{bmatrix}
$$

No combination of $\mathbf{c}_1$ and $\mathbf{c}_2$ gives the zero vector unless both coefficients are 0, so they are linearly independent.


### Quiz 4: Invertible Linear Transformation

**Concept:** A matrix represents an invertible linear transformation if it does not reduce the dimension of the space it acts on.  

For a 4×4 matrix **M**, it is invertible if:

$$
\det(M) \neq 0
$$

This means it does **not squash** a 4D vector into a lower-dimensional space.  

**Example:**  
Matrix

$$
M = 
\begin{bmatrix}
1 & 0 & 0 & 0\\
0 & 1 & 0 & 0\\
0 & 0 & 1 & 0\\
0 & 0 & 0 & 1
\end{bmatrix}
$$

is invertible because $\det(M) = 1 \neq 0$. No 4D vector gets collapsed into 3D.

### Quiz 5: Determinant Changes Sign

**Concept:** Subtracting a constant from all elements of a matrix can change the sign of its determinant.  

For matrix **M₃**, we subtracted 3 from every element:

$$
M_3 = M - 3J
$$

where **J** is a matrix of ones. This can flip the sign of the determinant.  

**Example (2×2):**  

Let  

$$
A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}, \quad \det(A) = 3
$$

Subtract 1 from every element:  

$$
A' = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \quad \det(A') = 1
$$

Subtract 2 from every element:  

$$
A'' = \begin{bmatrix} 0 & -1 \\ -1 & 0 \end{bmatrix}, \quad \det(A'') = -1
$$

So the determinant can indeed become negative after subtracting a constant.

### Quiz 6: Inverse Matrix Exists

**Concept:** A matrix **B** exists such that:

$$
MB = I \quad \text{and} \quad BM = I
$$

where **I** is the identity matrix. This means **B is the inverse of M**.  

**Example (2×2):**  

Let  

$$
M = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix}, \quad 
B = \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix}
$$

Then:

$$
MB = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix} 
\begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix} 
= \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I
$$

$$
BM = \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix} 
\begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix} 
= \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I
$$

So **B is the inverse of M**, and both products give the identity.

### Quiz 7: Columns of M₃ are Linearly Independent

**Concept:** Columns are linearly independent if no column can be written as a combination of the others.

For matrix **M₃** with columns $\mathbf{c}_1, \mathbf{c}_2, \mathbf{c}_3, \mathbf{c}_4$:

$$
a_1 \mathbf{c}_1 + a_2 \mathbf{c}_2 + a_3 \mathbf{c}_3 + a_4 \mathbf{c}_4 = 0 \implies a_1 = a_2 = a_3 = a_4 = 0
$$

**Example (2×2):**  

$$
\mathbf{c}_1 = \begin{bmatrix}1\\0\end{bmatrix}, \quad
\mathbf{c}_2 = \begin{bmatrix}0\\1\end{bmatrix}
$$

No combination of $\mathbf{c}_1$ and $\mathbf{c}_2$ gives the zero vector unless both coefficients are 0, so the columns are linearly independent.

### Quiz 8: Creating M₃ from M

**Concept:** M₃ can be created from M using basic matrix operations like subtraction and scalar multiplication.  

One common method is using the all-ones matrix **J**:

$$
M_3 = M - 3J
$$

where **J** has the same size as M and every entry is 1.  

**Example (2×2):**  

Let  

$$
M = \begin{bmatrix} 4 & 5 \\ 6 & 7 \end{bmatrix}, \quad
J = \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}
$$

Then:

$$
M_3 = M - 3J = \begin{bmatrix} 4-3 & 5-3 \\ 6-3 & 7-3 \end{bmatrix} = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}
$$

So M₃ is created from M using subtraction.
