0% found this document useful (0 votes)
30 views8 pages

Assignment 1 Solution

The document provides 3 problems involving solving systems of linear equations using Gaussian elimination and Gaussian-Jordan elimination. Problem 1 has 3 systems of equations with 3 unknowns each to solve using Gaussian elimination. Problem 2 asks to solve the same systems from Problem 1 using Gaussian-Jordan elimination. Problem 3 provides another system of 4 equations with 4 unknowns to solve using both Gaussian elimination and Gaussian-Jordan elimination. The document provides the full systems of equations and steps to solve each one.

Uploaded by

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

Assignment 1 Solution

The document provides 3 problems involving solving systems of linear equations using Gaussian elimination and Gaussian-Jordan elimination. Problem 1 has 3 systems of equations with 3 unknowns each to solve using Gaussian elimination. Problem 2 asks to solve the same systems from Problem 1 using Gaussian-Jordan elimination. Problem 3 provides another system of 4 equations with 4 unknowns to solve using both Gaussian elimination and Gaussian-Jordan elimination. The document provides the full systems of equations and steps to solve each one.

Uploaded by

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

Assignment 1 Linear Algebra (MATH-104) Date: 18-06-2022

Total Marks: 100 Due: Tuesday, 28-06-2022

Problem 1 (10+10+10=30 Marks)

Solve the following systems of linear equations using GAUSS ELIMINATION Method.
(a)
𝑥−𝑦+𝑧 = 8
2𝑥 + 3𝑦 − 𝑧 = −2
3𝑥 − 2𝑦 − 9𝑦 = 9

1 −1 1 ⋮ 8
[𝐴 ⋮ 𝑏] = [2 3 −1 ⋮ −2]
3 −2 −9 ⋮ −9
1 −1 1 ⋮ 8 𝑅2 → 𝑅2 + (−2)𝑅1
[𝐴 ⋮ 𝑏] = [0 5 −3 ⋮ −18]
𝑅3 → 𝑅3 + (−3)𝑅1
0 1 −12 ⋮ −15
1 −1 1 ⋮ 8
[𝐴 ⋮ 𝑏] = [0 5 −3 ⋮ −18 ] 𝑅2 → 𝑅2 + (−1/5)𝑅1
0 0 −57/5 ⋮ −57/5

𝑧=1 ; 𝑦 = −3 ; 𝑥=4 𝐴𝑛𝑠𝑤𝑒𝑟

(b)
𝑥 + 4𝑦 − 𝑧 = 4
2𝑥 + 5𝑦 + 8𝑧 = 15
𝑥 + 3𝑦 − 3𝑧 = 1

1 4 −1 ⋮ 4
[𝐴 ⋮ 𝑏] = [2 5 8 ⋮ 15]
1 3 −3 ⋮ 1
1 4 −1 ⋮ 4 𝑅2 → 𝑅2 + (−2)𝑅1
[𝐴 ⋮ 𝑏] = [0 −3 10 ⋮ 7]
𝑅3 → 𝑅3 + (−1)𝑅1
0 −1 −2 ⋮ −3
1 4 −1 ⋮ 4
[𝐴 ⋮ 𝑏] = [0 −3 10 ⋮ 7 ] 𝑅2 → 𝑅2 + (−1/3)𝑅1
0 0 −16/3 ⋮ −16/3

𝑧=1 ; 𝑦=1 ; 𝑥=1 𝐴𝑛𝑠𝑤𝑒𝑟

(c)
𝑤 + 2𝑥 − 𝑦 + 𝑧 = 6
−𝑤 + 𝑥 + 2𝑦 − 𝑧 = 3
2𝑤 − 𝑥 + 2𝑦 + 2𝑧 = 14
𝑤 + 𝑥 − 𝑦 + 2𝑧 = 8
1 2 −1 1 ⋮ 6
−1 1 2 −1 ⋮ 3
[𝐴 ⋮ 𝑏] = [ ]
2 −1 2 2 ⋮ 14
1 1 −1 2 ⋮ 8

