You are on page 1of 12

Page 18-1

MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N
MATRIX MATH
In the Beginning
Solve three equations with three unknowns.

2x + 3y - 1z = -1 line 1
-1x + 5y + 3z = -10 line 2
3x - 1y - 6z = 5 line 3

Eliminate one of the unknowns:


2x + 3y - 1z = -1 *1 2x + 3y - 1z = -1 row 20
-1x + 5y + 3z = -10 *2 -2x + 10y + 6z = -20
3x - 1y - 6z = 5
add to get: 13y +5z = -21

Get another equation and eliminate x again:


2x + 3y - 1z = -1
-1x + 5y + 3z = -10 *3 -3x + 15y + 9z = -30
3x - 1y - 6z = 5 *1 3x - 1y - 6z = 5
add to get: 14y + 3z = -25
row 30
Combine the two equations with two unknowns:
13y +5z = -21 *3 39y +15z = -63
14y + 3z = -25 *5 70y + 15z = -125
subtract to get: 31y = -62
and: y = -2

Solve for z:
13y +5z = -21 13 * -2 +5z = -21
and: z = 1
row 40
To get x:
2x + 3y - 1z = -1 2x + 3 * -2 - 1 * 1 = -1
to get: x = 3 Figure 18-1 The common point of intersecting planes.

These equations each create a family of lines. All of the lines lay within a single
plane as determined by that particular equation. The three planes created by the
equations intersect at a single, finite point.

The following calculations are used to plot the equations in AutoCad. row 50

-1 plane 1 plane 2 plane 3


x y z 0.5 x = -0.5 x = -1.5 x = 1.6 x = 10 y = 18 x = -0.67 x = 1.67 y = 4
-1 -1 y = -1 y=0 y=1 y = -1 y=0 y=1 y = -1 y=0 y=1
3 -1 -6 5 z = -1 z=0 z=1 z = -1 z=0 z=1 z = -1 z=0 z=1
1 6
-2 x = -1 x=0 x=1 x = -1 x=0 x=1 x = -1 x=0 x=1
x -0.666667 y=0 y = -0.33 y = -0.67 y = -1.6 y = -2 y =- 2.4 y = -2 y = -5 y = -8
z = -1 z=0 z=1 z = -1 z=0 z=1 z = -1 z=0 z=1
x y z
-1 -1 x = -1 x=0 x=1 x = -1 x=0 x=1 x = -1 x=0 x=1
3 -1 -6 5 y = -1 y=0 y=1 y = -1 y=0 y=1 y = -1 y=0 y=1
-3 6 z = -4 z=1 z=6 z = -2 z = -3.33 z = -4.67 z = -1.17 z = -0.8 z = -0.5
2
y -2

x y z
-1 -1
3 -1 -6 5
-3 1 row 70
7
z -1.166667
Page 18-2
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N

row 80
Page 18-3
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N
MATRIX SOLUTION
Note that the equations take the form of:
matrix constants vector
a11 a12 a13 A This matrix is of order 3 x 3.
a21 a22 a23 B
a31 a32 a33 C To enter a matrix array: use your cursor to outline an area in
the shape of the array you want. Enter a formula such as
This matrix is of order 3 x 3. =minverse(B89:D91) and press [Ctrl] [Shift] [Enter] all at the
2 3 -1 -1 same time to get {=MINVERSE(B89:D97)} in the array of cells.
-1 5 3 -10 multiply the invert * constants vector row 90
3 -1 -6 5

The quick solution, as explained below, is: invert the matrix constants vector
0.87097 -0.61290 -0.45161 -1 3 x
-0.09677 0.29032 0.16129 x -10 = -2 y
0.45161 -0.35484 -0.41935 5 1 z

A matrix is a rectangular array of numbers which are called elements.


Rows are the first number, columns the second number.
Brackets are sometimes omitted. row 100

A single row matrix is refereed to as a "row" or vector matrix.


A single column matrix is referred to as a "column" or vector matrix.
Matrices can be multiplied if matrix A has the same number of rows as matrix B has columns.
Note that: AB BA AB = C BA C ABC = (AB)C = A(BC) A(B + C) = AB + AC

