mml-book / mml-book.github.io

Companion webpage to the book "Mathematics For Machine Learning"
13.11k stars 2.42k forks source link

Example 2.24 (Basis Change) #776

Open nagarajankarthik opened 5 months ago

nagarajankarthik commented 5 months ago

Describe the mistake Based on the explanatory text at the top of page 56, the matrix $S$ maps coordinates with respect to the basis $\tilde{B}$ onto the basis $B$. Similarly, the matrix $T$ maps coordinates with respect to the basis $\tilde{C}$ onto the basis $C$. Under this convention, the equation $\tilde{A{\Phi}} = T^{-1}A{\Phi}S$ holds. In example 2.24, the matrices $S$ and $T$ appear to represent transformations from $B$ to $\tilde{B}$ and $C$ to $\tilde{C}$ respectively. Hence, the final result for $\tilde{A_{\Phi}}$ appears to be erroneous.

Location

  1. version (bottom of page): Draft (2023-12-19)
  2. Chapter: 2
  3. page: 57
  4. line number/equation number: Equation 2.120

Proposed solution Based on the given example,

$$ \begin{bmatrix} 1 & 0 & 0 \ 0 & 1 & 0 \ 0 & 0 & 1 \end{bmatrix} = \mathbf{S} \begin{bmatrix} 1 & 0 & 1 \ 1 & 1 & 0 \ 0 & 1 & 1 \end{bmatrix} $$

and

$$ \begin{bmatrix} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 1 \end{bmatrix} = \mathbf{T} \begin{bmatrix} 1 & 1 & 0 & 1 \ 1 & 0 & 1 & 0 \ 0 & 1 & 1 & 0 \ 0 & 0 & 0 & 1 \end{bmatrix} $$

Therefore,

$$ \tilde{A{\Phi}} = T^{-1}A{\Phi}S = \begin{bmatrix} 1 & 1 & 0 & 1 \ 1 & 0 & 1 & 0 \ 0 & 1 & 1 & 0 \ 0 & 0 & 0 & 1 \end{bmatrix} \bullet \begin{bmatrix} 1 & 2 & 0 \ -1 & 1 & 3 \ 3 & 7 & 1 \ -1 & 2 & 4 \end{bmatrix} \bullet \begin{bmatrix} 1/2 & 1/2 & -1/2 \ -1/2 & 1/2 & 1/2 \ 1/2 & -1/2 & 1/2 \ \end{bmatrix} = \begin{bmatrix} 1/2 & -3/2 & 13/2 \ -2 & 6 & 3 \ -1 & 3 & 5 \ 1/2 & -3/2 & 7/2 \end{bmatrix} $$

This result is different from equation (2.121b) on page 58 of the textbook.

Additional context

OSuwaidi commented 1 week ago

Your initial understanding is correct, i.e. "the matrix $S$ maps coordinates from the $\tilde{B}$-basis to the $B$-basis" as per page 56.

However, there seems to be a confusion between mapping coordinates and mapping the basis vectors themselves. What you've done in your matrix multiplication $B = S\tilde{B}$ is attempt to map the basis $\tilde{B}$ itself into the other basis $B$, which is incorrect because that's not what $S$ does. $S$ is not designed to transform the basis vectors directly, rather, $S$ transforms coordinate vectors as such: $\hat{x}_{B} = S \hat{x}_{\tilde{B}}$, where $\hat{x}_{B}$ and $\hat{x}_{\tilde{B}}$ are the coordinate vectors of some vector $\textbf{x}$ with respect to bases $B$ and $\tilde{B}$, respectively.

The above implies: $\tilde{B} = BS$, where the columns of $S$ represent the coordinates of the basis vectors $\tilde{\textbf{b}}_{\textbf{j}}$ with respect to the basis vectors of $B$.

And since $B$ in this case is the identity matrix, $S$ should simply be the matrix $\tilde{B}$ it self.