Welcome to the third instalment of the optimisation series. If you want to play catch up, here are the first and second instalments. After studying matrices at university, I realised that I didn’t understand them. A lot of increased myelination (allowing for the rapid transmission of neural information along neural fibres; increasing one’s ability to learn) occurred as I was studying Sound Design at Queensland University of Technology (QUT). This meant that I felt more engaged through learning by doing. I decided to use both styles of education; theoretical and practical.
Simultaneous Equations
We have seen simultaneous equations in high school before.
x + y = 7 (1)
x – y = 3 (2)
We know that there’s 3 methods that can assist us in solving this problem:
- Elimination (addition/subtraction) method:
Using this method for these equations, the idea is that I want to remove one of the variables (x or y) by either adding them together or subtracting them from one another to create 0.
x + y = 7
x – y = 3
For this, I will arbitrarily choose to add the equations together, eliminating the y variable. This means I must add all of the variables (xs, ys, and constants) together.
x + y = 7
x – y = 3
2x + 0 = 10
Now I can solve for x:
2x = 10
x = 10/2
x = 5
Since I know that x = 5, I can substitute this back into one of the equations from the original problem to determine the value of y. I will arbitrarily choose equation 1.
x + y = 7
5 + y = 7
y = 7 – 5
y = 2
- Graphing method:
This method requires me to create a graph for the same equations. I will start with equation 1 and map two points:
- What is y when x = 0?
- What is x when x = y?
This means that the values we calculated in the elimination method are equal to the crossover points on this graph.
- Substitution method:
My personal favourite, is where you choose one equation to isolate a variable on one side then substitute it into the other equation. I will arbitrarily choose to isolate the y variable in equation 1 and substitute it into equation 2.
x + y = 7 (1)
x – y = 3 (2)
x + y = 7
y = 7 – x
Substitute y = 7 – x into (2):
x – y = 3
x – (7 – x) = 3
x – 7 + x = 3
2x – 7 = 3
2x = 10
x = 10/2
x = 5
Substitute x = 5 into either equations, equation 1 in this case, to determine the value of y:
x + y = 7
5 + y = 7
y = 7-5
y = 2
With that introduction to simultaneous equations, we can start to look at matrices. I think of them as an n number of simultaneous equations that can be solved.
Matrices
A matrix is a set of numbers arranged in rows and columns so as to form a rectangular array. The numbers are called the elements, or entries, of the matrix. In the past, I’ve mainly used matrices from an economics, application perspective.
If we view the two previous simultaneous equations in matrix form, it will look like this:
x + y = 7 (1)
x – y = 3 (2)
To solve this problem in matrix form, first we start by multiplying both sides of the equation by the inverse matrix of:
For a 2×2 matrix, [a c, b d], the inverse is:
This means that we can rewrite the matrix to:
Simplifying the inverse matrix gives us:
Next we multiply the matrices:
Simplifying these equations:

So, this means x =5 and y = 2.
Since we’ve seen how we can translate simultaneous equations into matrix form, let’s have a go at a real-world problem. This is an optimisation problem, but disguised as a solution for the variables ‘children’ and ‘adults’.
Real World Example
A group took a trip on a bus, at $3 per child and $3.20 per adult for a total of $118.40. They took the train back at $3.50 per child and $3.60 per adult for a total of $135.20. How many children, and how many adults?
As a simultaneous equation, we would set up this problem as:
$3x1 + $3.2x2 = $118.40 (1)
$3.5x1 + $3.6x2 = $135.20 (2)
In matrix form, we would have:

So, we can view this equation to be:
XA = B
First, let’s take the inverse of A:
Let’s solve X by using the inverse of A:
Since we’ve arranged the X matrix to be x1 as children and x2 as adults, this means that, on this trip, there were:
16 children, and
22 adults.
Homework Problem
See if you can solve the following problem using matrix form. If it helps, attempt to arrange it as two simultaneous equations first. Answer will be in next week’s blog:
Adalia and James shopped at the same store. Adalia bought 5 kg of apples and 2 kg of bananas and paid altogether $22. James bought 4 kg of apples and 6 kg of bananas and paid altogether $33. What is the cost of 1 kg of bananas?


2 responses to “20 – Optimisation 3: Using Matrices to Find the Perfect Numbers”
[…] how we estimate models to best predict future events, and consider numerous formulae to solve for the optimised point. What we will be going through today and next week are concrete examples/templates that we can set […]
[…] = π2 = 18 – 2Q1 – 6Q2 = 0Like last week’s post, we can view this in matrix […]