A B AB 1x2 + 2x2 + 3 x 3 = 15
1 2 3 2 4 = 15 32 1x4 + 2x5 + 3 x 6 = 32
4 5 6 X 2 5 36 77 4x4 + 5x5 + 6 x 6 = 77
3 6 4x2 + 5x2 + 6 x 3 = 36

B A BA 2x1 + 4 x 4 = 18
2 4 1 2 3 = 18 24 30 2 x 2 + 4 x 5 = 24
2 5 X 4 5 6 22 29 36 2 x 3 + 4 x 6 = 30
3 6 27 36 45 2 x 1 + 5 x 4 = 22
2x2 + 5 x 5 = 29
A' the transpose of matrix A 2x3 + 5 x 6 = 36
A A' 3x1 + 6 x 4 = 27
1 2 3 1 4 3x2 + 6 x 5 = 36
4 5 6 2 5 3x3 + 6 x 6 = 45
3 6

A-1 the invert of matrix A A-1 A = A A-1 = I unitary matrix


A A-1 I
20 4 6 0.063 -0.023 -0.027 1 0 0
4 34 -20 X -0.023 0.056 0.041 = 0 1 0
6 -20 31 -0.027 0.041 0.064 0 0 1

Square 1 2 3 row 130


Matrix 4 5 6
7 8 9
Symetrical 5 1 2
Matrix 1 4 6
2 6 3 Note: A' is often denoted as A_ in this
manual because the range name for
Symetrical 5 1 2 A' appears as A_ in Excel. Another
Matrix 4 6 notation for A' is At.
also shown symetrical 3 row 140
as
Diagonal 5 0 0
Matrix 0 6 0
0 0 7

Unit 1 0 0
Page 18-4
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N
Matrix 0 1 0
0 0 1
row 150
Page 18-5
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N
3 x 3 MATRIX -- Circuit Anaylsis, Longhand Matrix Solution
See the chapter Quadratic and Cubic Equations for the
2 x 2 matrix solution of two straight lines.

This example includes the longhand solution as well


as Excel's minverse and mmult functions. R_2 10 loop 2
E_2 85 I_2 = 4.69 amp R_5 4
Determine the current flow in each of the three
loops.
R_1 10
The typical use for this application is n R_6 20 loop 1 E_1 125
equations with n unknowns. I_1 = 3.95 amp

After designating the loop currents, we set up


voltage equations around each loop. The R_3 5
current in R_5 is I_1 + I_2 whereas the current E_3 70
in R_6 is I_2 - I_3 when referred to loop 2. loop 3 R_4 6
I_3 = 4.52 amp
In this model we'll use Maxwell's Method.
row 170
1. R_1 *I_1 + R_5 *(I_1 + I_2) + R4 *(I_1 + I_2) = E_1
2. R_2 *I_2 + R_5 *(I_3 + I_2) + R6 *(I_3 + I_2) = E_2
3. R_3 *I_3 + R_6 *(I_3 + I_2) + R4 *(I_3 + I_1) = E_3
Figure 18-2 Circuit analysis with a 3 x 3 matrix.

Note: the underbar _ in R_1 is an easy way to show the symbol


Collect the coefficients of unknowns. as a three character variable and makes it easy to create range
loop 1 (R_1 + R_4 + R_5) *I_1 + R_5 *I_2 + R_4 *I_3 = E_1 names with Insert Name Create. Using the symbols R2 or R2, will
loop 2 R_5 *I_1 + (R_2 + R_5 + R_6) *I_2 - R_6 *I_3 = E_2 create range names that are also cell addresses -- not good.
loop 3 R_4 *I_1 - R_6 *I_2 + (R_3 + R_4 + R_6) *I_3 = E_3 row 180
The cells in a matrix array may contain equations
which reference other inputs or equations.
The matrix for these equations is: A x X =R
(R_1+R_4+R_5) *I_1 + R_5 *I_2 + R_4 *I_3 = E_1
R_5 *I_1 + (R_2+R_5+R_6) *I_2 + - R_6 *I_3 = E_2
R_4 *I_1 + - R_6 *I_2 + (R_3+R_4+R_6) *I_3 = E_3

