If you see this, something is wrong
To get acquainted with the document, the best thing to do is to select the "Collapse all sections" item from the "View" menu. This will leave visible only the titles of the top-level sections.
Clicking on a section title toggles the visibility of the section content. If you have collapsed all of the sections, this will let you discover the document progressively, from the top-level sections to the lower-level ones.
Generally speaking, anything that is blue is clickable.
Clicking on a reference link (like an equation number, for instance) will display the reference as close as possible, without breaking the layout. Clicking on the displayed content or on the reference link hides the content. This is recursive: if the content includes a reference, clicking on it will have the same effect. These "links" are not necessarily numbers, as it is possible in LaTeX2Web to use full text for a reference.
Clicking on a bibliographical reference (i.e., a number within brackets) will display the reference.
Speech bubbles indicate a footnote. Click on the bubble to reveal the footnote (there is no page in a web document, so footnotes are placed inside the text flow). Acronyms work the same way as footnotes, except that you have the acronym instead of the speech bubble.
By default, discussions are open in a document. Click on the discussion button below to reveal the discussion thread. However, you must be registered to participate in the discussion.
If a thread has been initialized, you can reply to it. Any modification to any comment, or a reply to it, in the discussion is signified by email to the owner of the document and to the author of the comment.
First published on Monday, Jan 6, 2025 and last modified on Monday, Jan 6, 2025 by Fabienne Chaplais.
Mathedu SAS
Linear Systems
\paragraph{} Solve the following system by the method of substitution/elimination.
(1)
Make exact calculations with fractions from end to end.
The first equation is equivalent to the linear equation in \( x\) :
(2)
Its solution depends on \( y\) and is:
\( x=\frac{-11-2y}{4}= -\frac{11}{4} -\frac{y}{2} \) .
Consequently, the solution of the first equation in \( x\) is:
(3)
Tips: Distribute the factor \( 2\) and then multiply both members of the equality by \( 4\) . Don’t hesitate to use the calculator, but only to help fraction computations.
In the second equation, we eliminate \( x\) by replacing it by its value given by the equation 3.
The second equation is thus equivalent to:
(4)
If we distribute the factor \( 3\) , we obtain:
(5)
If we multiply both members of the equality by \( 3\) , we obtain:
(6)
The equation 6 is equivalent to the affine equation in \( y\) :
(7)
Its solution is: \( y=\frac{46-33}{26}=\frac{13}{26}=\frac{1}{2} \) .
Consequently, the solution of the system 1 in \( y\) is:
(8)
In the equation 3, we eliminate \( y\) by replacing it by its value \( 10\) .
The equation 3 is thus equivalent to:
(9)
If we continue the calculation, we obtain: \( x=-\frac{11}{4}-\frac{1}{4}=-\frac{12}{4}=-3 \) .
Consequently, the solution of the system 1 in \( x\) is
(10)
The solution is a couple \( (x,y)\) . In particular, check the solution.
The solution of the linear system is the couple of real numbers is \( (x,y)=(-3,\frac{1}{2})\) .
This is because a solution must be \( (-3,\frac{1}{2})\) , and \( (x,y)=(-3,\frac{1}{2})\) is a solution as:
\( 4x+2y=4\times(-3)+2\times\frac{1}{2}=-12+1=-11\) ,
and \( 3x-5y=3\times(-3)-5\times\frac{1}{2}=-9-\frac{5}{2}=\frac{-18-5}{2}=-\frac{23}{2}\) .
\paragraph{} Find a matrix equation \( AX=B\) equivalent to the system.
TIP: \( 3x-5y=3x+(-5)y\) .
We define the column vectors: \( X=\begin{bmatrix}x\ y\end{bmatrix}\) and \( B=\begin{bmatrix}-11\ \frac{23}{2}\end{bmatrix}\) , as well as the square matrix: \( A=\begin{bmatrix}4&2\ 3&-5\end{bmatrix}\) .
The product \( AX\) of the matrix \( A\) and the column vector \( X\) is equal to:
(11)
The elements of the column vector \( AX\) are the first members of the linear system:
\( \left\{ \begin{matrix} 4x&+&2y&&=&-11\ 3x&-&5y&&=&-\frac{23}{2} \end{matrix} \right. \)
Moreover, the elements of the column vector \( B\) are the second membre of that system.
Consequently, the linear system above is equivalent to the matrix equation \( AX=B\) .
The determinant of the matrix \( A=\begin{bmatrix}4&2\ 3&-5\end{bmatrix}\) is:
\(\det(A)=4\times (-5) - 3\times 2 = -20-6 = -26 \).
Let the result as fractions of positive integers of their opposite.
TIP: Define a matrix \( AA\) the following way:
The diagonal elements of \( A\) are exchanged to obtain the diagonal elements of \( AA\) .
The anti-diagonal elements of \( A\) are opposed to obtain the anti-diagonal elements of \( AA\) .
\( AA\) is equal to:
(12)
The inverse of the matrix \( A\) is the product of the inverse of \( \det(A)\) and \( AA\) :
(13)
Let’s enter the factor \( \frac{1}{5}\) in the matrix \( AA\) element by element:
(14)
so that:
(15)
Calculate with fractions from end to end, but don’t hesitate to use the calculator to help you.
Let’s multiply the matrix \( A^{-1}\) by the column vector \( B\) :
\( A^{-1}B= \begin{bmatrix} \frac{5}{26}&\frac{1}{13}\ \ \frac{3}{26}&-\frac{2}{13} \end{bmatrix} \begin{bmatrix} -11\ -\frac{23}{2} \end{bmatrix}= \begin{bmatrix} \frac{5}{26}\times(-11)+ \frac{1}{13}\times\left(-\frac{23}{2}\right)\ \ \frac{3}{26}\times(-11) - \frac{2}{13}\times\left(-\frac{23}{2}\right) \end{bmatrix} \)
Let’s calculate further, we obtain: \( A^{-1}B= \begin{bmatrix} \frac{-55 -23}{26}\ \ \frac{-33+46}{26} \end{bmatrix}= \begin{bmatrix} \frac{78}{26}\ \ \frac{13}{26} \end{bmatrix}= \begin{bmatrix} -3\ \frac{1}{2} \end{bmatrix} \)
The solution of the matrix eqution \( AX=B\) is the column vector \( A^{-1}B\) .
Consequently, the solution of the system of linear equations:
\( \left\{ \begin{matrix} 4x&+&2y&&=&-3\ 3x&-&5y&&=&-\frac{23}{2} \end{matrix} \right. \)
is the couple \( (x,y)=(-3,\frac{1}{2})\) of elements of the column vector \( A^{-1}B\) .
In Python, the fractions may be entered as divisions (1/2 for \( \frac{1}{2}\) ), and are displayed as (approximate) decimal numbers. Moreover, the solution \( (x,y)=(-3,0.5)\) may be approximated as well because of roundoff errors.
Do it in a script, in order to test your program!
Update the following script ‘LinearSystem.py’ to define and solve the matrix equation \( AX=B\) , with \( A=\begin{bmatrix}4&2\ 3&-5\end{bmatrix}\) and \( B=\begin{bmatrix}-11\ -\frac{23}{2}\end{bmatrix}\) .
from numpy import *
from numpy.linalg import *
X0=array([43,3])
print('X0=',X0)
'''
It is a line vector
'''
A=array([[2,1],[1,3]])
print('A=\n',A)
'''
It is a matrix with 2 rows and 2 columns
'''
B0=A@X0
'''
The column vector B0' is the product of the matrix A and the column vector
X0'
'''
print('B0=',B0)
```
We have reconstructed the system of two linear equations and two
variables equivalent to the matric equation AX=B, with the solution (43,3).
```
B=array([89,52])
InvA=inv(A)
print('The inverse of A is\n',InvA)
X=InvA@B
'''
The column vector X' is the product of the inverse of A and the column
vector B'
'''
print('X=',X)
'''
The column vector X' is the solution of the matrix equation AX'=B'
'''Here is the updated script:
from numpy import *
from numpy.linalg import *
X0=array([-3,1/2])
print('X0=',X0)
'''
It is a line vector
'''
A=array([[4,2],[3,-5]])
print('A=\n',A)
'''
It is a matrix with 2 rows and 2 columns
'''
B0=A@X0
'''
The column vector B0' is the product of the matrix A and the column vector
X0'
'''
print('B0=',B0)
```
We have reconstructed the system of two linear equations and two
variables equivalent to the matric equation AX=B, with the solution
(-3,1/2). Note that -11.5=-23/2.
```
B=array([-11,-23/2])
InvA=inv(A)
print('The inverse of A is\n',InvA)
X=InvA@B
'''
The column vector X' is the product of the inverse of A and the column
vector B'
'''
print('X=',X)
'''
The column vector X' is the solution of the matrix equation AX'=B'
'''I am normally hidden by the status bar