{%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %} # Matrix is a price table You are a traveler from city $V$ to city $W$. - City $V$ produces cow :cow: , pig :pig: , chicken :chicken: , and fish :fish: . - City $W$ produces apple :apple: , banana :banana: , and corn :corn: . In the midway, you see a price table as follows. | :cow: | :pig: | :chicken: | :fish: | :arrow_left: pay / get :arrow_down: | | ----- | ----- | --------- | ------ | -----------------------------------:| | 3 | 3 | 2 | 1 | :apple: | | 3 | 2 | 2 | 2 | :banana: | | 3 | 1 | 1 | 3 | :corn: | This means we have the exchange rate below. :cow: $\mapsto$ 3 :apple: + 3 :banana: + 3 :corn: :pig: $\mapsto$ 3 :apple: + 2 :banana: + 1 :corn: :chicken: $\mapsto$ 2 :apple: + 2 :banana: + 1 :corn: :fish: $\mapsto$ 1 :apple: + 2 :banana: + 3 :corn: ## Forward problem: What did you get? Suppose you want to exchange your products 1 :cow: + 2 :pig: + 3 :chicken: + 4 :fish: in $V$ into products in $W$. What would you get? This can be done by simple arithmetic. 1:cow: $\mapsto$ 3 :apple: + 3 :banana: + 3 :corn: 2:pig: $\mapsto$ 6 :apple: + 4 :banana: + 2 :corn: 3:chicken: $\mapsto$ 6 :apple: + 6 :banana: + 3 :corn: 4:fish: $\mapsto$ 4 :apple: + 8 :banana: + 12 :corn: So overall, we get 1 :cow: + 2 :pig: + 3 :chicken: + 4 :fish: $\mapsto$ 19 :apple: + 21 :banana: + 20 :corn: Essentially, this calculation can be represented by the matrix-vector multiplication $$ \begin{bmatrix} 3 & 3 & 2 & 1 \\ 3 & 2 & 2 & 2 \\ 3 & 1 & 1 & 3 \end{bmatrix} \begin{bmatrix} 1 \\ 2 \\ 3 \\ 4 \end{bmatrix} = \begin{bmatrix} 19 \\ 21 \\ 20 \end{bmatrix}. $$ ## Inverse problem: What is the price table? Suppose you forgot the price table you saw in the midway. How can you recover it by asking a local vender? Well, it is fairly easy. All you need to know is the "price" for each of your product. If the vendor tells you your :cow: worths 3 :apple: + 3 :banana: + 3 :corn: , then you simply write 3 3 3 in the first column of your price table. Then by just asking four questions, it is easy to find out :cow: $\mapsto$ 3 :apple: + 3 :banana: + 3 :corn: :pig: $\mapsto$ 3 :apple: + 2 :banana: + 1 :corn: :chicken: $\mapsto$ 2 :apple: + 2 :banana: + 1 :corn: :fish: $\mapsto$ 1 :apple: + 2 :banana: + 3 :corn: and recover the four columns of the price table. In terms of a matrix, if a linear function sends $\bx_1$ $\mapsto$ 3 $\by_1$ + 3 $\by_2$ + 3 $\by_3$ $\bx_2$ $\mapsto$ 3 $\by_1$ + 2 $\by_2$ + 1 $\by_3$ $\bx_3$ $\mapsto$ 2 $\by_1$ + 2 $\by_2$ + 1 $\by_3$ $\bx_4$ $\mapsto$ 1 $\by_1$ + 2 $\by_2$ + 3 $\by_3$ Then we know the function follows the rule $$ c_1\bx_1 + c_2\bx_2 + c_3\bx_3 + c_4\bx_4 \mapsto d_1\by_1 + d_2\by_2 + d_3\by_3, $$ where $$ \begin{bmatrix} 3 & 3 & 2 & 1 \\ 3 & 2 & 2 & 2 \\ 3 & 1 & 1 & 3 \end{bmatrix} \begin{bmatrix} c_1 \\ c_2 \\ c_3 \\ c_4 \end{bmatrix} = \begin{bmatrix} d_1 \\ d_2 \\ d_3 \end{bmatrix}. $$ *This note can be found at Course website > Learning resources.*