You are on page 1of 6

Page 18-1

MATRIX MATH

18
1
3

ENGINEERING with the SPREADSHEET


Copyright 2006 American Society of Civil Engineers

2
4

5
6

Christy
07:44
01/31/13

-4.0
= 4.5

126992652.xls.ms_office
A

MATRIX MATH
In the Beginning
Solve three equations with three unknowns.
2x + 3y - 1z = -1
-1x + 5y + 3z = -10
3x - 1y - 6z = 5

line 1
line 2
line 3

Eliminate one of the unknowns:


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

row 20

Get another equation and eliminate x again:


2x + 3y - 1z = -1
*3
-1x + 5y + 3z = -10
-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:
*3
13y +5z = -21
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.


-1
x
3

y
-1
-1
1

z
-1
-6
6

-2
x -0.666667
x
-1
3
-3

y
-1

z
-1
-6
6
y

x
-1
3
-3

y
-1
-1
1

row 50

plane 1
0.5
y = -1
z = -1

x = -0.5
y=0
z=0

x = -1.5
y=1
z=1

plane 2
x = 1.6
y = -1
z = -1

x = 10
y=0
z=0

y = 18
y=1
z=1

plane 3
x = -0.67 x = 1.67 y = 4
y = -1
y=0
y=1
z = -1
z=0
z=1

x = -1
y=0
z = -1

x=0
y = -0.33
z=0

x=1
y = -0.67
z=1

x = -1
y = -1.6
z = -1

x=0
y = -2
z=0

x=1
y =- 2.4
z=1

x = -1
y = -2
z = -1

x = -1
y = -1
z = -4

x=0
y=0
z=1

x=1
y=1
z=6

x = -1
y = -1
z = -2

x=0
y=0
z = -3.33

x=1
y=1
z = -4.67

x = -1
x=0
x=1
y = -1
y=0
y=1
z = -1.17 z = -0.83z = -0.5

x=0
y = -5
z=0

x=1
y = -8
z=1

2
-2

z
-6

5
row 70

7
z -1.166667

row 80

Page 18-2

MATRIX MATH

18
1
3

ENGINEERING with the SPREADSHEET


Copyright 2006 American Society of Civil Engineers

2
4

5
6

Christy
07:44
01/31/13

-4.0
= 4.5

126992652.xls.ms_office
A

MATRIX SOLUTION
Note that the equations take the form of:
matrix
a11
a12
a13
a21
a22
a23
a31
a32
a33
This matrix is of order 3 x 3.
2
3
-1
5
3
-1

constants vector
A
B
C

-1
3
-6

0.87097
-0.09677
0.45161

This matrix is of order 3 x 3.


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
=minverse(B89:D91) and press [Ctrl] [Shift] [Enter] all at the
same time to get {=MINVERSE(B89:D97)} in the array of cells.
multiply the invert * constants vector

-1
-10
5

The quick solution, as explained below, is:

invert the matrix


-0.61290 -0.45161
0.29032
0.16129
-0.35484 -0.41935

constants vector
-1
-10
=
5

row 90

3 x
-2 y
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
1
4

2
5

B
2
2
3

4
5
6

A'

3
6

A
1
4

B
2
2
3

4
5
6

2
5

3
6

A'
1
2
3

4
5
6

AB
15
36

32
77

BA
18
22
27

24
29
36

A(B + C) = AB + AC

the transpose of matrix A


A
1
4

A-1

2
5

3
6

the invert of matrix A


A
20
4
6

4
34
-20

6
-20
31

Square
Matrix

1
4
7

2
5
8

3
6
9

Symetrical
Matrix

5
1
2

1
4
6

2
6
3

1
4

2
6
3

Symetrical
Matrix
also shown
as

symetrical

Diagonal
Matrix

5
0
0

0
6
0

0
0
7

Unit
Matrix

1
0
0

0
1
0

0
0
1

A-1
0.063
-0.023
-0.027

-0.023
0.056
0.041

-0.027
0.041
0.064

A-1 A = A A-1 = I
I
1
=
0
0

1x2
1x4
4x4
4x2

+
+
+
+

2x2
2x5
5x5
5x2

+
+
+
+

3 x 3 = 15
3 x 6 = 32
6 x 6 = 77
6 x 3 = 36

2x1
30 2 x 2
36 2 x 3
45 2 x 1
2x2
2x3
3x1
3x2
3x3

+
+
+
+
+
+
+
+
+

