You are on page 1of 12

NUMERICAL SOLUTIONS FOR CE

PROBLEMS
LECTURE 2
ENGR. RYAN KIM LAGADIA
MATRIX OPERATION
Note:
ADDITION You can only perform additional and subtraction to
the matrix with same number of Column and Row.
Mat A Mat B Mat C
C1 C2 C3

R1 5 0 -5 -9 8 2 -4 8 -3 Example no. 1
Addition
R2 8 -1 3 + 5 6 6 = 13 5 9
Mat A (C1R1) + Mat B C1R1 = Mat C (C1R1)
R3 6 2 9 -1 0 5 5 2 14
Mat A (5) + Mat B (-9) = Mat C (-4)

SUBTRACTION
Mat A Mat B Mat C
C1 C2 C3

R1 5 0 -5 -9 8 2 14 -8 -7 Example no. 2
Addition
R2 8 -1 3 - 5 6 6 = 3 -7 -3 Mat A (C1R1) - Mat B C1R1 = Mat C (C1R1)
Mat A (5) - Mat B (-9) = Mat C (14)
R3 6 2 9 -1 0 5 7 2 4
MATRIX OPERATION
MULTIPLICATION
Example no. 1
Mat A Mat B Mat C
C1 C1 C2 C3

R1 3 R1

?
C1 C2 C3
Note: To perform multiplication, number of
R2 -1 x R1 1 0 -2 = R2 column of Matrix A must be same as row of
Matrix B or vice versa.
R3 2 R3

Solution:
C1 C2 C3
C1 C2 C3 C1 C2 C3

R1
A(C1XR1) x
B(C1R1)
A(C1R1) x
B(C2R1)
A(C1R1) x
B(C3R1)
R1 3x1 3x0 3x-2 R1 3 0 -6

R2
A(C1R2) x
B(C1R1)
A(C1R2) x
B(C2R1)
A(C1R2) x
B(C3R1)
R2 -1x1 -1x0 -1x-2 R2 -1 0 2

R3
A(C1R3) x
B(C1R1)
A(C1R3) x
B(C2R1)
A(C1R3) x
B(C3R1)
R3 2x1 2x0 2x-2 R3 2 0 -4
MATRIX OPERATION
MULTIPLICATION
Example no. 2
Mat A Mat B Mat C
C1 C2 C1 C2 C3 C1 C2 C3

R1 5 9 R1 6
C1
5
C2
3C3 R1

?
R1 6 5 3 Note: To perform multiplication, number of
R2 8 -5 x R2

R2
0
0
-1
-1
2
2
= R2 column of Matrix A must be same as row of
Matrix B or vice versa.
R3 1 -6 R3

Solution:
Mat C Mat C C1
Mat
C2
C C3
C1 C2 C3 C1 C2 C3

R1
A(C1R1) x B(C1R1) +
A(C2R1) x B(C1R2)
A(C1R1) x B(C2R1) +
A(C2R1) x B(C2R2)
A(C1R1) x B(C3R1) +
A(C2R1) x B(C3R2)
R1 5X6 + 9X0 5X5 + 9X-1 5X3 + 9X2 R1 30 16 33
A(C1R2) x B(C1R1) + A(C1R2) x B(C2R1) + A(C1R2) x B(C3R1) +
R2
A(C2R2) x B(C1R2) A(C2R2) x B(C2R2) A(C2R2) x B(C3R2)
R2 8X6 + -5X0 8X5 + -5X-1 8X3 + -5X2 R2 48 45 14
A(C1R3) x B(C1R1) + A(C1R3) x B(C2R1) + A(C1R3) x B(C3R1) +
R3
A(C2R3) x B(C1R2) A(C2R3) x B(C2R2) A(C2R3) x B(C3R2)
R3 1X6 + -6X0 1X5 + -6X-1 1X3 + -6X2 R3 6 11 -9
MATRIX OPERATION Note:
Basket Method is the easiest way to solve for
METHODS OF EVALUATING DETERMINANT determinants, this is perform by:
1. BY BASKET METHOD 1. Add the Column 1 and Column 2 at the right side
of the matrix resulting to have a new matrix with 5
C1 C2 C3 C1 C2 C1 C2 C3 C1 C2
columns and 3 Row.
R1
a 11 a 12 a 13 a 11 a 12
R1
a 11 a 12 a 13 a 11 a 12
2. Add a 3 imaginary diagonal lines downwards and 3
imaginary diagonal lines upward as you can see in
R2
a 21 a 22 a 23 a 21 a 22
R2
a 21 a 22 a 23 a 21 a 22
the left.
3. Add the product of the 3 downwards diagonal lines.
R3
a 31 a 32 a 33 a 31 a 32
R3
a 31 a 32 a 33 a 31 a 32
Then subtract it to sum of the product of the 3
upward diagonal lines.

