---
title: "NUS-MATH530 Solving Systems"
source: https://www.jemoka.com/posts/kbhnus_math530_solving_systems/
---

Two Variables Let&rsquo;s begin with the equations:
\begin{equation} \begin{cases} 2x+y = 3 \\ x - y = 0 \end{cases} \end{equation}
We will first change this into a matrix equation:
\begin{equation} \begin{pmatrix} 2 &amp; 1 \\ 1 &amp; -1 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 3 \\ 0 \end{pmatrix} \end{equation}
We need to find, then, the inverse of:
\begin{equation} \begin{pmatrix} 2 &amp; 1 \\ 1 &amp; -1 \end{pmatrix} \end{equation}
Namely, we need the matrix such that:
\begin{equation} M \begin{pmatrix} 2 &amp; 1 \\ 1 &amp; -1 \end{pmatrix} = I \end{equation}
To do this, we can use row operations on both sides such that the left side becomes the identity, we are essentially inverting the process of reversing a matrix.
\begin{equation} \begin{pmatrix} 2 &amp; 1 \\ 1 &amp; -1 \end{pmatrix} = \begin{pmatrix} 1 &amp; 0 \\ 0 &amp; 1 \end{pmatrix} \end{equation}
Let&rsquo;s begin:
\begin{align} &amp; \begin{pmatrix} 2 &amp; 1 \\ 1 &amp; -1 \end{pmatrix} = \begin{pmatrix} 1 &amp; 0 \\ 0 &amp; 1 \end{pmatrix} \\ \Rightarrow\ &amp; \begin{pmatrix} 0 &amp; 3 \\ 1 &amp; -1 \end{pmatrix} = \begin{pmatrix} 1 &amp; -2 \\ 0 &amp; 1 \end{pmatrix} \\ \Rightarrow\ &amp; \begin{pmatrix} 0 &amp; 1 \\ 1 &amp; -1 \end{pmatrix} = \begin{pmatrix} \frac{1}{3} &amp; -\frac{2}{3} \\ 0 &amp; 1 \end{pmatrix} \\ \Rightarrow\ &amp; \begin{pmatrix} 0 &amp; 1 \\ 1 &amp; 0 \end{pmatrix} = \begin{pmatrix} \frac{1}{3} &amp; -\frac{2}{3} \\ \frac{1}{3} &amp; \frac{1}{3} \end{pmatrix} \\ \Rightarrow\ &amp; \begin{pmatrix} 1 &amp; 0 \\ 0 &amp; 1 \end{pmatrix} = \begin{pmatrix} \frac{1}{3} &amp; \frac{1}{3} \\ \frac{1}{3} &amp; -\frac{2}{3} \end{pmatrix} \end{align}
Finally, then, we will applying this matrix to the input:
\begin{align} \begin{pmatrix} \frac{1}{3} &amp; \frac{1}{3} \\ \frac{1}{3} &amp; -\frac{2}{3} \end{pmatrix} \begin{pmatrix} 3 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 1 \end{pmatrix} \end{align}
Three Variables We do this again, but now with a much larger matrix. Namely:
\begin{equation} \begin{pmatrix} 1 &amp; 2 &amp; 1 \\ 2 &amp; 0 &amp; -1 \\ 1 &amp; -1 &amp; 0 \end{pmatrix} \end{equation}
I spend a good two hours (yes) trying to invert this. At this point, I know its invertable but I keep making mistakes. However, a solution exists and it is of shape:
\begin{equation} \begin{pmatrix} \frac{1}{5} &amp; \frac{1}{5} &amp; \frac{2}{5} \\ \frac{1}{5} &amp; \frac{1}{5} &amp; -\frac{3}{5} \\ \frac{2}{5} &amp; -\frac{3}{5} &amp; \frac{4}{5} \end{pmatrix} \end{equation}
And, applying the output, we have that:
\begin{equation} \begin{pmatrix} 1 \\ -1 \\ 1 \end{pmatrix} \end{equation}
So complicated of an inverse, for such a simple result&hellip;
Matrix Multiplication Matrix multiplication is not commutative. While you can, for instance, multiply a \(2\times 3\) by a \(3\times 3\), we cannot do it the other way.
For an equation with three variables, you need three equations at a minimum to have at least one solution; you can get at most the number of equations number of solutions with fewer equations. You probably will have no solutions if you have more equations&mdash;the result is likely to be overdetermined; of course, two equations may be the same relation then in which case one is effectively nulled.