4 x 4 = 18
4 x 5 = 24
4 x 6 = 30
5 x 4 = 22
5 x 5 = 29
5 x 6 = 36
6 x 4 = 27
6 x 5 = 36
6 x 6 = 45

unitary matrix
0
1
0

0
0
1
row 130

Note:

A' is often denoted as A_ in this


manual because the range name for
A' appears as A_ in Excel. Another
notation for A' is At.
row 140

row 150

Page 18-3

MATRIX MATH

18
1
3

ENGINEERING with the SPREADSHEET


Copyright 2006 American Society of Civil Engineers

2
4

5
6

Christy
07:44
01/31/13

-4.0
= 4.5

126992652.xls.ms_office
A

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
E_2

10
85

loop 2
I_2 = 4.69 amp

R_5

Determine the current flow in each of the three


loops.
The typical use for this application is n
equations with n unknowns.

R_6

After designating the loop currents, we set up


voltage equations around each loop. The
current in R_5 is I_1 + I_2 whereas the current
in R_6 is I_2 - I_3 when referred to loop 2.

R_3
E_3

20

R_1
E_1

loop 1
I_1 = 3.95 amp

10
125

5
70
loop 3
I_3 = 4.52 amp

R_4

In this model we'll use Maxwell's Method.


row 170
1.
2.
3.

R_1 *I_1 + R_5 *(I_1 + I_2) + R4 *(I_1 + I_2) = E_1


R_2 *I_2 + R_5 *(I_3 + I_2) + R6 *(I_3 + I_2) = E_2
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
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
loop 2
loop 3

20 ohms
4
6

Laplace
expansion

20

34
-20

20
13080

654

+
sum

+
+
+

4 ohms
34
-20
-20
31
-

+
+
+

6 ohms
-20
31

4
6

-20
31

4
976

244

I_1
20
4
6

E
125
85
70
10400

I_3
6
-20
31
-20
31

20

85
70
4035

-20
31

125

4
6
244
4
6
-230

85
70

=
=
=

125 volts
85
70

row 180

row 190

4
6

34
-20

6
-1704

-284

I_1
20
4
6

I_2
4
34
-20
10400

E
125
85
70
85
70

20

34
-20
4080

85
70

4
6
-230
4
6
-284

34
-20

10400 determinant

Cramer's rule

E
125
85
70

I_2
I_3
4
6
34
-20
-20
31
10400 determinant

125

34
-20
-20
31
654 = 34 *31 --20 *-20
85
70
4035

-20
31

85
70
-4080

34
-20

+
sum I_1

6
3.95 amps

where

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

sum I_2

6
4.69 amps

sum I_3

125
4.52 amps

row 200

row 210

row 220

Page 18-4

MATRIX MATH

18
1
3

ENGINEERING with the SPREADSHEET


Copyright 2006 American Society of Civil Engineers

2
4

5
6

Christy
07:44
01/31/13

-4.0
= 4.5

126992652.xls.ms_office
A

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)
2.
R_2 *I_2 + R_5 *(I_3 + I_2) + R6 *(I_3 + I_2)
3.
R_3 *I_3 + R_6 *(I_3 + I_2) + R4 *(I_3 + I_1)

E_1
E_2
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
loop 2
R_5 *I_1 + (R_2 + R_5 + R_6) *I_2 - R_6 *I_3
loop 3
R_4 *I_1 - R_6 *I_2 + (R_3 + R_4 + R_6) *I_3

E_1
E_2
E_3

row 230
matrix
20
4
6

4 x 4 MATRIX MODEL
x1
20
x2
4
x3
6
x4
3
Laplace expansion
20

34

+
20

4
34
-20

constants vector
125
85
70

6
-20
31

Longhand Solution -- not the equation above


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

-20
31
9

14
-26
18

31
9

-26
18

-20

-20
25

-26
18

34
26928
19358

792

-20
-5800

290

minverse
0.063
-0.023
-0.027

-0.023
0.056
0.041

125
85
70
6

row 240

14

-0.027
0.041
0.064

mmult
3.95 amps
4.69 amps
4.52 amps

-20
25

31
9

14
-13370

-955

6
3

31
9

14
-546

-39

6
3

-20
25

14
2940

210

6
3

-20
25

-20
-4200

210

row 250

387160

4
6
3

-20
31
9

14
-26
18

31
9

-26
18

-20

6
3

-26
18

4
3168
6342

792

-20
-3720

186

14

row 260
+
4

+
6

+
3

25368

4
6
3

34
-20
25

14
-26
18

-20
25

-26
18

34

6
3

-26
18

4
1160
-2224

290

