Cramer's Rule

advertisement
ECE 221
Electric Circuit Analysis I
Chapter 6
Cramer’s Rule
Herbert G. Mayer, PSU
Status 11/14/2014
For use at Changchun University of Technology CCUT
1
Syllabus






Motivation
Steps for Cramer’s Rule
Cramer’s Rule: ∆
Cramer’s Rule: Numerator Ni
Cramer’s Rule: Solve for xi
Sample Problem
2
Motivation
 Circuit analysis involves solution of multiple (n)
linear equations
 One way to solve is via substitution
 Which becomes tedious and highly error-prone,
once n is interestingly large
 Engineering calculators often provide built-in
solution, a method internally using Cramer’s Rule
 Yet future engineers in China must understand the
method first; then they should use a calculator 
 First you must learn to use determinants to solve i =
1..n unknowns xi in a set of n linear equations
 Requirement: n independent equations for n
independent unknowns xi
3
Cramer’s Rule Solving Unknowns xi
∆ is the Characteristic Determinant, used in
every equation in the denominator of xi
N i are the numerators for xi
Then for each xi its equation is: xi = N i / ∆
x1 = N1 / ∆
x2 = N2 / ∆
x3 = N3 / ∆
4
Steps for Cramer’s Rule
 To start, normalize: Order all equations by
index of the unknowns xi to be computed
 Requires and ends up being a square matrix!
 If any unknown xi does not occur in an
equation, insert it with constant factor ci,j = 0
 Compute the characteristic determinant ∆ for
the denominator
 And then, for each unknown xi compute its
associated numerator determinant Ni
 Finally solve for all xi
xi = N i / ∆
5
Steps for Cramer’s Rule
 Counting of rows and columns starts at 1;
not at 0, not like the first index of C or C++
arrays!
 The unknowns xi are to be computed
 Constants in each row i that multiply each
unknown xj in column j are shown as ci,j
 The right hand side of = forms a separate
column vector of result values Ri
6
Equations for Cramer’s Rule, With n=3
The 3 unknowns xi to be computed are x1 x2 x3
x1 * c1,1 + x2 * c1,2 + x3 * c1,3 = R1
x1 * c2,1 + x2 * c2,2 + x3 * c2,3 = R2
x1 * c3,1 + x2 * c3,2 + x3 * c3,3 = R3
7
Cramer’s Rule: ∆
 Write the characteristic determinant ∆ by
listing only and all coefficients ci,j in the n
rows and n columns
 Then write the single column for the
vertical Results vector R
∆ =
|c1,1
|c2,1
|c3,1
c1,2
c2,2
c3,2
c1,3|
c2,3|
c3,3|
[R]=
8
| R1|
| R2|
| R3|
Cramer’s Rule: ∆
 Pick an arbitrary column, e.g. column 1, then remove one
of its elements ci,1 i=1..n at a time, starting with row 1
 Generate the next minor matrix, by eliminating the whole
rowi and columnj, initially j = 1; etc. for all rows 1..n
 Multiply the remaining minor matrix by that constant ci,1
and by its sign; sign = (-1)row+col here = (-1)i+1
∆
∆
= c1,1
=
|c2,2
c2,3| - c2,1
|c1,2 c1,3| + c3,1 |c1,2 c1,3|
|c3,2
c3,3|
|c3,2 c3,3|
c1,1 * ( c2,2 * c3,3 - c3,2 * c2,3 )
-
c2,1 * ( c1,2 * c3,3 - c3,2 * c1,3 )
+
c3,1 * ( c1,2 * c2,3 - c2,2 * c1,3 )
9
|c2,2 c2,3|
Cramer’s Rule: Numerator Ni = N1
 Starting with characteristic Determinant ∆
 Replace ith column for computing xi, and replace that
