# Week 4 Quiz Answers: Linear Systems & Documents
## Situation 1: Vehicle Matrix D and Matrix A
### Question 1: **TRUE**
**Statement:** The null space vector provided is a solution to the system $Dx = 0$, where $D$ is the full matrix of vehicles, including the value_score column, and the i-th value in $x$ corresponds to the i-th column of $D$.
**Explanation:**
By definition, a null-space vector $x$ satisfies $Dx = 0$. In the notebook, the vector shown as a "basis for the null space" of $D$ is exactly such a vector, with one entry per column of $D$.
**Answer: TRUE**
---
### Question 2: **FALSE**
**Statement:** The matrix $D$ has a rank less than its number of columns. Therefore, if we pick a vector $b$ with a compatible number of rows, the system of equations $Dx = b$ has no solution.
**Explanation:**
Rank less than the number of columns means the columns of $D$ are linearly dependent, so the null space is nontrivial. This implies that solutions (when they exist) are **not unique**, but it does not mean there is never a solution.
Key insight:
- Any $b$ in the **column space** of $D$ gives at least one solution
- Only $b$ **outside** the column space gives no solution
The statement incorrectly claims that ANY vector $b$ has no solution, which is false.
**Answer: FALSE**
---
### Question 3: **FALSE**
**Statement:** Given $A$ as described in the notebook, it is possible that the column weight is a perfect linear combination of the rest of the columns in $A$. I.e., we can find $a, b, c$ such that the following is true:
$$a \cdot \text{acc} + b \cdot \text{model_year} + c \cdot \text{cyl} = \text{weight}$$
**Explanation:**
In the notebook, the matrix formed from the columns (weight, acceleration, model_year, cylinders) is described as having an **empty null space**.
Empty null space means:
- Only the zero vector is in the null space
- The matrix has **full column rank**
- There is no nontrivial linear dependence among the columns
Therefore, weight **cannot** be an exact linear combination of acceleration, model_year, and cylinders.
**Answer: FALSE**
---
### Question 4: **TRUE**
**Statement:** $A'$ is invertible. Therefore, there is only one way to add multiples of the columns of $A'$ to "create" $b'$. That is, there is only one linear combination of the columns of $A'$ that yields $b'$.
**Explanation:**
If $A'$ is invertible, the system $A'x = b'$ has a **unique solution**.
Interpreting this geometrically:
- The entries of $x$ are coefficients in a linear combination of the columns of $A'$
- There is exactly one coefficient vector $x$
- Hence exactly one linear combination of the columns that produces $b'$
This is a fundamental property of invertible matrices: the transformation is one-to-one and onto.
**Answer: TRUE**
---
## Situation 2: Document Matrix C and Cosine Distance
### Question 5: **TRUE**
**Statement:** Consider the document $d$ we created. Document $d$ is in the row space of the matrix $C$.
**Explanation:**
The document $d$ is defined by adding existing document rows (for example, $d = \text{row}_1 + \text{row}_2$).
The **row space** of $C$ consists of all linear combinations of its rows. Since $d$ is such a combination, it lies in the row space of $C$.
**Mathematical formulation:**
$$d = c_1 \cdot \text{row}_1 + c_2 \cdot \text{row}_2 + \cdots + c_n \cdot \text{row}_n$$
This is exactly the definition of membership in the row space.
**Answer: TRUE**
---
### Question 6: **FALSE**
**Statement:** The heatmap visualization of cosine distances allows us to observe the angle between document vectors.
**Explanation:**
The heatmap shows **cosine distances**, typically defined as:
$$\text{cosine distance} = 1 - \cos(\theta)$$
This reflects similarity indirectly, but it does **not** display the actual angle $\theta$ itself.
What you can observe:
- Which pairs are more or less similar
- Relative similarity relationships
What you **cannot** observe:
- The actual angle values $\theta$ directly
To see angles, you would need to compute $\theta = \arccos(\text{similarity})$.
**Answer: FALSE**
---
### Question 7: **TRUE**
**Statement:** By looking at the cosine distance matrix (at the bottom of the notebook), we see evidence of documents that do not share any terms in common.
**Explanation:**
The document vectors here are nonnegative term-frequency vectors.
If two documents share **no terms** in common:
- Every product of corresponding entries is zero
- Their dot product is zero: $\vec{d}_1 \cdot \vec{d}_2 = 0$
- Cosine similarity $= \frac{0}{\|\vec{d}_1\| \|\vec{d}_2\|} = 0$
- Cosine distance $= 1 - 0 = 1$
Therefore, **off-diagonal entries equal to 1** in the cosine distance matrix are evidence of document pairs that have no overlapping terms (in the chosen vocabulary).
**Answer: TRUE**
---
### Question 8: **FALSE**
**Statement:** In the cosine distance matrix, if there were 0 values on the off-diagonal, that would indicate two documents that must be identical, i.e., exactly the same.
**Explanation:**
Cosine distance $= 0$ means cosine similarity $= 1$, which means:
$$\cos(\theta) = 1 \implies \theta = 0°$$
This means the vectors are **parallel**: one is a positive scalar multiple of the other.
$$\vec{d}_1 = k \cdot \vec{d}_2 \text{ for some } k > 0$$
For term-frequency vectors, this means:
- Same **relative term pattern** (proportions)
- Possibly different **overall counts** (magnitudes)
**Example:**
- Document 1: "cat cat dog" → $[2, 1]$
- Document 2: "cat cat cat dog dog dog" → $[3, 3] = 1.5 \times [2, 2]$... wait, let me recalculate
- Document 2: "cat cat dog" repeated twice → $[4, 2] = 2 \times [2, 1]$
These have cosine similarity = 1 but are not identical entry-by-entry.
The documents need **not** be exactly the same.
**Answer: FALSE**
---
## Answer Summary
| Question | Situation | Answer |
|----------|-----------|--------|
| Q1 | Vehicle Matrix (Situation 1) | **TRUE** |
| Q2 | Vehicle Matrix (Situation 1) | **FALSE** |
| Q3 | Vehicle Matrix (Situation 1) | **FALSE** |
| Q4 | Vehicle Matrix (Situation 1) | **TRUE** |
| Q5 | Document Matrix (Situation 2) | **TRUE** |
| Q6 | Document Matrix (Situation 2) | **FALSE** |
| Q7 | Document Matrix (Situation 2) | **TRUE** |
| Q8 | Document Matrix (Situation 2) | **FALSE** |