JavaScript is required. Please enable it to continue.
Your browser lacks required capabilities. Please upgrade it or switch to another to continue.
Loading…
<center><span style="color: lightgray;">Author: Nadiah Kristensen (nadiah.org)</span></center>
<center><strong>(1)</strong> <span style="color:lightgray"> -- (2) -- (3) -- (4) -- (5) -- (6) -- (end)</span> </center> <h2>Part 1</h2> <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> <strong>Question:</strong> What is the columnspace of \(A\)? <hr> <<linkreplace "Reveal hint" t8n>> <p><strong>Hints</strong> <p> To describe a vector space like a columnspace, you describe it in terms of its basis vectors. You write it in the form: <nowiki> $$ \begin{equation} \text{basis}(C(A)) = \left\{ \begin{bmatrix} \cdot \\ \cdot \\ \cdot \end{bmatrix}, \begin{bmatrix} \cdot \\ \cdot \\ \cdot \end{bmatrix}, \ldots \right\} \end{equation} $$ </nowiki> or the form <nowiki> $$ \begin{equation} C(A) = \text{span} \left\{ \begin{bmatrix} \cdot \\ \cdot \\ \cdot \end{bmatrix}, \begin{bmatrix} \cdot \\ \cdot \\ \cdot \end{bmatrix}, \ldots \right\} \end{equation} $$ </nowiki> where each vector is a basis vector of the columnspace of \( A\). </p> <<linkreplace "<p>How do I get the basis vectors of the columnspace of A?</p>" t8n>> <p>The basis vectors of the columnspace of matrix \(A\) are the pivot columns of \(A\).</p> <<linkreplace "<p>Which are the pivot columns of A?</p>" t8n>> <p>A pivot column is any column with a pivot in it.</p> <p>Usually you would perform a Gaussian elimination to find the pivots; however, \( A\) is already in row-echelon form, so you can read the pivots of \(A\) directly.</p> <<linkreplace "<p>Show me step by step how to get the pivots</p>" t8n>> <p> To identify the pivots, walk along each row from the left and highlight the first non-zero element. </p> <p> First row: <nowiki> $$ \begin{equation} \begin{matrix} \rightarrow \\ \phantom{0} \\\phantom{0} \\ \end{matrix} \begin{bmatrix} \color{red} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> </p> <p> Second row: <nowiki> $$ \begin{equation} \begin{matrix} \phantom{0} \\ \rightarrow \\\phantom{0} \\ \end{matrix} \begin{bmatrix} \color{red} 1 & 1 \\ 0 & \color{red} 1 \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> </p> <p> Third row -- no pivot: <nowiki> $$ \begin{equation} \begin{matrix} \phantom{0} \\ \phantom{0} \\ \rightarrow \\ \end{matrix} \begin{bmatrix} \color{red} 1 & 1 \\ 0 & \color{red} 1 \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> </p> <p> Therefore, the pivot columns of \(A\) are columns 1 and 2. </p> <<mathjax>><</linkreplace>> <<mathjax>><</linkreplace>> <<mathjax>><</linkreplace>> <<mathjax>><</linkreplace>> <hr> <<linkreplace "I'm ready to answer">> <strong>Answer</strong>: The columnspace of \(A\) is <p> <strong>(a)</strong> \( \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \begin{bmatrix} 0 \\ 1 \end{bmatrix}, \begin{bmatrix} 0 \\ 0 \end{bmatrix} \right\} \) [[Choose (a) -> part1_incorrect]] </p> <p> <strong>(b)</strong> \( \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \right\} \) [[Choose (b) -> part1_correct]] </p> <p> <strong>(c)</strong> \( \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \right\} \) [[Choose (c) -> part1_incorrect]] </p> <p> <strong>(d)</strong> \( \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \right\} \) [[Choose (d) -> part1_incorrect]] </p> <<mathjax>> <</linkreplace>>
<center><strong>(1)</strong> <span style="color:lightgray"> -- (2) -- (3) -- (4) -- (5) -- (6) -- (end)</span> </center> <h2>Incorrect.</h2> <p> The columnspace of \( A \) is the space spanned by its pivot columns. </p> <p> Usually, we perform a Gaussian elimination on \(A\) to get \(A\) into row-echelon form so we can identify the pivots. However, \(A\) is already in row-echelon form, so we can read-off the pivots directly <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> </p> <p> The pivots of \(A\) are: </p> <p> <strong>(a)</strong> \(A = \begin{bmatrix} \color{red} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \) <span id="find_pivots_wrong"> <<linkreplace "Choose (a)" t8n>> Incorrect. <<run $("#found_pivots_wrong").show()>> <<replace "#find_pivots_right">><</replace>> <</linkreplace>> </span> </p> <p> <strong>(b)</strong> \(A = \begin{bmatrix} \color{red} 1 & 1 \\ 0 & \color{red} 1 \\ 0 & 0 \end{bmatrix} \) <span id="find_pivots_right"> <<linkreplace "Choose (b)" t8n>> Correct! <<replace "#find_pivots_wrong">><</replace>> <<run $("#found_pivots").show()>> <</linkreplace>> </span> </p> <span id="found_pivots_wrong" style="display:none"> <p> To identify the pivots, walk along each row from the left and highlight the first non-zero element. </p> <p> First row: <nowiki> $$ \begin{equation} \begin{matrix} \rightarrow \\ \phantom{0} \\\phantom{0} \\ \end{matrix} \begin{bmatrix} \color{red} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> </p> <p> Second row: <nowiki> $$ \begin{equation} \begin{matrix} \phantom{0} \\ \rightarrow \\\phantom{0} \\ \end{matrix} \begin{bmatrix} \color{red} 1 & 1 \\ 0 & \color{red} 1 \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> </p> <p> Third row -- no pivot: <nowiki> $$ \begin{equation} \begin{matrix} \phantom{0} \\ \phantom{0} \\ \rightarrow \\ \end{matrix} \begin{bmatrix} \color{red} 1 & 1 \\ 0 & \color{red} 1 \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> </p> <<linkreplace "Continue" t8n>><<run $("#found_pivots").show()>><</linkreplace>> </span> <span id="found_pivots" style="display:none"> <p> Therefore, the pivot columns of \(A\) are: <span class="wrong_columns"> <div> <strong>(a)</strong> Column 1. <<linkreplace "Choose (a)" t8n>><p>Incorrect. The pivot columns are all columns containing a pivot.</p><</linkreplace>> </div> </span> <p> <strong>(b)</strong> Columns 1 and 2. <<linkreplace "Choose (b)" t8n>> Correct! <<run $("#correct_choice").show()>> <<replace ".wrong_columns" t8n>><</replace>> <</linkreplace>> </p> <span class="wrong_columns"> <div> <strong>(c)</strong> Column 2. <<linkreplace "Choose (c)" t8n>><p>Incorrect. The pivot columns are all columns containing a pivot.</p><</linkreplace>> </div> </span> </p> </span> <span id="correct_choice" style="display:none"> <p> The pivot columns of \(A\) are: <nowiki> $$ \begin{equation} \left\{ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \right\} \end{equation} $$ </nowiki> </p> <p> The pivot columns are the basis vectors of the columnspace of \(A\). Or equivalently, the columnspace is the span of the basis vectors. Therefore, we can describe the columnspace of \(A\) as: </p> <div> <strong>(a)</strong> \( \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 1 \end{bmatrix}, \begin{bmatrix} 0 \\ 1 \end{bmatrix}, \begin{bmatrix} 0 \\ 0 \end{bmatrix} \right\} \) <<linkreplace "Choose (a)" t8n>> <p>Incorrect. The basis vectors of the columnspace are the pivot columns.</p> <</linkreplace>> </div> <p> <strong>(b)</strong> \( \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \right\} \) <<linkreplace "Choose (b)" t8n>> Correct! <<run $("#desmos").show()>> <</linkreplace>> </p> <span id="desmos" style="display: none"> <p> The span of the pivot columns is all vectors that can be expressed as a linear combination of the pivot columns, which is the plane shown in blue below. </p> <p> <iframe src="https://www.desmos.com/3d/cnbpgoe2h8" width="100%" style="min-height:700px"></iframe> </p> <p> <center><strong>Figure 1</strong>: The pivot columns of \(A\) (orange vectors) and the columnspace of \( A \) (blue plane).</center> </p> <p> <strong>[[CONTINUE to next part -> part2]]</strong> </p> </span> </span>
<h2>Correct!</h2> <p> The matrix \(A\) is already in row-echelon form. Its pivots are highlighted below <nowiki> $$ \begin{equation} A = \begin{bmatrix} \mathbf{1} & 1 \\ 0 & \mathbf{1} \\ 0 & 0 \end{bmatrix} \end{equation} $$ </nowiki> The columnspace of \(A\) is all vectors that can be expressed as a linear combination of the pivot columns, which is the span of the pivot columns. <nowiki>$$ \begin{equation} \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \right\} \end{equation} $$ </nowiki> The columnspace of \(A\) is the plane shown in blue below. </p> <p> <iframe src="https://www.desmos.com/3d/cnbpgoe2h8" width="100%" style="min-height:700px"></iframe> </p> <p> <center><strong>Figure 1</strong>: The pivot columns of \(A\) (orange vectors) and the columnspace of \( A \) (blue plane).</center> </p> <p> <strong>[[CONTINUE to next part -> part2]]</strong> </p>
<center>(1) -- <strong>(2)</strong> <span style="color:lightgray"> -- (3) -- (4) -- (5) -- (6) -- (end)</span> </center> <h2>Part 2</h2> <p> Consider <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> Recall that the columnspace of \( A\) is <nowiki> $$ \begin{equation} \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \right\} \end{equation} $$ </nowiki> </p> <p><strong>Question:</strong> How could you show that \(\mathbf{b}\) is not in the columnspace of \(A\)?</p> <hr> <div> <strong>(a)</strong> Show that \( \mathbf{b} \) cannot be written as a linear combination of the columns of \( A \). <<linkreplace "Choose (a)" t8n>> <p> That's correct, but to show it in an exam, what method would you use? </p> <<mathjax>> <</linkreplace>> </div> <div> <strong>(b)</strong> Since \( A \) has only two columns, the columnspace of \( A\) is two-dimensional, but \( \mathbf{b} \) has 3 components, so \( \mathbf{b} \) can't be in the columnspace of \( A \). <<linkreplace "Choose (b)" t8n>> <p> Incorrect. Although \( \text{col}(A) \) is two-dimensional, \( \text{col}(A) \) lives in \( \mathbb{R}^3 \) because \( A \) has 3 rows. It is a plane through the origin embedded in 3D space.</p> <<mathjax>> <</linkreplace>> </div> <div> <strong>(c)</strong> Show that row reducing \( [A \mid b ] \) produces an inconsistent row. <<linkreplace "Choose (c)" t8n>> <p> Correct! </p> <p> To show that \(\mathbf{b}\) is not in the columnspace of \(A\), you need to show that the system \( A \mathbf{x} = \mathbf{b} \) has no solution. </p> <p> \(A\) is already in row-echelon form, so the row-reduced augmented matrix is <nowiki> $$ \begin{equation} \left[ \left. \begin{matrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{matrix} \right| \left. \begin{matrix} 2 \\ 3 \\ 4 \end{matrix} \right. \right] \end{equation} $$ </nowiki> The final row gives the equation <nowiki> $$ \begin{equation} 0 x_1 + 0 x_2 = 4 \end{equation} $$ </nowiki> but \( 0 = 4 \) is impossible. Therefore, the system is inconsistent. </p> <p> Fig. 1 shows that indeed the vector \(\mathbf{b}\) (red) is not in the columnspace of \(A\) (blue plane). </p> <p> <iframe src="https://www.desmos.com/3d/j0nyokwdn4" width="100%" style="min-height:700px"></iframe> </p> <p> <center> <strong>Figure 1:</strong> The vector \( \mathbf{b} \) (red) is not in the columnspace of \(A \) (blue plane). </center> </p> <p> Notice also that every vector in \( \text{col} (A) \) has a third component 0, since both basis vectors do, but \(\mathbf{b} \) has a third component 4. So \(\mathbf{b} \) sits above the plane, which is what the row reduction tells us algebraically. </p> <p> <strong>[[CONTINUE to next part -> part3]]</strong> </p> <<mathjax>> <</linkreplace>> </div>
<center>(1) -- (2) -- <strong>(3)</strong> <span style="color:lightgray"> -- (4) -- (5) -- (6) -- (end)</span> </center> <h2>Part 3</h2> <p> Consider <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> Recall that the columnspace of \( A\) is <nowiki> $$ \begin{equation} \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \right\} \end{equation} $$ </nowiki> <strong>Question</strong>: Which vector in the columnspace of \(A\) is closest to \( \mathbf{b} \)? </p> <p> <iframe src="https://www.desmos.com/3d/j0nyokwdn4" width="100%" style="min-height:700px"></iframe> <center><strong>Figure 1:</strong> The pivot columns of \(A\) (orange vectors), the columnspace of \(A \) (blue plane), and the vector \( \mathbf{b} \) (red vector).</center> </p> <hr> <<linkreplace "<p>Reveal hint</p>">> <p><strong>Hint</strong></p> <p> Geometrically, \( \text{col}(A) \) is a plane (Fig. 1). Imagine dropping a perpendicular line from \( \mathbf{b} \) down to that plane. Where does it land? </p> <<mathjax>><</linkreplace>> <hr> <div> <strong>(a)</strong> The column of \( A \) that is closest to \( \mathbf{b} \), which is \( \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \). <<linkreplace "Choose (a)" t8n>> <p> Incorrect. While it's true that \( (1, 1, 0 ) \) is the closest column vector to \( \mathbf{b} \), the columnspace of \( A\) is the entire plane spanned by those columns. There are infinitely many possible vectors on that plane, and one is closer to \( \mathbf{b} \) than any other -- it would be the shadow \( \mathbf{b} \) casts on the plane at high noon. What do we call that vector? Pick the option that names it. </p> <<mathjax>> <</linkreplace>> </div> <p> <strong>(b)</strong> The projection of \( \mathbf{b} \) onto the columnspace of \( A \). [[Choose (b) -> part3_correct]] </p> <div> <strong>(c)</strong> The average of the columns of \( A \) . <<linkreplace "Choose (c)" t8n>> <p> Incorrect. The average is just another vector in \( \text{col}(A)\). There's no reason it'd be the one closest to \( \mathbf{b} \). </p> <<mathjax>> <</linkreplace>> </div> <div> <strong>(d)</strong> \( \mathbf{b} \) itself. <<linkreplace "Choose (d)" t8n>> <p> Incorrect. While it's true that \( \mathbf{b} \) is the vector closest to \( \mathbf{b} \) in all \( \mathbb{R}^3 \), the question restricts us to vectors in the columnspace of \( A\), and we showed in Part 2 that \( \mathbf{b} \) is not in \( \text{col}(A) \). </p> <<mathjax>> <</linkreplace>> </div>
<h2>Correct!</h2> <p> The vector in the columnspace of \(A\) that is <strong>closest</strong> to \( \mathbf{b} \) is the <strong>projection</strong> of \( \mathbf{b} \) onto the columnspace of \( A \). </p> <p><iframe src="https://www.desmos.com/3d/ppa5ospwuy" width="100%" style="min-height:700px"></iframe></p> <p> <center> <strong>Figure 1:</strong> The pivot columns of \(A\) (orange vectors), the columnspace of \(A \) (blue plane), and the vector \( \mathbf{b} \) (red vector). The vector in the columnspace of \(A \) that is closest to \( \mathbf{b} \) is the projection of \( \mathbf{b} \) onto \( \text{col}(A) \) (purple vector). </center> </p> <<linkreplace "<p>Explain more</p>" t8n>> <p> You were given <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> and you found that the columnspace of \( A\) is <nowiki> $$ \text{col}(A) = \text{span} \left\{ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \right\} $$ </nowiki> This columnspace is the blue plane in Fig. 1. </p> <p> The vector in the columnspace (blue plane) that is closest to \( \mathbf{b} \) (red vector) is the projection of \( \mathbf{b} \) onto the columnspace (purple vector). </p> <p> You could think of the projection \( \mathbf{p} \) as the "shadow" that \( \mathbf{b} \) casts at high noon onto the blue plane. In fact, what guarantees that the projection is closest is that the vector \( \mathbf{e} = \mathbf{b} - \mathbf{p} \) (shown in grey in Fig. 2 below) is perpendicular to the columnspace. </p> <p><iframe src="https://www.desmos.com/3d/rjbsdqydcx" width="100%" style="min-height:700px"></iframe></p> <p> <center> <strong>Figure 2:</strong> The projection \( \mathbf{p} \) (purple vector) is closest to \( \mathbf{b} \) (red vector) because \( \mathbf{e} = \mathbf{b} - \mathbf{p} \) (grey vector) is perpendicular to the columnspace (blue plane). </center> </p> <<mathjax>><</linkreplace>> <p> <strong>[[CONTINUE to next part -> part4]]</strong> </p>
<center>(1) -- (2) -- (3) -- <strong>(4)</strong> <span style="color:lightgray"> -- (5) -- (6) -- (end)</span> </center> <h2>Part 4</h2> <p> Consider <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> <strong>Question</strong>: Find the projection of \( \mathbf{b} \) onto the columnspace of \( A \) by solving \( A^T A \hat{\mathbf{x}} = A^T \mathbf{b} \) and \( \mathbf{p} = A\hat{\mathbf{x}} \). </p> <hr> <<linkreplace "Reveal hint" t8n>> <p> Follow these steps to solve: <ol> <li> Find \(A^T A\) (gives a \(2 \times 2\) matrix)</li> <li> Find \(A^T \mathbf{b}\) (gives a \(2 \times 1\) vector)</li> <li> Solve \(A^T A \hat{\mathbf{x}} = A^T \mathbf{b}\) for \(\hat{\mathbf{x}}\): <ol> <li>Because \(A^T A\) is a \(2 \times 2\) matrix, we can use the formula for the inverse: <nowiki> $$ \begin{equation*} \text{For } A^T A = \underbrace{ \begin{bmatrix} a & b \\ c & d \\ \end{bmatrix} }_{\text{(1)}} , \text{ the inverse } (A^T A)^{-1} = \frac{1}{ad - bc} \begin{bmatrix} d & -b \\ -c & a \\ \end{bmatrix} \end{equation*} $$ </nowiki> </li> <li> Find \(\hat{\mathbf{x}}\) directly <nowiki> $$ \begin{equation*} \hat{\mathbf{x}} = \underbrace{(A^T A)^{-1}}_{\text{(3.1)}} \underbrace{A^T \mathbf{b}}_{\text{(2)}} \end{equation*} $$ </nowiki> \( \hat{\mathbf{x}} \) can be thought of as a co-ordinate vector telling us how much of each column vector is required. </li> </ol> </li> <li> Find \( \mathbf{p} \) <nowiki> $$ \begin{equation*} \mathbf{p} = A \underbrace{\hat{\mathbf{x}}}_{\text{(3.2)}} \end{equation*} $$ </nowiki> </li> </ol> </p> <<mathjax>><</linkreplace>> <hr> [[Show me step-by-step -> part4_step_by_step]] <hr> <<linkreplace "<p>I'm ready to answer</p>" t8n>> <p><strong>Answer:</strong> The projection of \( \mathbf{b} \) onto the columnspace of \( A \) is</p> <p> <strong>(a)</strong> \( \mathbf{p} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \) [[Choose (a) -> part4_incorrect]] </p> <p> <strong>(b)</strong> \( \mathbf{p} = \begin{bmatrix} 2 \\ 5 \end{bmatrix} \) [[Choose (b) -> part4_incorrect]] </p> <p> <strong>(c)</strong> \( \mathbf{p} = \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} \) [[Choose (c) -> part4_correct]] </p> <p> <strong>(d)</strong> \( \mathbf{p} = \begin{bmatrix} 5 \\ 3 \\ 0 \end{bmatrix} \) [[Choose (d) -> part4_incorrect]] </p> <p> <strong>(e)</strong> \( \mathbf{p} = \begin{bmatrix} 4 \\ 3 \\ 0 \end{bmatrix} \) [[Choose (e) -> part4_incorrect]] </p> <p> <strong>(f)</strong> \( \mathbf{p} = \begin{bmatrix} -1 \\ 3 \\ 0 \end{bmatrix} \) [[Choose (f) -> part4_incorrect]] </p> <<mathjax>><</linkreplace>>
<center>(1) -- (2) -- (3) -- <strong>(4)</strong> <span style="color:lightgray"> -- (5) -- (6) -- (end)</span> </center> <h2>Incorrect</h2> <p>[[Show me step-by-step -> part4_step_by_step]]</p> <p>[[Redo question -> part4]]</p>
<center>(1) -- (2) -- (3) -- <strong>(4)</strong> <span style="color:lightgray"> -- (5) -- (6) -- (end)</span> </center> <h2>Part 4: Guided solution</h2> <p> Consider <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> <strong>Question</strong>: Find the projection of \( \mathbf{b} \) onto the columnspace of \( A \) by solving \( A^T A \hat{\mathbf{x}} = A^T \mathbf{b} \) and \( \mathbf{p} = A\hat{\mathbf{x}} \). </p> <hr> <p> <strong>Step 1.</strong> Find \(A^T A\):</p> <div style="margin-left: 20px"> <p> <strong>(a)</strong> \( A^T A = \begin{bmatrix} 1 & 2 \\ 1 & 1 \end{bmatrix} \) <span id="find_ATA_wrong"> <<linkreplace "Choose (a)" t8n>> <p> Incorrect. This answer suggests you didn't take the transpose of \( A\) correctly. The rule is \(a_{ij} \rightarrow a_{ji} \). You can also remember: first row (read left-to-right) \( \rightarrow \) first column (read top-to-bottom), second row \( \rightarrow \) second column, and so on. <<run $("#show_ATA").show()>> <<replace "#find_ATA_right">><</replace>> </p> <<mathjax>> <</linkreplace>> </span> </p> <span id="find_ATA_right"> <p> <strong>(b)</strong> \( A^T A = \begin{bmatrix} 1 & 1 \\ 1 & 2 \end{bmatrix} \) <<linkreplace "Choose (b)" t8n>> Correct! <<run $("#show_ATA").show()>> <<replace "#find_ATA_wrong">><</replace>> <</linkreplace>> </p> </span> <span id="show_ATA" style="display:none"> <p> The answer is: <nowiki> $$ \begin{align*} A^T A &= \begin{bmatrix} 1 & 0 & 0 \\ 1 & 1 & 0 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & 2 \end{bmatrix} \end{align*} $$ </nowiki> </p> <<linkreplace "<p>Continue</p>" t8n>><<run $("#step2").show()>><</linkreplace>> </span> </div> <span id="step2" style="display: none"> <p> <strong>Step 2.</strong> Find \(A^T \mathbf{b}\):</p> <div style="margin-left: 20px"> <span id="find_ATb_right"> <p> <strong>(a)</strong> \( A^T \mathbf{b} = \begin{bmatrix} 2 \\ 5 \end{bmatrix} \) <<linkreplace "Choose (a)" t8n>> Correct! <<run $("#show_ATb").show()>> <<replace "#find_ATb_wrong">><</replace>> <</linkreplace>> </p> </span> <p> <strong>(b)</strong> \( A^T \mathbf{b} = \begin{bmatrix} 5 \\ 2 \end{bmatrix} \) <span id="find_ATb_wrong"> <<linkreplace "Choose (b)" t8n>> <p> Incorrect. Check the ordering: row 1 of \( A^T \) is \( (1, 0, 0) \) not \( (1, 1, 0) \). <<run $("#show_ATb").show()>> <<replace "#find_ATb_right">><</replace>> </p> <<mathjax>> <</linkreplace>> </span> </p> <span id="show_ATb" style="display:none"> <p> The answer is: <nowiki> $$ \begin{align*} A^T \mathbf{b} &= \begin{bmatrix} 1 & 0 & 0 \\ 1 & 1 & 0 \end{bmatrix} \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} = \begin{bmatrix} 2 \\ 5 \end{bmatrix} \end{align*} $$ </nowiki> </p> <<linkreplace "<p>Continue</p>" t8n>><<run $("#step3").show()>><</linkreplace>> </span> </div> </span> <span id="step3" style="display: none"> <p><strong>Step 3.</strong> Solve \(A^T A \hat{\mathbf{x}} = A^T \mathbf{b}\) for \(\hat{\mathbf{x}}\).</p> <div style="margin-left: 20px"> <<linkreplace "<p>Reveal hint</p>" t8n>> <p> <strong>Hint</strong>: You'll need to solve \( \hat{\mathbf{x}} = (A^T A)^{-1}(A^T \mathbf{b}) \). </p> <p> You already have \( A^T \mathbf{b} \) above. You can also find \( (A^T A)^{-1} \) from \( A^T A \) above. </p> <<linkreplace "<p>How do I find the inverse?</p>" t8n>> <p> The equation for the inverse of a \( 2 \times 2 \) matrix \( M = \begin{bmatrix} a & b \\ c & d \end{bmatrix} \) is <nowiki> $$ \begin{equation} M^{-1} = \frac{1}{ad - bc} \begin{bmatrix} d & -b \\ -c & a \\ \end{bmatrix} \end{equation} $$ </nowiki> </p> <<mathjax>><</linkreplace>> <<mathjax>><</linkreplace>> <span id="find_x_right"> <p> <strong>(a)</strong> \( \hat{\mathbf{x}} = \begin{bmatrix} -1 \\ 3 \end{bmatrix} \) <<linkreplace "Choose (a)" t8n>> Correct! <<run $("#show_x").show()>> <<replace "#find_x_wrong">><</replace>> <</linkreplace>> </p> </span> <p> <strong>(b)</strong> \( \hat{\mathbf{x}} = \begin{bmatrix} 1 \\ 3 \end{bmatrix} \) <span id="find_x_wrong"> <<linkreplace "Choose (b)" t8n>> <p> Incorrect. Check the signs: the inverse formula flips the signs of the off-diagonal entries. <<run $("#show_x").show()>> <<replace "#find_x_right">><</replace>> </p> <<mathjax>> <</linkreplace>> </span> </p> <span id="show_x" style="display:none"> <p> The answer is <nowiki> $$ \begin{equation*} (A^T A)^{-1} = \frac{1}{1 \times 2 - 1^2} \begin{bmatrix} 2 & -1 \\ -1 & 1 \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ -1 & 1 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <p> <nowiki> $$ \begin{equation*} \hat{\mathbf{x}} = (A^T A)^{-1}(A^T \mathbf{b}) = \begin{bmatrix} 2 & -1 \\ -1 & 1 \end{bmatrix} \begin{bmatrix} 2 \\ 5 \end{bmatrix} = \begin{bmatrix} -1 \\ 3 \end{bmatrix} \end{equation*} $$ </nowiki> \( \hat{\mathbf{x}} \) can be thought of as a co-ordinate vector telling us how much of each column vector is required. </p> <<linkreplace "<p>Continue</p>" t8n>><<run $("#step4").show()>><</linkreplace>> </span> </div> </span> <span id="step4" style="display: none"> <p><strong>Step 4.</strong> Find \( \mathbf{p} = A \hat{\mathbf{x}} \)</p> <div style="margin-left: 20px"> <span id="find_p_right"> <p> <strong>(a)</strong> \( \mathbf{p} = \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} \) <<linkreplace "Choose (a)" t8n>> Correct! <<run $("#show_p").show()>> <<replace "#find_p_wrong">><</replace>> <</linkreplace>> </p> </span> <p> <strong>(b)</strong> \( \mathbf{p} = \begin{bmatrix} -4 \\ 3 \\ 0 \end{bmatrix} \) <span id="find_p_wrong"> <<linkreplace "Choose (b)" t8n>> <p> Incorrect. You've made an arithmetic error. <<run $("#show_p").show()>> <<replace "#find_p_right">><</replace>> </p> <<mathjax>> <</linkreplace>> </span> </p> <span id="show_p" style="display:none"> <p> The answer is <nowiki> $$ \begin{equation*} \mathbf{p} = A\hat{\mathbf{x}} = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \begin{bmatrix} -1 \\ 3 \end{bmatrix} = \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <<linkreplace "<p>Continue</p>" t8n>> <<run $("#return_to_part4").hide()>> <<run $("#step5").show()>> <</linkreplace>> </span> </div> </span> <span id="step5" style="display: none"> <p> \( \mathbf{p} \) is the vector in the columnspace of \( A \) that is closest to \( \mathbf{b} \). </p> <p> \( \hat{\mathbf{x}} \) tells us how much of each column of \( A \) is required to form \( \mathbf{p} \), i.e., <nowiki> $$ \begin{equation*} \mathbf{p} = A\hat{\mathbf{x}} = -1 \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} + 3 \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <p> <iframe src="https://www.desmos.com/3d/trtzpurb1l" width="100%" style="min-height:700px"></iframe></p> <p> <center> <strong>Figure 1:</strong> The projection \( \mathbf{p} \) is the linear combination of columns of \(A \) (orange vectors) given by \( \hat{\mathbf{x}} \). Specifically, \( \mathbf{p} = -1 \times \text{col 1} + 3 \times \text{col 2} \) (blue vectors). </center> </p> <p> <strong>[[CONTINUE to next part -> part5]]</strong> </p> </span> <span id="return_to_part4"> <p> [[Return to redo question by myself -> part4]] </p> </span>
<h2>Correct!</h2> <p> <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> The projection of \( \mathbf{b} \) onto the columnspace of \( A \) is <nowiki> $$ \begin{equation*} \mathbf{p} = \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> \( \mathbf{p} \) is the vector in the columnspace of \( A \) that is closest to \( \mathbf{b} \). </p> <<linkreplace "<p>Reveal to discover more</p>" t8n>> <p> In the process of finding the solution, you would have also found <nowiki> $$ \begin{equation*} \hat{\mathbf{x}} = \begin{bmatrix} -1 \\ 3 \end{bmatrix} \end{equation*} $$ </nowiki> and also solved <nowiki> $$ \begin{equation*} \mathbf{p} = A\hat{\mathbf{x}} = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \begin{bmatrix} -1 \\ 3 \end{bmatrix} = \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <p> So \( \hat{\mathbf{x}} \) tells us how much of each column of \( A \) is required to form \( \mathbf{p} \), i.e., <nowiki> $$ \begin{equation*} \mathbf{p} = A\hat{\mathbf{x}} = -1 \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} + 3 \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <p> <iframe src="https://www.desmos.com/3d/trtzpurb1l" width="100%" style="min-height:700px"></iframe></p> <p> <center> <strong>Figure 1:</strong> The projection \( \mathbf{p} \) is the linear combination of columns of \(A \) (orange vectors) given by \( \hat{\mathbf{x}} \). Specifically, \( \mathbf{p} = -1 \times \text{col 1} + 3 \times \text{col 2} \) (blue vectors). </center> </p> <<mathjax>> <</linkreplace>> <p> [[Show full solution -> part4_full_solution]]</p> <p> <strong>[[CONTINUE to next part -> part5]]</strong> </p>
<center>(1) -- (2) -- (3) -- <strong>(4)</strong> <span style="color:lightgray"> -- (5) -- (6) -- (end)</span> </center> <h2>Part 4: Full solution</h2> <p> Consider <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> <strong>Question</strong>: Find the projection of \( \mathbf{b} \) onto the columnspace of \( A \) by solving \( A^T A \hat{\mathbf{x}} = A^T \mathbf{b} \) and \( \mathbf{p} = A\hat{\mathbf{x}} \). </p> <hr> <p> <strong>Step 1.</strong> Find \(A^T A\):</p> <p> <nowiki> $$ \begin{align*} A^T A &= \begin{bmatrix} 1 & 0 & 0 \\ 1 & 1 & 0 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & 2 \end{bmatrix} \end{align*} $$ </nowiki> </p> <p> <strong>Step 2.</strong> Find \(A^T \mathbf{b}\):</p> <p> <nowiki> $$ \begin{align*} A^T \mathbf{b} &= \begin{bmatrix} 1 & 0 & 0 \\ 1 & 1 & 0 \end{bmatrix} \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} = \begin{bmatrix} 2 \\ 5 \end{bmatrix} \end{align*} $$ </nowiki> </p> <p><strong>Step 3.</strong> Solve \(A^T A \hat{\mathbf{x}} = A^T \mathbf{b}\) for \(\hat{\mathbf{x}}\).</p> <p> <nowiki> $$ \begin{equation*} (A^T A)^{-1} = \frac{1}{1 \times 2 - 1^2} \begin{bmatrix} 2 & -1 \\ -1 & 1 \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ -1 & 1 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <p> <nowiki> $$ \begin{equation*} \hat{\mathbf{x}} = (A^T A)^{-1}(A^T \mathbf{b}) = \begin{bmatrix} 2 & -1 \\ -1 & 1 \end{bmatrix} \begin{bmatrix} 2 \\ 5 \end{bmatrix} = \begin{bmatrix} -1 \\ 3 \end{bmatrix} \end{equation*} $$ </nowiki> \( \hat{\mathbf{x}} \) can be thought of as a co-ordinate vector telling us how much of each column vector is required. </p> <p><strong>Step 4.</strong> Find \( \mathbf{p} = A \hat{\mathbf{x}} \)</p> <p> <nowiki> $$ \begin{equation*} \mathbf{p} = A\hat{\mathbf{x}} = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \begin{bmatrix} -1 \\ 3 \end{bmatrix} = \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <p> \( \mathbf{p} \) is the vector in the columnspace of \( A \) that is closest to \( \mathbf{b} \). </p> <p> \( \hat{\mathbf{x}} \) tells us how much of each column of \( A \) is required to form \( \mathbf{p} \), i.e., <nowiki> $$ \begin{equation*} \mathbf{p} = A\hat{\mathbf{x}} = -1 \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} + 3 \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <p> <iframe src="https://www.desmos.com/3d/trtzpurb1l" width="100%" style="min-height:700px"></iframe></p> <p> <center> <strong>Figure 1:</strong> The projection \( \mathbf{p} \) is the linear combination of columns of \(A \) (orange vectors) given by \( \hat{\mathbf{x}} \). Specifically, \( \mathbf{p} = -1 \times \text{col 1} + 3 \times \text{col 2} \) (blue vectors). </center> </p> <p> <strong>[[CONTINUE to next part -> part5]]</strong> </p>
<center>(1) -- (2) -- (3) -- (4) -- <strong>(5)</strong> <span style="color:lightgray"> -- (6) -- (end)</span> </center> <h2>Part 5</h2> Consider <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> Recall that the projection of \( \mathbf{b} \) onto the columnspace of \( A \) is <nowiki> $$ \begin{equation*} \mathbf{p} = \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> <p> <strong>Question</strong>: Find \( \mathbf{e} = \mathbf{b} - \mathbf{p}\) and show it is perpendicular to the columns of \( A\). </p> <hr> <strong>Hint:</strong> <<linkreplace "How do I show perpendicularity?" t8n>> <p> To show two vectors are orthogonal, show that their dot product equals zero. </p> <<mathjax>><</linkreplace>> <hr> <strong>Answer:</strong> <<linkreplace "Reveal." t8n>> <p> <nowiki> $$ \begin{equation*} \mathbf{e} = \mathbf{b} - \mathbf{p} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} - \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 4 \end{bmatrix} \end{equation*} $$ </nowiki> </p> <p> To verify perpendicularity, we check the dot products of \( \mathbf{e} \) with each column of \( A \) are equal to zero: <ul> <li> \(\mathbf{e} \cdot \mathbf{a}_1 = (0, 0, 4) \cdot (1, 0, 0) = 0 \times 1 + 0 \times 0 + 4 \times 0 = 0\) </li> <li> \(\mathbf{e} \cdot \mathbf{a}_2 = (0, 0, 4) \cdot (1, 1, 0) = 0 \times 1 + 0 \times 1 + 4 \times 0 = 0\) </li> </ul> as required. </p> <p> Since the columns of \( A \) span \( \text{col}(A) \), showing that \( \mathbf{e} \) is perpendicular to both columns means \( \mathbf{e} \) is perpendicular to every vector in \( \text{col}(A) \), i.e., to the whole columnspace. </p> <p> The fact that \( \mathbf{e} \) is perpendicular to the columnspace of \( A \) is what guarantees that \( \mathbf{p} \) is the closest vector to \( \mathbf{b} \). </p> <p><iframe src="https://www.desmos.com/3d/rjbsdqydcx" width="100%" style="min-height:700px"></iframe></p> <p> <center> <strong>Figure 1:</strong> The projection \( \mathbf{p} \) (purple vector) is closest to \( \mathbf{b} \) (red vector) because \( \mathbf{e} = \mathbf{b} - \mathbf{p} \) (grey vector) is perpendicular to the columnspace (blue plane). </center> </p> <p> <strong>[[CONTINUE to next part -> part6]]</strong> </p> <<mathjax>><</linkreplace>>
<center>(1) -- (2) -- (3) -- (4) -- (5) -- <strong>(6)</strong> <span style="color:lightgray"> -- (end)</span> </center> <h2>Part 6</h2> We were given <nowiki> $$ \begin{equation} A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \\ 0 & 0 \end{bmatrix} \quad \text{and} \quad \mathbf{b} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} \end{equation} $$ </nowiki> We found that the projection of \( \mathbf{b} \) onto the columnspace of \( A \) was <nowiki> $$ \begin{equation*} \mathbf{p} = \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} \end{equation*} $$ </nowiki> and <nowiki> $$ \begin{equation*} \mathbf{e} = \mathbf{b} - \mathbf{p} = \begin{bmatrix} 2 \\ 3 \\ 4 \end{bmatrix} - \begin{bmatrix} 2 \\ 3 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 4 \end{bmatrix} \end{equation*} $$ </nowiki> <p> <strong>Question</strong>: Draw a diagram showing \( \mathbf{b} \), \( \mathbf{p} \), and \( \mathbf{e} \) including any important relationships between them. </p> <hr> <strong>Hint:</strong> <<linkreplace "Reveal" t8n>> <p> What geometric relationship did you prove in Part 5? </p> <<mathjax>><</linkreplace>> <hr> <strong>Answer</strong>: <div> <strong>(a)</strong> <img src="assets/Week8_A1_Q4_no_orth.png" style="width: 300px;"> <<linkreplace "Choose" t8n>> <p> Incorrect. You will lose marks if you don't show clearly that \( \mathbf{p} \) and \( \mathbf{e} \) are orthogonal, e.g., with a right-angle symbol. </p> <<mathjax>> <</linkreplace>> </div> <div> <strong>(b)</strong> <img src="assets/Week8_A1_Q4_orth.png" style="width: 300px;"> <<linkreplace "Choose" t8n>> <p> Correct; this diagram shows that \( \mathbf{p} \) and \( \mathbf{e} \) are orthogonal. </p> <p> <strong>[[CONTINUE to next part -> end]]</strong> </p> <<mathjax>> <</linkreplace>> </div>
/* <center>(1) -- (2) -- (3) -- (4) -- (5) -- (6) -- <strong>(end)</strong> </center> */ <h1>Congratulations!</h1> <div style="text-align: center;"> <img src="assets/purrpendicular.jpg" style="width: 300px;"> <p> You have completed the questions. </p> <p> <strong>[[Play again -> Start]] </strong></p> <hr> <p><a href="mailto:nadiah@nadiah.org">Send feedback to: nadiah@nadiah.org</a></p> </div>
<<widget "mathjax">> <<run requestAnimationFrame(function() { MathJax.typesetPromise([document.querySelector('.passage')]); })>> <</widget>>