column by result vector [R]; so for x1 we generate:
|R1
N1 = |R2
|R3
c1,2
c2,2
c3,2
c1,3|
c2,3|
c3,3|
N1 =
R1
N1 =
R1* ( c2,2 * c3,3 - c3,2* c2,3 )
-
R2* ( c1,2 * c3,3 - c3,2* c1,3 )
+
R3* ( c1,2 * c2,3 – c2,2* c1,3 )
|c2,2 c2,3| - R2 |c1,2 c1,3| + R3
|c3,2 c3,3|
|c3,2 c3,3|
10
|c1,2 c1,3|
|c2,2 c2,3|
Cramer’s Rule: Numerator N2
N2
|c1,1 R1 c1,3|
= |c2,1 R2 c2,3|
|c3,1 R3 c3,3|
N2 =
c1,1
|R2 c2,3| - c2,1
|R3 c3,3|
|R1 c1,3| + c3,1 |R1 c1,3|
|R3 c3,3|
|R2 c2,3|
N2 =
c1,1 * ( R2 * c3,3 - R3* c2,3 )
- c2,1 * ( R1 * c3,3 - R3* c1,3 )
+ c3,1 * ( R1 * c2,3 - R2* c1,3 )
11
Cramer’s Rule: Numerator N3
N3
|c1,1 c1,2
= |c2,1 c2,2
|c3,1 c3,2
| c2,2
| c3,2
R1|
R2|
R3|
N3 =
c1,1
R2 | - c2,1 |c1,2 R1 | + c3,1
R3 |
|c3,2 R3|
N3 =
c1,1* ( R3 * c2,2 - R2* c3,2 )
- c2,1* ( R3 * c1,2 - R1* c3,2 )
+ c3,1* ( R2 * c1,2 - R1* c2,2 )
12
|c1,2 R1 |
|c2,2 R2 |
Cramer’s Rule: Solve for xi
For each xi its equation is: xi = N i / ∆
x1 = N1 / ∆
x2 = N2 / ∆
x3 = N3 / ∆
13
Sample Problem, [1] Appendix A
 Below are 3 sample equations for some circuit
 The 3 unknowns vi to be computed are v1 v2 v3
21 * v1 - 9 * v2
- 12 * v3 = -33
-3 * v1 + 6 * v2
-
2 * v3 =
3
-8 * v1 - 4 * v2
+ 22 * v3 =
50
14
Characteristic Determinant ∆
 Now we write result column and the characteristic
determinant ∆ by listing coefficients ci,j only
∆ =
|21
|-3
|-8
∆ = 21 | 6
|-4
-9 -12|
6 -2|
-4 22|
[R]=
-2 | - (-3) |-9
22 |
|-4
| -33 |
|
3 |
| 50 |
-12 |
22 |
-8 |-9
| 6
∆ = 21*(132-8) + 3*(-198-48) - 8*(18+72)
∆ = 2,604 – 738 - 720 = 1,146
15
-12|
-2|
Numerator N1
 Replace column 1 with column vector [R]
N1
N1 =
|-33 -9 -12|
= | 3 6 -2|
| 50 -4 22|
-33
|6 -2 |
|-4 22 |
- 3 |-9 -12| + 50 |-9 -12|
|-4 22|
| 6 -2|
N1 = -33*(124) - 3*(-246) + 50*(18+72)
N1 = 1,146
16
Numerator N2
 Replace column 2 with column vector [R]
N2
N2 =
|21
= |-3
|-8
-33
3
50
21 | 3 -2 | + 3
|50 22 |
-12
-2
22
|
|
|
|-33 -12| - 8
| 50 22|
|-33 -12|
| 3
-2|
N2 = 21*(166) + 3*(-126) - 8*(102)
N2 = 3,486 – 378 – 816 = 2,292
17
Numerator N3
 Replace column 3 with column vector [R]
N3
N3 =
|21
= |-3
|-8
-9
6
-4
21 | 6 3 | + 3
|-4 50 |
-33 |
3 |
50 |
|-9 -33 | - 8|-9 -33
|-4 50 |
| 6
N3 = 21*(312) + 3*(-582) - 8*(171)
N3 = 6,552 – 1,746 – 1,368 = 3,438
18
|
3 |
Cramer’s Rule: Solve for v1, v2, and v3
For all vi the results are: vi
= Ni/ ∆
v1 = N1 / ∆ = 1,146 / 1,146 = 1 V
v2 = N2 / ∆ = 2,292 / 1,146 = 2 V
v3 = N3 / ∆ = 3,438 / 1,146 = 3 V
19
What if?
What would the result be, if we had expanded the
characteristic determinant ∆ along the 3rd column? Let’s
see:
∆ =
|21
|-3
|-8
-9 -12|
6 -2|
-4 22|
∆ = -12 |-3 6 | - (-2) |21
|-8 -4 |
|-8
-9 | + 22 |21
-4 |
|-3
-9|
6|
∆ = -12*(12+48) + 2*(-84-72) + 22*(126-27)
∆ = -720 – 312 + 2,178
= 1,146 <- same result!!
20
What if?
 One of the beauties of Cramer’s Rule: we
may expand the characteristic determinant
∆ in whichever way we like, along any
column, along any row!
 Result is consistently the same
 That is mathematical beauty!
21
Download