# Systems of linear equations

## Prerequisites

### Systems of linear equations

#### Introduction

• A system of linear equations is of the form:
• Each row is an individual equation.
• Variables x1 to xn are shared amongst the equations.
• The size of this system is denoted m x n.

#### Example

• Two cars are in a race
• The first car is slow:
• It can travel at 10 meters per second
• But it has a 1 minute head start
• The second car is fast:
• It can travel at 25 meters per second
• But it has no head start
• The cars are not accelerating
• Their distance as an equation of time forms a straight line
• and is therefore a linear equation
• We can represent them as a system of linear equations:
• t is time in seconds
• d is the distance travelled
• By solving these equations we can find the point where the fast car overtakes the slow one
• The cars meet when the distance each has travelled is equal The cars meet after 40 seconds
• We can solve for d by putting 40 into one of the original equations: The cars meet at 1000 meters
• Finally, we can re-arrange these equations to make them look more like the generic one found in the introduction:

#### Code (Python)

``````import numpy as np

A = np.array([[1, -10], [1, -25]])
B = np.array([600, 0])
solution = np.linalg.solve(A, B)

print(solution) # prints [1000, 40]``````

#### Dependent vs Independent equations

• Equations are independent when each of them gives us new information about a system.
• For example: is dependent because one is simply a multiple of another, and tells us nothing new.

#### Consistent vs Inconsistent systems

• A solution for a linear equation is a set of values which make the equation true.
• For example:
• One solution would be:
• But it can also be solved with:
• Similarly, a solution for a system of linear equations is a set of values which make all the equations true:
• For example:
• One solution is:
• However, any set of values of the form: is also a solution.
• Some systems will only have a single solution.
• Such as the one in the example.
• Some systems will not have any solutions:
• For example:
• There are no values we can give for x and y that makes all 3 equations true.
• The set of all solutions for a system of equations is called the solution set.
• If the set is empty, then the system is inconsistent.
• If the set has at least one solution, then the system is consistent.