loop 1 20 ohms + 4 ohms + 6 ohms = 125 volts


loop 2 4 + 34 + -20 = 85
loop 3 6 + -20 + 31 = 70 row 190

Laplace 20 34 -20 4 4 -20 6 4 34


expansion -20 31 6 31 6 -20

+ 20 654 - 4 244 + 6 -284


13080 976 -1704

sum 10400 determinant

Cramer's rule E I_2 I_3 I_1 E I_3 I_1 I_2 E row 200
125 4 6 20 125 6 20 4 125
85 34 -20 4 85 -20 4 34 85
70 -20 31 6 70 31 6 -20 70
10400 determinant 10400 10400

34 -20 85 -20 34 85
-20 31 70 31 -20 70
+ 125 654 = 34 *31 --20 *-20 20 4035 20 4080

85 -20 4 -20 4 85 row 210


70 31 6 31 6 70
- 4 4035 125 244 4 -230

85 34 4 85 4 34
70 -20 6 70 6 -20
+ 6 -4080 6 -230 125 -284
sum I_1 3.95 amps sum I_2 4.69 amps sum I_3 4.52 amps
Page 18-6
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N

where 3.95 = (125 *654 - 4 *4,035 +6 *-4,080) / 10,400


row 220
Page 18-7
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N
3 x 3 MATRIX MINVERSE and MMULT Excel Method
1. R_1 *I_1 + R_5 *(I_1 + I_2) + R4 *(I_1 + I_2) E_1
2. R_2 *I_2 + R_5 *(I_3 + I_2) + R6 *(I_3 + I_2) E_2
3. R_3 *I_3 + R_6 *(I_3 + I_2) + R4 *(I_3 + I_1) E_3

Collect the coefficients of unknowns.


loop 1 (R_1 + R_4 + R_5) *I_1 + R_5 *I_2 + R_4 *I_3 E_1
loop 2 R_5 *I_1 + (R_2 + R_5 + R_6) *I_2 - R_6 *I_3 E_2
loop 3 R_4 *I_1 - R_6 *I_2 + (R_3 + R_4 + R_6) *I_3 E_3
row 230
matrix constants vector minverse mmult
20 4 6 125 0.063 -0.023 -0.027 3.95 amps
4 34 -20 85 -0.023 0.056 0.041 4.69 amps
6 -20 31 70 -0.027 0.041 0.064 4.52 amps

4 x 4 MATRIX MODEL Longhand Solution -- not the equation above


x1 20 4 6 3 125
x2 4 34 -20 14 85
x3 6 -20 31 -26 70 row 240
x4 3 25 9 18 6
Laplace expansion
20 34 -20 14
-20 31 -26
25 9 18

34 31 -26 -20 -20 -26 14 -20 31


9 18 25 18 25 9

+ 34 792 - -20 290 + 14 -955 row 250


26928 -5800 -13370
20 19358 = 387160

4 4 -20 14
6 31 -26
3 9 18

4 31 -26 -20 6 -26 14 6 31


9 18 3 18 3 9
row 260
+ 4 792 - -20 186 + 14 -39
3168 -3720 -546
4 6342 = 25368

6 4 34 14
6 -20 -26
3 25 18

4 -20 -26 34 6 -26 14 6 -20


25 18 3 18 3 25 row 270

+ 4 290 - 34 186 + 14 210


1160 6324 2940
6 -2224 = -13344

3 4 34 -20
6 -20 31
3 25 9

4 -20 31 34 6 31 -20 6 -20 row 280


25 9 3 9 3 25

+ 4 -955 - 34 -39 + -20 210


-3820 -1326 -4200
3 -6694 = -20082
sum 368530 determinant
Page 18-8
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N

sum 368530 using MDETERM( ) to solve for the determinate of square matrices
row 290
Page 18-9
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N
4 x 4 MATRIX MODEL Longhand Solution -- Continued