1 2 −1 1 ⋮ 6 𝑅2 → 𝑅2 + (1)𝑅1
0 3 1 0 ⋮ 9
[𝐴 ⋮ 𝑏] = [ ] 𝑅3 → 𝑅3 + (−2)𝑅1
0 −5 4 0 ⋮ 2
𝑅4 → 𝑅4 + (−1)𝑅1
0 −1 0 1 ⋮ 2

1 2 −1 1 ⋮ 6
0 3 1 0 ⋮ 9 𝑅3 → 𝑅3 + (5/3)𝑅2
[𝐴 ⋮ 𝑏] = [ ]
0 0 17/3 0 ⋮ 17 𝑅4 → 𝑅4 + (1/3)𝑅2
0 0 1/3 1 ⋮ 5

1 2 −1 1 ⋮ 6
0 3 1 0 ⋮ 9
[𝐴 ⋮ 𝑏] = [ ] 𝑅4 → 𝑅4 + (−1/17)𝑅3
0 0 17/3 0 ⋮ 17
0 0 0 1 ⋮ 4

𝑧=4 ; 𝑦=3 ; 𝑥=2 ; 𝑤=1 𝐴𝑛𝑠𝑤𝑒𝑟

Problem 2 (10+10+10=30 Marks)

Solve all the system of linear equations given in Problem 1 by using GAUSS-JORDAN ELIMINATION
Method.
(a)
𝑥−𝑦+𝑧 = 8
2𝑥 + 3𝑦 − 𝑧 = −2
3𝑥 − 2𝑦 − 9𝑦 = 9

1 −1 1 ⋮ 8
[𝐴 ⋮ 𝑏] = [2 3 −1 ⋮ −2]
3 −2 −9 ⋮ −9
1 −1 1 ⋮ 8 𝑅2 → 𝑅2 + (−2)𝑅1
[𝐴 ⋮ 𝑏] = [0 5 −3 ⋮ −18]
𝑅3 → 𝑅3 + (−3)𝑅1
0 1 −12 ⋮ −15
1 −1 1 ⋮ 8
[𝐴 ⋮ 𝑏] = [0 5 −3 ⋮ −18 ] 𝑅2 → 𝑅2 + (−1/5)𝑅1
0 0 −57/5 ⋮ −57/5

1 −1 1 ⋮ 8 𝑅1 → (1)𝑅1
[𝐴 ⋮ 𝑏] = [0 1 −3/5 ⋮ −18/5] 𝑅2 → (1/5)𝑅2
0 0 1 ⋮ 1 𝑅3 → (−5/57)𝑅3

1 −1 0 ⋮ 7 𝑅2 → 𝑅2 + (3/5)𝑅3
[𝐴 ⋮ 𝑏] = [0 1 0 ⋮ −3]
𝑅1 → 𝑅1 + (−1)𝑅3
0 0 1 ⋮ 1
1 0 0 ⋮ 4
[𝐴 ⋮ 𝑏] = [0 1 0 ⋮ −3] 𝑅1 → 𝑅1 + (1)𝑅2
0 0 1 ⋮ 1
𝑧=1 ; 𝑦 = −3 ; 𝑥=4 𝐴𝑛𝑠𝑤𝑒𝑟

(b)
𝑥 + 4𝑦 − 𝑧 = 4
2𝑥 + 5𝑦 + 8𝑧 = 15
𝑥 + 3𝑦 − 3𝑧 = 1

1 4 −1 ⋮ 4
[𝐴 ⋮ 𝑏] = [2 5 8 ⋮ 15]
1 3 −3 ⋮ 1
1 4 −1 ⋮ 4 𝑅2 → 𝑅2 + (−2)𝑅1
[𝐴 ⋮ 𝑏] = [0 −3 10 ⋮ 7]
𝑅3 → 𝑅3 + (−1)𝑅1
0 −1 −2 ⋮ −3
1 4 −1 ⋮ 4
[𝐴 ⋮ 𝑏] = [0 −3 10 ⋮ 7 ] 𝑅2 → 𝑅2 + (−1/3)𝑅1
0 0 −16/3 ⋮ −16/3

