LaTex2Web logo

Documents Live, a web authoring and publishing system

If you see this, something is wrong

Table of contents

First published on Monday, Jan 6, 2025 and last modified on Monday, Jan 6, 2025

Linear Algebra in the Euclidian Space: Section 2 test
2022

Fabienne Chaplais Mathedu SAS

Keywords: Linear system

1 Presentation of a new Puzzle

Here is a new puzzle that you will have to solve.

Assume that in a farm:

  1. The triple of the number of hens plus the double of the number of rabbits is 38.

  2. The quadruple of the number of hens minus the number of rabbits is 14.

Then, by the end of the test, you will answer the questions:

  1. How many hens are there in the farm?

  2. How many rabbits are there in the farm?

2 Equivalent Linear System

Find a system of 2 linear equation of 2 real variables that is equivalent to the puzzle, denoting:

  1. \( x\) the number of hens in the farm,

  2. and \( y\) the number of rabbits in the farm.

2.1 Rewrite the hypotheses

2.2 Rewrite the questions

2.3 Write the equivalent system

3 Solve the System obtained

Solve the system obtained by the method of substitution/elimination.

Make exact calculations with fractions from end to end.

3.1 Solve the first Equation in \( x\)

3.2 Replace \( x\) by its Value in the Second Equation

Tips: Distribute the factor \( 4\) and then multiply both members of the equality by \( 3\) . Don’t hesitate to use the calculator, but only to help fraction computations.

3.3 Replace y by its value 1in the equation giving \( x\) as a function of \( y\)

3.4 Give the solution of the linear system

The solution is a couple \( (x,y)\) . In particular, check the solution.

4 The Matrix View

4.1 The linear system as a matrix equation

Find a matrix equation \( AX=B\) equivalent to the system.

4.1.1 Define relevant column vectors \( X\) and \( B\) , and square matrix \( A\)

TIP: \( 4x-y=4x+(-1)y\) .

4.1.2 Multiply the square matrix \( A\) by the column vector \( X\)

4.1.3 Deduce that the system is equivalent to the matrix vector \( AX=B\)

4.2 Inverse the Matrix \( A\)

4.2.1 Calculate the determinant of the matrix \( A\)

4.2.2 Calculate the inverse of the matrix \( A\)

Let the result as fractions of positive integers of their opposite.

TIP: Define a matrix \( AA\) the following way:

  1. The diagonal elements of \( A\) are exchanged to obtain the diagonal elements of \( AA\) .

  2. The anti-diagonal elements of \( A\) are opposed to obtain the anti-diagonal elements of \( AA\) .

4.3 Solve the system the matrix way

4.3.1 Multiply the matrix \( A^{-1}\) by the column vector \( B\) .

Calculate with fractions from end to end, but don’t hesitate to use the calculator to help you.

4.3.2 Deduce the solution of the matrix equation

4.3.3 Deduce the matrix way to solve the system

5 Solve the matrix Equation in Python

Update the following script next page to define and solve the matrix equation \( AX=B\) , with \( A=\begin{bmatrix}3&2\ 4&-1\end{bmatrix}\) and \( B=\begin{bmatrix}38\ 14\end{bmatrix}\) .

5.1 IMPORTANT

Do it in a script in Anaconda and Spyder named ‘LinearSystem.py’ for instance, in order to test your program!

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' 
'''