Cramer's rule
125 4 6 3 20 125 6 3
85 34 -20 14 4 85 -20 14
70 -20 31 -26 6 70 31 -26
6 25 9 18 3 6 9 18
368530 determinant 368530
row 300

20 4 125 3 20 4 6 125
4 34 85 14 4 34 -20 85
6 -20 70 -26 6 -20 31 70
3 25 6 18 3 25 9 6
368530 368530

34 -20 14 85 -20 14
-20 31 -26 70 31 -26 row 310
25 9 18 6 9 18
+ 125 19358 20 101856

85 -20 14 4 -20 14
70 31 -26 6 31 -26
6 9 18 3 9 18
- 4 101856 125 6342

85 34 14 4 85 14
70 -20 -26 6 70 -26 row 320
6 25 18 3 6 18
+ 6 2686 6 -12582

85 34 -20 4 85 -20
70 -20 31 6 70 31
6 25 9 3 6 9
- 3 -133671 3 8571

sum x1 6.59 sum x2 3.10


row 330

34 85 14 34 -20 85
-20 70 -26 -20 31 70
25 6 18 25 9 6
20 -2686 20 -133671

4 85 14 4 -20 85
6 70 -26 6 31 70 row 340
3 6 18 3 9 6
4 -12582 4 -8571

4 34 14 4 34 85
6 -20 -26 6 -20 70
3 25 18 3 25 6
125 -2224 6 16286

4 34 85 4 34 -20
6 -20 70 6 -20 31 row 350
3 25 6 3 25 9
3 16286 125 -6694

sum x3 -0.90 sum x4 -4.63


Page 18-10
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N

row 360
Page 18-11
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N
4 x 4 MATRIX MODEL Using MDETERM
x1 20 4 6 3 125
x2 4 34 -20 14 85
x3 6 -20 31 -26 70
x4 3 25 9 18 6

determ 368530

34 -20 14 85 -20 14 34 85 14 34 -20 85


-20 31 -26 70 31 -26 -20 70 -26 -20 31 70 row 370
25 9 18 6 9 18 25 6 18 25 9 6
125 19358 6.57 20 101856 5.53 20 -2686 -0.15 20 -133671 -7.25

85 -20 14 4 -20 14 4 85 14 4 -20 85


70 31 -26 6 31 -26 6 70 -26 6 31 70
6 9 18 3 9 18 3 6 18 3 9 6
4 101856 1.11 125 6342 2.15 4 -12582 -0.14 4 -8571 -0.09

85 34 14 4 85 14 4 34 14 4 34 85
70 -20 -26 6 70 -26 6 -20 -26 6 -20 70 row 380
6 25 18 3 6 18 3 25 18 3 25 6
6 2686 0.04 6 -12582 -0.20 125 -2224 -0.75 6 16286 0.27

85 34 -20 4 85 -20 4 34 85 4 34 -20


70 -20 31 6 70 31 6 -20 70 6 -20 31
6 25 9 3 6 9 3 25 6 3 25 9
3 -133671 -1.09 3 8571 0.07 3 16286 0.13 125 -6694 -2.27

6.59 3.10 -0.90 -4.63 row 390

4 x 4 MATRIX MINVERSE and MMULT Excel Method minverse mmult


20 4 6 3 125 0.0525 0.0039 -0.0030 -0.0161 6.59
4 34 -20 14 85 -0.0172 0.0396 0.0261 0.0097 3.10
6 -20 31 -26 70 -0.0060 -0.0154 0.0139 0.0331 -0.90
3 25 9 18 6 0.0182 -0.0480 -0.0427 0.0282 -4.63

20 year old reference books refer to inverting a matrix as computer intensive. row 400
Now, on a common personal computer, the inversion process is transparent.

row 410

row 420
Page 18-12
MATRIX MATH
18
Christy
02:10
07/06/17

1 2 5 -4.0
ENGINEERING with the SPREADSHEET 3 4 6 = 4.5
Copyright 2006 American Society of Civil Engineers 359756822.xls

A B C D E F G H I J K L M N

row 430

You might also like