1 4 −1 ⋮ 4 𝑅1 → (1)𝑅1
[𝐴 ⋮ 𝑏] = [0 1 −10/3 ⋮ −7/3] 𝑅2 → (−1/3)𝑅2
0 0 1 ⋮ 1 𝑅3 → (−3/16)𝑅3

1 4 0 ⋮ 5 𝑅2 → 𝑅2 + (10/3)𝑅3
[𝐴 ⋮ 𝑏] = [0 1 0 ⋮ 1]
𝑅1 → 𝑅1 + (1)𝑅3
0 0 1 ⋮ 1
1 0 0 ⋮ 1
[𝐴 ⋮ 𝑏] = [0 1 0 ⋮ 1] 𝑅1 → 𝑅1 + (−4)𝑅2
0 0 1 ⋮ 1

𝑧=1 ; 𝑦=1 ; 𝑥=1 𝐴𝑛𝑠𝑤𝑒𝑟

(c)
𝑤 + 2𝑥 − 𝑦 + 𝑧 = 6
−𝑤 + 𝑥 + 2𝑦 − 𝑧 = 3
2𝑤 − 𝑥 + 2𝑦 + 2𝑧 = 14
𝑤 + 𝑥 − 𝑦 + 2𝑧 = 8
1 2 −1 1 ⋮ 6
−1 1 2 −1 ⋮ 3
[𝐴 ⋮ 𝑏] = [ ]
2 −1 2 2 ⋮ 14
1 1 −1 2 ⋮ 8

1 2 −1 1 ⋮ 6 𝑅2 → 𝑅2 + (1)𝑅1
0 3 1 0 ⋮ 9
[𝐴 ⋮ 𝑏] = [ ] 𝑅3 → 𝑅3 + (−2)𝑅1
0 −5 4 0 ⋮ 2
𝑅4 → 𝑅4 + (−1)𝑅1
0 −1 0 1 ⋮ 2

1 2 −1 1 ⋮ 6
0 3 1 0 ⋮ 9 𝑅3 → 𝑅3 + (5/3)𝑅2
[𝐴 ⋮ 𝑏] = [ ]
0 0 17/3 0 ⋮ 17 𝑅4 → 𝑅4 + (1/3)𝑅2
0 0 1/3 1 ⋮ 5
1 2 −1 1 ⋮ 6
0 3 4 0 ⋮ 9
[𝐴 ⋮ 𝑏] = [ ] 𝑅4 → 𝑅4 + (−1/17)𝑅3
0 0 17/3 0 ⋮ 17
0 0 0 1 ⋮ 4

1 2 −1 1 ⋮ 6 𝑅1 → (1)𝑅1
0 1 1/3 0 ⋮ 3 𝑅2 → (1/3)𝑅2
[𝐴 ⋮ 𝑏] = [ ]
0 0 1 0 ⋮ 3 𝑅3 → (3/17)𝑅3
0 0 0 1 ⋮ 4 𝑅4 → (1)𝑅4

1 2 −1 0 ⋮ 2 𝑅3 → 𝑅3 + (0)𝑅4
0 1 1/3 0 ⋮ 3
[𝐴 ⋮ 𝑏] = [ ] 𝑅2 → 𝑅2 + (0)𝑅4
0 0 1 0 ⋮ 3
𝑅1 → 𝑅1 + (−1)𝑅4
0 0 0 1 ⋮ 4

1 2 0 0 ⋮ 5
0 1 0 0 ⋮ 2 𝑅2 → 𝑅2 + (−1/3)𝑅3
[𝐴 ⋮ 𝑏] = [ ]
0 0 1 0 ⋮ 3 𝑅1 → 𝑅1 + (1)𝑅3
0 0 0 1 ⋮ 4