34
6324

186

14

row 270

-13344

4
6
3

34
-20
25

-20
31
9

-20
25

31
9

34

6
3

31
9

4
-3820
-6694

-955

34
-1326

-39

-20

row 280

-20082

sum

368530 determinant

sum

368530 using MDETERM( ) to solve for the determinate of square matrices


row 290

Page 18-5

MATRIX MATH

18
1
3

ENGINEERING with the SPREADSHEET


Copyright 2006 American Society of Civil Engineers

2
4

5
6

Christy
07:44
01/31/13

-4.0
= 4.5

126992652.xls.ms_office
A

4 x 4 MATRIX MODEL

Longhand Solution -- Continued

Cramer's rule
125
85
70
6

4
6
34
-20
-20
31
25
9
368530 determinant

3
14
-26
18

20
4
6
3

125
85
70
6
368530

6
-20
31
9

3
14
-26
18
row 300

20
4
6
3

sum x1

4
34
-20
25
368530

125
85
70
6

3
14
-26
18

-20
31
9

14
-26
18

125

34
-20
25
19358

-20
31
9

85
70
6
101856

34
-20
25

85
70
6
2686

34
-20
25

85
70
6
-133671

20
4
6
3

4
34
-20
25
368530

6
-20
31
9

125
85
70
6

-20
31
9

14
-26
18

20

85
70
6
101856

-20
31
9

14
-26
18

125

4
6
3
6342

85
70
6

14
-26
18

4
6
3
-12582

85
70
6

-20
31
9

4
6
3
8571

14
-26
18

14
-26
18

-20
31
9

6.59

sum x2

row 310

row 320

3.10
row 330

sum x3

85
70
6

20

34
-20
25
-2686

85
70
6

4
6
3
-12582

34
-20
25

125

4
6
3
-2224

34
-20
25

4
6
3
16286

-0.90

14
-26
18

-20
31
9

85
70
6

20

34
-20
25
-133671

-20
31
9

85
70
6

4
6
3
-8571

34
-20
25

85
70
6

4
6
3
16286

34
-20
25

-20
31
9

125

4
6
3
-6694

14
-26
18

14
-26
18

85
70
6

sum x4

row 340

row 350

-4.63

row 360

Page 18-6

MATRIX MATH

18
1
3

ENGINEERING with the SPREADSHEET


Copyright 2006 American Society of Civil Engineers

2
4

5
6

Christy
07:44
01/31/13

-4.0
= 4.5

126992652.xls.ms_office
A

4 x 4 MATRIX MODEL Using MDETERM


x1
20
4
6
x2
4
34
-20
x3
6
-20
31
x4
3
25
9
determ

3
14
-26
18

125
85
70
6

368530
34
-20
25
125

-20
31
9
19358

14
-26
18
6.57

85
70
6
20

-20
31
9
101856

14
-26
18
5.53

34
-20
25
20

85
70
6
-2686

14
-26
18
-0.15

34
-20
25
20

-20
31
9
-133671

85
70
6
-7.25

85
70
6
4

-20
31
9
101856

14
-26
18
1.11

4
6
3
125

-20
31
9
6342

14
-26
18
2.15

4
6
3
4

85
70
6
-12582

14
-26
18
-0.14

4
6
3
4

-20
31
9
-8571

85
70
6
-0.09

85
70
6
6

34
-20
25
2686

14
-26
18
0.04

4
6
3
6

85
70
6
-12582

14
-26
18
-0.20

4
6
3
125

34
-20
25
-2224

14
-26
18
-0.75

4
6
3
6

34
-20
25
16286

85
70
6
0.27

85
70
6
3

34
-20
25
-133671

-20
31
9
-1.09

4
6
3
3

85
70
6
8571

-20
31
9
0.07

4
6
3
3

34
-20
25
16286

85
70
6
0.13

4
6
3
125

34
-20
25
-6694

-20
31
9
-2.27

6.59

4 x 4 MATRIX MINVERSE and MMULT Excel Method


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

3.10

125
85
70
6

20 year old reference books refer to inverting a matrix as computer intensive.


Now, on a common personal computer, the inversion process is transparent.

-0.90

minverse
0.0525
-0.0172
-0.0060
0.0182

0.0039
0.0396
-0.0154
-0.0480

row 370

row 380

-4.63

-0.0030
0.0261
0.0139
-0.0427

-0.0161
0.0097
0.0331
0.0282

row 390

mmult
6.59
3.10
-0.90
-4.63
row 400

row 410

row 420

row 430

You might also like