Computing inverse of a matrix with an example

matricesmatrix equations

A) You go to the shops on Monday and buy 1 apple, 1 banana, and 1 carrot; the whole transaction totals €15. On Tuesday you buy 3 apples, 2 bananas, 1 carrot, all for €28. Then on Wednesday 2 apples, 1 banana, 2 carrots, for €23.

A$
\begin{bmatrix}
a \\
b \\
c \\
\end{bmatrix}
$
= $
\begin{bmatrix}
s_m \\
s_t \\
s_w \\
\end{bmatrix}
$

Where a, b, c, are the prices of apples, bananas, and carrots. And each s is the total for that day (Monday, Tuesday, Wednesday).

B) If every week, you go to the shops and buy the same amount of apples, bananas, and oranges on Monday, Tuesday, and Wednesday; and every week you get a new list of daily totals – then you should solve the system in general.

That is, find the inverse of the matrix you used in A.(Source: Mathematics for Machine Learning: Linear Algebra course by Imperial College London on Coursera).

Though I could manage to solve the equation:a = 3, b = 7, c = 5 by back substitution, here is my attempt to find inverse, which is perhaps faulty somewhere.

a + b + c = 15;
3a + 2b + c = 28;
2a + b + 2c = 23.

$
\begin{bmatrix}
1 & 1 & 1 \\
0 & -1 & -2 \\
0 & 0 & 6 \\
\end{bmatrix}
$
$
\begin{bmatrix}
a \\
b \\
c \\
\end{bmatrix}
$
=$
\begin{bmatrix}
15 \\
17 \\
-30 \\
\end{bmatrix}
$

$AA^{-1}$ = $
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{bmatrix}
$

$
\begin{bmatrix}
1 & 1 & 1 \\
0 & -1 & -2 \\
0 & 0 & 6 \\
\end{bmatrix}
$
$
\begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33} \\
\end{bmatrix}
$
= $\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{bmatrix}$

$6a_{33}$ = 1 or $a_{33}$ = 1/6

0$(a_{12})$ + (-1)$(a_{22})$ + (-2)$(a_{32})$ = 1

$(a_{22})$$(a_{32})$ = 1

As told in the answer to this thread, I am now proceeding with original A (still not clear why the echelon form of A above did not work).

$
\begin{bmatrix}
1 & 1 & 1 \\
3 & 2 & 1 \\
2 & 1 & 2 \\
\end{bmatrix}
$
$
\begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33} \\
\end{bmatrix}
$
= $\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{bmatrix}$

$
\begin{bmatrix}
1 & 1 & 1 \\
3 & 2 & 1 \\
0 & -1 & 4 \\
\end{bmatrix}
$
$
\begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33} \\
\end{bmatrix}
$
= $\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 3 \\
\end{bmatrix}$

$
\begin{bmatrix}
1 & 1 & 1 \\
0 & -1 & -2 \\
0 & -1 & 4 \\
\end{bmatrix}
$
$
\begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33} \\
\end{bmatrix}
$
= $\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 3 \\
\end{bmatrix}$

$
\begin{bmatrix}
1 & 1 & 1 \\
0 & -1 & -2 \\
0 & 0 & 6 \\
\end{bmatrix}
$
$
\begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33} \\
\end{bmatrix}
$
= $\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 3 \\
\end{bmatrix}$

$6a_{33}$ = 3

$a_{33}$ = 3/6 = 0.5 (this apparently is correct)

But unable to find the values of other elements in $
\begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}\\
\end{bmatrix}.
$
So seeking help how to proceed to find values of remaining elements in a systematic manner.

Best Answer

They need you to express $\begin{bmatrix}a\\b\\c\end{bmatrix}$ as $\begin{bmatrix}a\\b\\c\end{bmatrix}= B \begin{bmatrix}s_m\\s_t\\s_w\end{bmatrix}$ where the inverse of $A$ is a matrix $B$ s.t. $BA = I = AB$.

Here, $A = \begin{bmatrix}1 && 1 && 1\\3 && 2 && 1\\2 && 1 && 2\end{bmatrix}$ and $B = A^{-1} = \frac{\text{adj}(A)}{\text{det}(A)} = \begin{bmatrix}-1.5 && 0.5 && 0.5\\2 && 0 && -1\\0.5 && -0.5 && 0.5\end{bmatrix}$

Related Question