1 0 0 0 ⋮ 1
0 1 0 0 ⋮ 2
[𝐴 ⋮ 𝑏] = [ ] 𝑅1 → 𝑅1 + (−2)𝑅2
0 0 1 0 ⋮ 3
0 0 0 1 ⋮ 4

𝑧=4 ; 𝑦=3 ; 𝑥=2 ; 𝑤=1 𝐴𝑛𝑠𝑤𝑒𝑟

Problem 3 (10+10+10=30 Marks)

Write down all the systems of linear equations given in Problem 1 in the form 𝐴𝑥 = 𝑏. Then compute the
inverse of Matrix 𝐴 as 𝐴−1 using GAUSS-JORDAN Method, and then solve the systems of linear
equations by computing 𝑥 = 𝐴−1 𝑏.

(a)
𝑥−𝑦+𝑧 = 8
2𝑥 + 3𝑦 − 𝑧 = −2
3𝑥 − 2𝑦 − 9𝑦 = 9

1 −1 1 ⋮ 1 0 0
[𝐴 ⋮ 𝑏] = [2 3 −1 ⋮ 0 1 0]
3 −2 −9 ⋮ 0 0 1
1 −1 1 ⋮ 1 0 0 𝑅2 → 𝑅2 + (−2)𝑅1
[𝐴 ⋮ 𝑏] = [0 5 −3 ⋮ −2 1 0]
𝑅3 → 𝑅3 + (−3)𝑅1
0 1 −12 ⋮ −3 0 1
1 −1 1 ⋮ 1 0 1
[𝐴 ⋮ 𝑏] = [0 5 −3 ⋮ −2 1 0] 𝑅2 → 𝑅2 + (−1/5)𝑅1
0 0 −57/5 ⋮ −13/5 −1/5 1
1 −1 1 ⋮ 1 0 1 𝑅1 → (1)𝑅1
[𝐴 ⋮ 𝑏] = [0 1 −3/5 ⋮ −2/5 1/5 0 ] 𝑅2 → (1/5)𝑅2
0 0 1 ⋮ 13/57 1/57 −5/57 𝑅3 → (−5/57)𝑅3

1 −1 0 ⋮ 44/57 −1/57 5/57


𝑅2 → 𝑅2 + (3/5)𝑅3
[𝐴 ⋮ 𝑏] = [0 1 0 ⋮ −5/19 4/19 −1/19]
𝑅1 → 𝑅1 + (−1)𝑅3
0 0 1 ⋮ 13/57 1/57 −5/57

1 0 0 ⋮ 29/57 11/57 2/57


[𝐴 ⋮ 𝑏] = [0 1 0 ⋮ −5/19 4/19 −1/19] 𝑅1 → 𝑅1 + (1)𝑅2
0 0 1 ⋮ 13/57 1/57 −5/57

29/57 11/57 2/57 8


𝑥 = 𝐴−1 𝑏 = [−5/19 4/19 −1/19] [−2]
13/57 1/57 −5/57 9

𝑧=1 ; 𝑦 = −3 ; 𝑥=4 𝐴𝑛𝑠𝑤𝑒𝑟

(b)
𝑥 + 4𝑦 − 𝑧 = 4
2𝑥 + 5𝑦 + 8𝑧 = 15
𝑥 + 3𝑦 − 3𝑧 = 1

1 4 −1 ⋮ 1 0 0
[𝐴 ⋮ 𝑏] = [2 5 8 ⋮ 0 1 0]
1 3 −3 ⋮ 0 0 1
1 4 −1 ⋮ 1 0 0 𝑅2 → 𝑅2 + (−2)𝑅1
[𝐴 ⋮ 𝑏] = [0 −3 10 ⋮ −2 1 0]
𝑅3 → 𝑅3 + (−1)𝑅1
0 −1 −2 ⋮ −1 0 1

1 4 −1 ⋮ 1 0 0
[𝐴 ⋮ 𝑏] = [0 −3 10 ⋮ −2 1 0] 𝑅2 → 𝑅2 + (−1/3)𝑅1
0 0 −16/3 ⋮ −1/3 −1/3 1