/A/ = (a11xa22xa33+a12xa23xa31+ a13xa21xa32) – (a31xa22xa13+a32xa23xa11+ a33xa21xa12)


Example no. 1
Find the determinant of the matrix: Solution:
C1 C2 C3 C1 C2
C1 C2 C3

R1
1 0 -2
R1
1 0 -2 1 0 /A/ = (1x2x1 + 0x5x-3 + -2x4x-2) –
(-3x2x-2 + -2x5x1 + 1x4x0)
A= R2
4 2 5 R2
4 2 5 4 2
-3 -2 1
/A/ = 16
R3
R3
-3 -2 1 -3 -2
MATRIX OPERATION
METHODS OF EVALUATING DETERMINANT
2. BY CHIO’S METHOD
C1 C2 C3

R1
a 11 a 12 a 13 a 11 a 12 a 11 a 13
a (a ) -
11 22 a (a ) -
11 23

A A
=
11 12

A= R2
a 21 a 22 a 23 a 21 a 22 a 21 a 23 a (a )
21 12 a (a )
21 13

a a a
= = A11(A12) - A11(A12) =/D/
R3 31 32 33
a 11 a 12 a 11 a 13
a (a ) -
11 32 a (a ) -
11 33

A21 A22

a 31 a 32 a 31 a 33 a (a )
31 12 a (a )
31 13

Example no. 1
C1 C2 C3

R1
1 0 -2 1 0 1 -2
1(2) - 4(0) 1(5) - 4(-2) 2 13
A= R2
4 2 5 = 4 2 4 5

R3 -3 -2 1 1 0 1 -2
= = = 2(-5) - (-2)(13) = 16
1(-2) - (-3)(0) 1(1) - (-3)(-2) -2 -5
-3 -2 -3 1
/D/ = 16
MATRIX OPERATION Steps:
1. Set pivot. Always choose “1”.
METHODS OF EVALUATING DETERMINANT 2. Cross out (highlight) the row and
column of the pivotal element.
3. BY PIVOTAL METHOD 3. To solve for the new matrix, use the
formula x= a - (row)(column).
Example no. 1 C1 C2 C3 C4
C1 C2 C3 C4

R1
1 0 4 -6 R1
1 0 4 -6
5 - 0(2) 0 - 4(2) 3 - (-6)(2) 5 -8 15
R2
2 5 0 3 R2
2 5 0 3 Note:
2 - 0(-1) 3 - 4(-1) 5 - (-6)(-1) 2 7 -1 If matrix has no “1” we
R3
-1 2 3 5 R1
-1 2 3 5 must make one.
1 - 0(2) -2 - 4(2) 3 - (-6)(2) 1 -10 15
R4
2 1 -2 3 R3
2 1 -2 3

Since the matrix has two “1” you can


choose between the two.

C1 C2 C1 C2
5 -8 15
R1
-8 - (-10)(5) 15 - 15(5) R1
42 -60
2 7 -1 /A/ = 42(-31)-27(-60) = 318
R2
7 - (-10)(2) -1 - 15(2) R2
27 -31
1 -10 15
SOLVING SYSTEM OF LINEAR EQUATIONS
CRAMER’S RULE METHOD Note:
Example no. 1 To solve for x, y, z, you must used the formula:
/Dx/ /Dy/ /Dz/
Solve for x, y, and z using Cramer’s Rule x= y= z=
/D/ /D/ /D/

x y z rhs
2x+y-z=1 a 1 x b 1 x c1 x d 1 b 2 c2 a 2 c2 a 2 b2
/D/=a1 - b1 + c1
3x+2y+2z=13 a 2 x b 2 x c2 x d 2 b 3 c3 a 3 c3 a 3 b3
4x-2y+3z=9 a 3 x b 3 x c3 x d 3

x y z
2 1 -1 2 2 3 2 3 2
/D/ = 2 -1 + -1
3 2 2 -2 3 4 3 4 -2
4 -2 3 /D/ = 2(2x3 - -2x2) - 1(3x3 - 4x2) + -1(3x-2 - 4x2)
/D/ = 33
SOLVING SYSTEM OF LINEAR EQUATIONS
CRAMER’S RULE METHOD
rhs y z
1 1 -1 2 2 13 2 13 2
/Dx/ = 1 -1 + -1 /𝐃𝐱/ 𝟑𝟑
13 2 2 -2 3 9 3 9 -2 𝐱= = =𝟏
/𝐃/ 𝟑𝟑
𝐱=𝟏
9 -2 3 /Dx/ = 1(2x3 - -2x2) - 1(13x3 - 9x2) + -1(13x-2 - 9x2)
/Dx/ = 33
x rhs z
2 1 -1 13 2 3 2 3 13 /𝐃𝐲/ 𝟔𝟔
/Dy/ = 2 -1 + -1 𝒚= = =𝟐
3 13 2 9 3 4 3 4 9 /𝐃/ 𝟑𝟑
𝐲=𝟐
4 9 3 /Dy/ = 2(13x3 - 9x2) - 1(3x3 - 4x2) + -1(3x9 - 4x13)
/Dy/ = 66
x y rhs
2 1 1 2 13 3 13 3 2 /𝐃𝐳/ 𝟗𝟗
/Dz/ = 2 -1 + -1 𝐳= = =𝟑
3 2 13 -2 9 4 9 4 -2 /𝐃/ 𝟑𝟑
𝐳=𝟑
4 -2 9 /Dz/ = 2(2x9 - -2x13) - 1(3x9 - 4x13) + -1(3x-2 - 4x2)
/Dz/ = 99
SOLVING SYSTEM OF LINEAR EQUATIONS
GAUSSIAN ELIMINATION
Example no. 1
Solve for x, y, and z using Gaussian Elimination
x y z rhs x y z rhs
=𝟐
x+y-z=-2 1 1 -1 -2 1 1 -1 -2 NR1 = OR1

