0% found this document useful (0 votes)
22 views6 pages

Assignment 7

For the set of equations 2x2 1 5x3 5 9 2x1 1 x2 1 x3 5 9 3x1 1 x2 5 10 (a) Compute the determinant. (b) Use Cramer’s rule to solve for the x’s. (c) Substitute your results back into the original equation to check your results.

Uploaded by

monica2897monica
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views6 pages

Assignment 7

For the set of equations 2x2 1 5x3 5 9 2x1 1 x2 1 x3 5 9 3x1 1 x2 5 10 (a) Compute the determinant. (b) Use Cramer’s rule to solve for the x’s. (c) Substitute your results back into the original equation to check your results.

Uploaded by

monica2897monica
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Assignment 7

Solution:

Coefficient Matrix:

[0, 2, 5]
[2, 1, 1]
[3, 1, 0]
a) Determinant D = 0 -2(-3)+5(2-3) = 6-5 = 1
b) Use Cramer's rule to solve for the x
Dx1 :
[9, 2, 5]
[9, 1, 1]
[10, 1, 0]
Dx1 = 9(-1)-2(-10)+5(9-10) = -9+20-5 = 6
Dx2 :
[0, 9, 5]
[2, 9, 1]
[3, 10, 0]
Dx2 = 0-9(-3)+5(20-27) = 27-35 = -8
Dx3 :
[0, 2, 9]
[2, 1, 9]
[3, 1, 10]
Dx3 = 0-2(20-27)+9(2-3) = 14-9 = 5

x1 = Dx1/D = 6
x2 = Dx2/D = -8
x3 = Dx3/D = 5

Solution: ( 6,-8,5)

c) Substitute results back into the original equations to check the results:
2x2 + 5x3 = 9
2(-8) +5(5) = 9
-16+25 = 9
9=9
2 x 1 + x2 + x3 = 9
2(6)-8+5 = 9
12-8+5 = 9
9=9

3x1 + x2 = 10
3(6)-8 = 10
18-8 = 10
10 = 10

Python code snippet:

Python code Output:


Solution:

Coefficient Matrix:

[0, -3, 7 ]
[1, 2, -1]
[5, -2, 0]
a) Determinant D = 0 – (-3)(0+5) + 7(-2-10) = 15 – 84 = -69
b) Use Cramer's rule to solve for the x

Dx1 :
[2, -3, 7 ]
[3, 2, -1]
[2, -2, 0]
Dx1 = 2(-2) + 3(2) + 7(-6-4) = -4 + 6 -70 = -68
Dx2 :
[0, 2, 7 ]
[1, 3, -1]
[5, 2, 0]
Dx2 = 0 – 2(5) + 7(2-15) = -10 – 91 = -101
Dx3 :
[0, -3, 2 ]
[1, 2, 3]
[5, -2, 2]

Dx3 = 0 + 3(2-15) + 2(-2-10) = -39 – 24 = - 63

Finding xi:

x1 = Dx1/D = -68/-69 = 0.9855


x2 = Dx2/D = -101/-69 = 1.4638
x3 = Dx3/D = -63/-69 = 0.9130

c) Use Gauss elimination with partial pivoting to solve for the x’s:
A = [0, -3, 7 ]
[1, 2, -1]
[5, -2, 0]
B = [2]
[3]
[2]
After solving by back substitution, we get:
x1 = 0.9855
x2 = 1.4638
x3 = 0.9130

d) Substitute results back into the original equations to check the results:
-3x2 + 7x3 = 2
-3(1.4638) + 7(0.9130) = 2
-4.3914 + 6.391 = 2
2=2

x1 + 2x2 – x3 = 3
0.9855 + 2(1.4638) – 0.9130 = 3
0.9855 + 2.9276 – 0.9130 = 3
3=3

5x1 - 2x2 = 2
5(0.9855) - 2(1.4638) = 2
4.92 – 2.92 = 2
2=2

Python code:
Python Output:

You might also like