> with(linalg);
Problem 1--- We are asked to solve the following system of equations using Cramer's rule:
4x + 5y + 6z = 6
6y + 3z + 2t = 10
3x + 2y + z - t = 1
x + t = 2
It's matrix of coefficients is the following:
> A:=matrix([[4,5,6,0],[0,6,3,2],[3,2,1,-1],[1,0,0,1]]);
A := |
[ 4 |
5 |
6 |
0 ] |
[ 0 |
6 |
3 |
2 ] |
[ 3 |
2 |
1 |
-1 ] |
[ 1 |
0 |
0 |
1 ] |
The determinant of this matrix is:
> D:=det(A);
D := -98
Since the determinant is not 0, A is invertible. We can therefore use
Cramer's rule. We begin with matrix A1. It is found by replacing column 1 of A by the column of right sides from the system of equations.
> A1:=matrix([[6,5,6,0],[10,6,3,2],[1,2,1,-1],[2,0,0,1]]);
A1 := |
[ 6 |
5 |
6 |
0 ] |
[ 10 |
6 |
3 |
2 ] |
[ 1 |
2 |
1 |
-1 ] |
[ 2 |
0 |
0 |
1 ] |
Here is the determinant of A1:
> D1:=det(A1);
D1 := -21
From this we can find X. X= D1/D
> X:=D1/D;
X := 3/14
Now we form matrix A2 by replacing the second column of A by the column of right sides.
> A2:=matrix([[4,6,6,0],[0,10,3,2],[3,1,1,-1],[1,2,0,1]]);
A2 := |
[ 4 |
6 |
6 |
0 ] |
[ 0 |
10 |
3 |
2 ] |
[ 3 |
1 |
1 |
-1 ] |
[ 1 |
2 |
0 |
1 ] |
Here is the determinant of A2:
> D2:=det(A2);
D2 := -108
From this we can find Y. Y= D2/D
> Y:=D2/D;
Y := 54/49
Now we form matrix A3 by replacing the third column of A by the column of right sides.
> A3:=matrix([[4,5,6,0],[0,6,10,2],[3,2,1,-1],[1,0,2,1]]);
A3 := |
[ 4 |
5 |
6 |
0 ] |
[ 0 |
6 |
10 |
2 ] |
[ 3 |
2 |
1 |
-1 ] |
[ 1 |
0 |
2 |
1 ] |
Here is the determinant of A3:
> D3:=det(A3);
D3 := 6
From this we can find Z. Z= D3/D
> Z:=D3/D;
Z := -3/49
Now we form matrix A4 by replacing the second column of A by the column of right sides.
> A4:=matrix([[4,5,6,6],[0,6,3,10],[3,2,1,1],[1,0,0,2]]);
A4 := |
[ 4 |
5 |
6 |
6 ] |
[ 0 |
6 |
3 |
10 ] |
[ 3 |
2 |
1 |
1 ] |
[ 1 |
0 |
0 |
2 ] |
Here is the determinant of A4:
> D4:=det(A4);
D4 := -175
From this we can find T. T= D4/D
> T:=D4/D;
T := 25/14
So we got the following solution to our system of equations.
X=3/14, Y=54/49, Z=-3/49, T=25/14
We can checck to make sure that this is the solutiion to the system of
equations.
4*(3/14) + 5*(54/49) + 6*(-3/49) = 12/14 + 270/49 - 18/49= 6, 6/7 + 252/49= 6, 42/49 + 252/49= 6, 294/49=6 6=66*(54/49)+3*(-3/49)+2(25/14)= 324/49 + -9/49 + 50/14 =10, 315/49 + 50/14= 10, 630/98 + 350/98 = 10, 980/98 = 10, 10=103*(3/14)+2*(54/49)+1*(-3/49)- 1*(25/14)= 1, 9/14 + 108/49 + -3/49 - 25/14= 1, -16/14 + 105/49=10, -112/98 + 210/98 = 1, 98/98= 1, 1=11*(3/14) + 1(25/14) = 2, 3/14 + 25/14=2, 28/14=2, 2=2 Thus, as you can see the answers we got are correct.
Problem 2---- We are asked to find all values of parameter a such that in the solution of the system of equations, we have x>y. We are told to use Cramer's rule. We are given the following system of equations.:
2x + 3y + 5z + t = a
3x - y - z - t = 2a
x + z + t = 3a
x + y + z + t = 5a
It's matrix of coefficients is:
> B:=matrix([[2,3,5,1],[3,-1,-1,-1],[1,0,1,1],[1,1,1,1]]);
B := |
[ 2 |
3 |
5 |
1 ] |
[ 3 |
-1 |
-1 |
-1 ] |
[ 1 |
0 |
1 |
1 ] |
[ 1 |
1 |
1 |
1 ] |
The determinant of the matrix is:
> d:=det(B);
d := -16
Since the determinant is not 0 then B is invertible. We can therefore use Cramer's rule. We begin with matrix B1. It is found by replacing column 1 of B by the column of right sides from the system of equations.
> B1:=matrix([[a,3,5,1],[2*a,-1,-1,-1],[3*a,0,1,1],[5*a,1,1,1]]);
B1 := |
[ a |
3 |
5 |
1 ] |
[ 2a |
-1 |
-1 |
-1 ] |
[ 3a |
0 |
1 |
1 ] |
[ 5a |
1 |
1 |
1 ] |
Here is the determinant of B1:
> d1:=det(B1);
d1 := - 28 a
So we can find x:
> x:=d1/d;
x := 7/4 a
Now we form B2 by replacing the second column of B by the column of right sides.
> B2:=matrix([[2,a,5,1],[3,2*a,-1,-1],[1,3*a,1,1],[1,5*a,1,1]]);
B2 := |
[ 2 |
a |
5 |
1 ] |
[ 3 |
2a |
-1 |
-1 ] |
[ 1 |
3a |
1 |
1 ] |
[ 1 |
5a |
1 |
1 ] |
Here is the determinant of B2:
> d2:=det(B2);
d2 := - 32 a
So we can find y:
> y:=d2/d;
y := 2 a
So now we have the values of x and y. We are told that x>y. So by subtitution 7a/4 > 2a. We then multiply both side by 4 and get 7a > 8a. Then we subtract 7a from both sides and get 0 > a. This defines all values of a for which x > y: a must be less than 0.