1 4 −1 ⋮ 1 0 1 𝑅1 → (1)𝑅1
[𝐴 ⋮ 𝑏] = [0 1 −10/3 ⋮ 2/3 −1/3 0 ] 𝑅2 → (−1/3)𝑅2
0 0 1 ⋮ 1/16 1/16 −3/16 𝑅3 → (−3/16)𝑅3

1 4 0 ⋮ 17/16 1/16 −3/16


𝑅2 → 𝑅2 + (10/3)𝑅3
[𝐴 ⋮ 𝑏] = [0 1 0 ⋮ 7/8 −1/8 −5/8 ]
𝑅1 → 𝑅1 + (1)𝑅3
0 0 1 ⋮ 1/16 1/16 −3/16

1 0 0 ⋮ −39/16 9/16 37/16


[𝐴 ⋮ 𝑏] = [0 1 0 ⋮ 7/8 −1/8 −5/8 ] 𝑅1 → 𝑅1 + (−4)𝑅2
0 0 1 ⋮ 1/16 1/16 −3/16

−39/16 9/16 37/16 4


𝑥 = 𝐴−1 𝑏 = [ 7/8 −1/8 −5/8 ] [15]
1/16 1/16 −3/16 1

𝑧=1 ; 𝑦=1 ; 𝑥=1 𝐴𝑛𝑠𝑤𝑒𝑟


(c)
𝑤 + 2𝑥 − 𝑦 + 𝑧 = 6
−𝑤 + 𝑥 + 2𝑦 − 𝑧 = 3
2𝑤 − 𝑥 + 2𝑦 + 2𝑧 = 14
𝑤 + 𝑥 − 𝑦 + 2𝑧 = 8
1 2 −1 1 ⋮ 1 0 0 0
−1 1 2 −1 ⋮ 0 1 0 0
[𝐴 ⋮ 𝑏] = [ ]
2 −1 2 2 ⋮ 0 0 1 0
1 1 −1 2 ⋮ 0 0 0 1

1 2 −1 1 ⋮ 1 0 0 0 𝑅2 → 𝑅2 + (1)𝑅1
0 3 1 0 ⋮ 1 1 0 0
[𝐴 ⋮ 𝑏] = [ ] 𝑅3 → 𝑅3 + (−2)𝑅1
0 −5 4 0 ⋮ −2 0 1 0
𝑅4 → 𝑅4 + (−1)𝑅1
0 −1 0 1 ⋮ 1 0 0 1

1 2 −1 1 ⋮ 1 0 0 0
0 3 1 0 ⋮ 1 1 0 0 𝑅3 → 𝑅3 + (5/3)𝑅2
[𝐴 ⋮ 𝑏] = [ ]
0 0 17/3 0 ⋮ −1/3 5/3 1 0 𝑅4 → 𝑅4 + (1/3)𝑅2
0 0 1/3 1 ⋮ −2/3 1/3 0 1

1 2 −1 1 ⋮ 1 0 0 0
0 3 4 0 ⋮ 1 1 0 0
[𝐴 ⋮ 𝑏] = [ ] 𝑅4 → 𝑅4 + (−1/17)𝑅3
0 0 17/3 0 ⋮ −1/3 5/3 1 0
0 0 0 1 ⋮ −11/17 4/17 −1/17 1

1 2 −1 1 ⋮ 1 0 0 0 𝑅1 → (1)𝑅1
0 1 1/3 0 ⋮ 1/3 1/3 0 0 𝑅2 → (1/3)𝑅2
[𝐴 ⋮ 𝑏] = [ ]
0 0 1 0 ⋮ −1/17 5/17 3/17 0 𝑅3 → (3/17)𝑅3
0 0 0 1 ⋮ −11/17 4/17 −1/17 1 𝑅4 → (1)𝑅4

1 2 −1 0 ⋮ 28/17 −4/17 1/17 −1


