Exercises 2.1 - 3.1

2 minute read

Chapter 2. Systems of Linear Equations

2.1 Introduction to Systems of Linear Equatios

No MATLAB problems in this section.

2.2 Solving Linear Ssytems by Row Reduction

Exercise 2.1. (Reduced Row Echelon Form with Pivot Columns and Ranks)

In MATLAB, there are several useful commands for matrices such as rref command which produces the reduced row echelon form together with the pivot columns, and rank command which gives the number of the leading \(1\)’s without finding its row echelon form. Find the reduced row echelon form, the pivot columns, and the rank of the matrix \(A\), where

\[A = \begin{bmatrix} 2 & -3 & 1 & 0 & 4 \\ 1 & 1 & 2 & 2 & 0 \\ 3 & 0 & -1 & 4 & 5 \\ 1 & 6 & 5 & 6 & -4 \end{bmatrix}\]
% Construct the matrix A.
A=[2 -3 1 0 4; 1 1 2 2 0; 3 0 -1 4 5; 1 6 5 6 -4]; 

% Display the format of each entry as a rational form
format rat; 

% Find the reduced row echelon form 
% and the pivot columns of the matrix A.
[rref_A, pivotcols] = rref(A);

% Find the rank of the matrix A.
rank_A = rank(A); 

disp('The reduced row echelon form is'); disp(rref_A);
disp('The pivot columns are'); disp(pivotcols);
disp('The number of the leading 1 is'); disp(rank_A);

MATLAB results.

The reduced row echelon form is
       1              0              0             17/13           3/2     
       0              1              0             11/13          -1/2     
       0              0              1             -1/13          -1/2     
       0              0              0              0              0       

The pivot columns are
       1              2              3       

The number of the leading 1 is
       3       

Exercise 2.2. (Linear Combinations)

Use the MATLAB command rref to express the vector \(\mathbf{b}=(-21, \hspace{1mm}-60, \hspace{1mm}-3, \hspace{1mm}108, \hspace{1mm}84)\) as a linear combination of \(\mathbf{v_{1}}\), \(\mathbf{v_{2}}\), and \(\mathbf{v_{3}}\) where \(\mathbf{v_{1}}=(1, \hspace{1mm} -1, \hspace{1mm}3, \hspace{1mm}11, \hspace{1mm}20)\), \(\mathbf{v_{2}}=(10, \hspace{1mm}5, \hspace{1mm}15, \hspace{1mm}20, \hspace{1mm}11)\), and \(\mathbf{v_{3}}=(3, \hspace{1mm}3, \hspace{1mm}4, \hspace{1mm}4, \hspace{1mm}9)\).

% Construct b as a column vector.
b = [-21 -60 -3 108 84]';
% Set v1, v2, v3 as column vectors. 
v1 = [1 -1 3 11 20]'; 
v2 = [10 5 15 20 11]'; 
v3 = [3 3 4 4 9]';
% Set a matrix A with column vectors v1, v2 and v3. 
A = [v1 v2 v3]; 
% Augmented matrix [A | b].
augA = [A b]; 
% Reduced row echelon form of augA.
rref_augA = rref(augA);
% Solution vector from rref_augA. 
x = rref_augA(1:3, 4); 

% Display the result as an integer form.
format rat; 
disp('b is a linear combination of x(1)*v1+x(2)*v2+x(3)*v3, where');
disp('x(1) ='); disp(x(1)); disp('x(2) ='); disp(x(2));
disp('x(3) ='); disp(x(3));

MATLAB results.

b is a linear combination of x(1)*v1+x(2)*v2+x(3)*v3, where
x(1) =
      12       

x(2) =
       3       

x(3) =
     -21   

Chapter 3. Matrices and Matrix Algebra

2.1 Operations on Matrices

No MATLAB problems in this section.

Leave a comment