2x-y+z=5 2 -1 1 5 2-2(1) -1-2(1) 1-2(-1) 5-2(-2) NR2 = OR2-2OR1


𝒚 = 𝟑
-x+2y+2z=1 -1 2 2 1 -1+1 2+1 2+(-1) 1+(-2) NR3 = OR3 + OR1 𝒚 𝟐= 𝟑
+
1 1 -1 -2 1 1 -1 -2 NR1 = OR1 𝒚 = 𝟏
1 0 -3 3 9 0 -3 3 9 NR2 = OR2 𝒚= 𝟏

0 3 1 -1 0+0 3+(-3) 1+3 -1+9 NR3 = OR3+NR2


𝒚 = 𝟐
1 1 -1 -2 1 1 -1 -2 NR1 = OR1 𝟏 𝟐= 𝟐
𝟏
2 0 -3 3 9 -1/3*(0) -1/3*(-3) -1/3*(3) -1/3 (9) NR2 = - 𝟑 OR2 𝟑= 𝟐

0 0 4 8 1/4*(0) 1/4*(0) 1/4*(4) 1/4*(8) NR3 =


𝟏
OR3
+ 3
= 𝟏

1 1 -1 -2 = 𝒚 = 𝟐 =𝟏

3 0 1 -1 -3 = 𝒚 = 𝟑

0 0 1 2 = =𝟐
SOLVING SYSTEM OF LINEAR EQUATIONS
GAUSS-JORDAN ELIMINATION
Example no. 1
Solve for x, y, and z using Gauss-Jordan Elimination

x+y-z=7 x y z rhs x y z rhs


x-y+2z=3 1 1 -1 7 1 1 -1 7 NR1 = OR1
2x+y+z=9 1 -1 2 3 1-1 1--1 -1-2 7-3 NR2 =OR1-OR2
2 1 1 9 2 1.00 1 9 NR3 = OR3

Note:
1 1 -1 7 1 1 -1 -2 NR1 = OR1
NR= New Row 1 0 2 -3 4 0 2 -3 4 NR2 = OR2
OR = Old Row
2 1 1 9 -2(1)+2 -2(1)+1 -2(-1)+1 9-2(-2) NR3 = -2OR1+OR3

1 1 -1 7 1 1 -1 -2 NR1 = OR1
2 0 2 -3 4 0 2 -3 4 NR2 = OR2
0 -1 3 -5 0+2(0) 2+2(-1) 3+2(1) 4+2(-5) NR3 =OR2+2OR3
SOLVING SYSTEM OF LINEAR EQUATIONS
GAUSSIAN ELIMINATION
1 1 -1 7 3(1)-0 3(1)-2 3(-1)-3 3(7)-4 NR1 = 3OR1-OR2
3 0 2 -3 4 0 2 -3 4 NR2 = OR2
0 0 3 -6 0 0 3 -6 NR3 =OR3

3 1 0 17 3 1 0 17 NR1 = OR1
1 0 0 6 x=6
4 0 2 -3 4 0+0 2+0 -3+3 4+-6 NR2 = OR2+OR3
7 0 1 0 -1 y = -1
0 0 3 -6 0 0 3 -6 NR3 =OR3
0 0 1 -2 z = -2
3 1 0 17 2(3)-0 2(1)-2 2(0)-0 2(17)--2 NR1 = 2OR1-OR2
5 0 2 0 -2 0 2 0 -2 NR2 = OR2
0 0 3 -6 0 0 3 -6 NR3 =OR3

6 0 0 36 (1/6)(6) (1/6)(0) (1/6)(0) (1/6)(36) NR1 = (1/6)OR1


6 0 2 0 -2 (1/2)(0) (1/2)(2) (1/2)(0) (1/2)(-2) NR2 = (1/2)OR2
0 0 3 -6 (1/3)(0) (1/3)(0) (1/3)(3) (1/3)(-6) NR3 =(1/3)OR3

1 0 0 6 x=6

You might also like