𝑅3 → 𝑅3 + (0)𝑅4
0 1 1/3 0 ⋮ 1/3 1/3 0 0
[𝐴 ⋮ 𝑏] = [ ] 𝑅2 → 𝑅2 + (0)𝑅4
0 0 1 0 ⋮ −1/17 5/17 3/17 0
𝑅1 → 𝑅1 + (−1)𝑅4
0 0 0 1 ⋮ −11/17 4/17 −1/17 1

1 2 0 0 ⋮ −11/17 4/17 −1/17 −1


0 1 0 0 ⋮ 6/17 4/17 −1/17 0 𝑅2 → 𝑅2 + (−1/3)𝑅3
[𝐴 ⋮ 𝑏] = [ ]
0 0 1 0 ⋮ −1/17 5/17 3/17 0 𝑅1 → 𝑅1 + (1)𝑅3
0 0 0 1 ⋮ −11/17 4/17 −1/17 1

1 0 0 0 ⋮ 15/17 −7/17 6/17 −1


0 1 0 0 ⋮ 6/17 4/17 −1/17 0
[𝐴 ⋮ 𝑏] = [ ] 𝑅1 → 𝑅1 + (−2)𝑅2
0 0 1 0 ⋮ −1/17 5/17 3/17 0
0 0 0 1 ⋮ −11/17 4/17 −1/17 1

15/17 −7/17 6/17 −1 6


6/17 4/17 −1/17 0
𝑥 = 𝐴−1 𝑏 = [ ][ 3 ]
−1/17 5/17 3/17 0 14
−11/17 4/17 −1/17 1 8

𝑧=4 ; 𝑦=3 ; 𝑥=2 ; 𝑤=1 𝐴𝑛𝑠𝑤𝑒𝑟


Problem 4 (10 Marks)

Write a MATLAB code that first computes the inverse of MATRIX 𝐴 using Gauss-Jordan Method, and
then solves the system of linear equations by computing 𝑥 = 𝐴−1 𝑏.
clc;
clearvars;

A = [1 2 -1 1; -1 1 2 -1; 2 -1 2 2; 1 1 -1 2];
I = eye(4,4);
b = [6;3;14;8]
AI = [A I];

a21 = -1*AI(2,1)/AI(1,1);
AI(2,:) = AI(2,:) + a21*AI(1,:);

a31 = -1*AI(3,1)/AI(1,1);
AI(3,:) = AI(3,:) + a31*AI(1,:);

a41 = -1*AI(4,1)/AI(1,1);
AI(4,:) = AI(4,:) + a41*AI(1,:)

a32 = -1*AI(3,2)/AI(2,2);
AI(3,:) = AI(3,:) + a32*AI(2,:);

a42 = -1*AI(4,2)/AI(2,2);
AI(4,:) = AI(4,:) + a42*AI(2,:)

a43 = -1*AI(4,3)/AI(3,3);
AI(4,:) = AI(4,:) + a43*AI(3,:)

a44 = AI(4,4);
AI(4,:) = 1/a44*AI(4,:);

a33 = AI(3,3);
AI(3,:) = 1/a33*AI(3,:);

a22 = AI(2,2);
AI(2,:) = 1/a22*AI(2,:);

a11 = AI(1,1);
AI(1,:) = 1/a11*AI(1,:)

a34 = -1*AI(3,4)/AI(4,4);
AI(3,:) = AI(3,:) + a34*AI(4,:);

a24 = -1*AI(2,4)/AI(4,4);
AI(2,:) = AI(2,:) + a24*AI(4,:);

a14 = -1*AI(1,4)/AI(4,4);
AI(1,:) = AI(1,:) + a14*AI(4,:)

a23 = -1*AI(2,3)/AI(3,3);
AI(2,:) = AI(2,:) + a23*AI(3,:);

a13 = -1*AI(1,3)/AI(3,3);
AI(1,:) = AI(1,:) + a13*AI(3,:)

a12 = -1*AI(1,2)/AI(2,2);
AI(1,:) = AI(1,:) + a12*AI(2,:)

x=AI(:,5:end)*b

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy