If you see this, something is wrong
First published on Friday, Aug 28, 2026 and last modified on Tuesday, Sep 1, 2026
Solution of Some Systems
We shall start this course with two nice examples of systems of linear equations.
Travel of a Plane
Assume that a plane travels between two cities, separated by 5000 km.
Assume that the trip one way against the head wind takes 6 hours and 1/4, and the return trip the same day in the direction of the wind takes only 5 hours.
Let's find the ground speed of the plane and the speed of the wind, assuming that both remain constant.
Let x represent the speed of the plane in kilometers per hour and y the speed of the wind in kilometers per hour.
Then the following system models the problem.
The trip one way against the head wind takes six hours and a fourth becomes 6.25 multiplied by, x minus y, equals 5000, that is, x minus y equals 800.
The return trip the same day in the direction of the wine takes 5 hours becomes 5 multiplied by, x plus y, equals 5000, that is, x plus y equals 1000.
Consequently, we have to solve the system of two linear equations in two real variables: x minus y equals 800, x plus y equals 1000.
If we replace the second equation by itself minus the first equation, we obtain 2x equals 1800, that is x equals 900 km/h.
The speed of the plane is thus 900 km/h.
The first equation is then equivalent to 900 minus y equals 800, that is y equals 100 km/h.
The wind speed is equal to 100 km/h.
Let's illustrate it in Python.
Launch Anaconda and Spyder and follow me.
We create a new file and we begin to write.
From numpy import star, to import the library numpy with scientific computation, and from matplotlib.pyplot, the graphical library, import star.
x is equal to the numbers from minus 100 to 2000 by steps of 100.
And y1 is equal to the elements of x from which we subtract 100.
No, it is 800.
It is the straight line of equation x minus y equals 800.
y2 is 1000 minus the elements of x.
It is the straight line of equation x plus y equals 1000.
Then we plot the straight lines, plot (x,y1) in blue with the label x minus y equals 800.
And we plot (x,y2) in red with the label x plus y equals 1000.
And we plot the solution (900,100) with a big point, with a label 'Solution'.
We add a legend and we add a grid.
from numpy import *
from matplotlib.pyplot import *
x=arange(-100,2000,100)
y1=x-800 #x-y=800
y2=1000-x #x+y=1000
plot(x,y1,'b',label='x-y=800')
plot(x,y2,'r',label='x+y=1000')
plot(900,100,'ko',markersize=5,label='Solution')
legend()
grid()We save, we put it in the right directory and we give it a name StraightLines.py.
Then we run and we have the figure with two straight lines and the solution in the intersection of the straight lines.
We save the figure.
with the name StraightLines.png.
Linear System and its Solution
Let's continue with the polynomial fit problem.
Find the parabola passing through three points.
Polynomial Fit
Find the parabola passing through three points.
We want to determine the polynomial P of x equals a0 plus a1 x plus a2 x to the square, whose graph passes through the points (1,4), (2,0), and (3,12).
Determine the polynomial \( P(x)=a_0+a_1x+a_2x^2\) whose graph passes through the points \( (1,4)\) , \( (2,0)\) and \( (3,12)\) .
Substituting x equals 1, 2, and 3 into P of x and equating the results to the respective y values produces the system of linear equations in the variables a0, a1, and a3 shown below.
P of 1 is equal to a0 plus a1 plus a2, and it is equal to 4.
P of 2 equals a0 plus 2 a1 plus 4 a2, and it is equal to 0.
And P of 3 is equal to a0 plus 3 a1 plus 9 a2, and it is equal to 12.
\( \begin{matrix} P(1)&=&a_0+a_1\times 1+a_2\times 1^2&=&a_0+a_1+a_2&=&4\\ P(2)&=&a_0+a_1\times 2+a_2\times 2^2&=&a_0+2a_1+4a_2&=&0\\ P(3)&=&a_0+a_1\times 3+a_2\times 3^2&=&a_0+3a_1+9a_2&=&12 \end{matrix}\)
Subtracting the first equation to the second and third equations gives a0 plus a1 plus a2 equals 4, a1 plus 3 a2 equals -4, 2 a1 plus 8 a2 equals 8.
\( \begin{matrix} a_0&+&a_1&+&a_2&=&4\\ &&a_1&+&3a_2&=&-4\\ &&2a_1&+&8a_2&=&8 \end{matrix}\)
Then, subtracting two times the second equation to the third equation gives a0 plus a1 plus a2 equals 4, a1 plus 3 a2 equals -4, 2 a2 equals 16.
It is a system in row echelon form.
\( \begin{matrix} a_0&+&a_1&+&a_2&=&4\\ &&a_1&+&3a_2&=&-4\\ &&&&2a_2&=&16 \end{matrix}\)
Let's solve it by back substitution.
Solving the third equation in a2 gives a2 equals 8.
Then substituting that value of a2 in the second equation gives a1 plus 24 equals -4, that is equivalent to a1 equals -28.
Finally, substituting the values of a1 and a2 in the first equation gives a0 minus 28 plus 8 equals 4, that is equivalent to a0 equals 24.
The search polynomial is thus P of x equals 24 minus 28 x plus 8 x to the square.
\( P(x)=24-28x+8x^2\)
Let's illustrate it in Python.
We create a new file and we begin to type.
From numpy import star, to import the scientific computing library numpy.
From matplotlib.pyplot import star, to import the graphical library matplotlib.pyplot.
And x is made of the numbers from -2 to 6 by steps of 0.01, and y is equal to 24 minus 28 x plus 8 multiplied by x to the square.
We plot x and y in blue, with the label into qutes, into dollars for an equation, 24 minus 28 x plus 8 x to the square.
We plot the first point (1,4), 'ko' to have a big dot marker size equals 5.
We copy and we paste and we plot the second point (2,0) and we plot the third point (3,12).
We add a grid and we add a legend.
from numpy import *
from matplotlib.pyplot import *
x=arange(-2,6,0.01)
y=24-28*x+8*x**2
plot(x,y,'b',label='$24-28x+8x^2$')
plot(1,4,'ko',markersize=5)
plot(2,0,'ko',markersize=5)
plot(3,12,'ko',markersize=5)
grid()
legend()We save.
We are already in the right directory and we give it a name PolynomialFit.py.
And we run, and you see that we have a parabola passing through the three dots.
We save the figure, we put it in the right directory and we give it a name PolynomialFit.png
Polynomial Fit
What's coming now? Now we shall dive into the systems of linear equations that will be seen as matrix equations.