Vous êtes sur la page 1sur 23

Solutions to Problems in Chapter Six

Test Your Understanding Problems


T6.1-1 x = 2, y = 3, z = 5
T6.1-2 Multiplying the first equation by 3 shows that it has the same left side as the
second equation, but a different right side. Thus the equations are represented by parallel
lines, and no solution exists.
T6.1-3 Substitute the second equation into the first to obtain 4x b(0.5x) = 0 or (8 b)x =
0. If b 6= 8, the solution is x = y = 0. If b = 8 the two equations are identical, and all we
can say is that x = 2y.
T6.2-1 Solving by hand:
"

A=

3 4
6 10

Thus
x=A

1
x=
6

"

"

b=

10 4
6 3

#"

5
2

5
2

"

7
4

The Matlab session is


A = [3,-4;6,-10];
b = [5;2];
x = inv(A)*b
x =
7.0000
4.0000

T6.2-2 Solving by hand:


"

A=

3 4
6 8

"

b=

5
2

But |A| = 3(8) 6(4) = 0, so the inverse of A does not exist. Thus there is no unique
solution. (These two equations are represented by parallel lines.)
The Matlab session is
A = [3,-4;6,-8];
b = [5;2];
x = inv(A)*b
Warning: Matrix is singular to working precision.
6-1

x =
Inf
Inf
Thus no solution exists.
T6.3-1 Cramers determinants are


4 b


D=

3
6

"

D1 =

5 b

3
6

"

D2 =

4 5

3 3

These determinants evaluate to D = 24 3b, D1 = 30 + 3b, and D2 = 12 + 15 = 27. Thus


x = D1 /D = (30 + 3b)/(24 3b) = (10 + b)/(8 b), y = D2 /D = 27/(24 3b) = 9/(8 b).
If D = 0 we cannot divide by D to obtain a solution. D = 0 if b = 8.
T6.3-2 The session is
A = [2,1,2;0,3,1;2,-3,4];
D2 = det([A(:,1),[17,6,19]0,A(:,3)]);
x = D2/det(A)
y =
1

T6.4-1 The Matlab session is


A = [3,12,-7;5,-6,-5;-2,7,9];
b = [5;-8;5];
rank(A)
ans =
3
rank([A b])
ans =
3
x = A\b
x =
-1.0204
0.5940
-0.1332
A*x
ans =
5.0000
-8.0000
5.0000

6-2

These numbers are the right hand side of the equations. Thus the answer x = 1.0204,
y = 0.5940, z = 0.1332 is correct. Because the ranks are 3 and equal the number of
unknowns, the solution is unique.
T6.4-2 The Matlab session is
A = [1,3,2;1,1,1];
b = [2;4];
rank(A)
ans =
2
rank([A b])
ans =
2
pinv(A)*b
ans =
4.3333
-1.6667
1.3333
x = A\b
x =
5.0000
-1.0000
0
Because the ranks are 2 and less than the number of unknowns, the solution is not unique.
The minimum-norm solution is x = 4.3333, y = 1.6667, z = 1.333. The left-division
solution is x = 5, y = 1, z = 0.
T6.4-3 The Matlab session is
A = [3,5,6;8,-1,2;5,-6,-4];
b = [6;1;-5];
rank(A)
ans =
2
rank([A b])
ans =
2
rref([A b])
ans =
1.0000 0 0.3721 0.2558
0 1.0000 0.9767 1.0465
0 0 0 0
6-3

x = pinv(A)*b
x =
0.0571
0.5249
0.5340
x = A\b
Warning: Matrix is singular to working precision.
x =
Inf
Inf
Inf
Because the ranks are less than the number of unknowns, an infinite number of solutions
exists. The reduced row echelon form gives the following solutions:
x = 0.3721z + 0.2558
y = 0.9767z + 1.0465
where z can have any value.
The pseudoinverse solution is x = 0.0571, y = 0.5249, z = 0.534.
T6.4-4 The Matlab session is
A = [3,5,6;8,-1,2;5,-6,-4];
b = [6;1;-5];
rank(A)
ans =
2
rank([A b])
ans =
2
rref([A b])
ans =
1.0000 0 -0.2727 5.2727
0 1.0000 1.3636 -2.3636
x = pinv(A)*b
x =
4.8394
-0.1972
-1.5887
x = A\b
x =
4.8000
6-4

0
-1.7333
Because the ranks are equal but less than the number of unknowns, an infinite number of
solutions exists. These are given by the reduced row echelon form:
x = 0.2727z + 5.2727
y = 1.3636z 2.3636
where z can have any value.
T6.5-1 The Matlab session is
A = [1,-3;3,5;70,-28];
b = [2;7;153];
rank(A)
ans =
2
rank([A b])
ans =
2
x = A\b
x =
2.2143
0.0714
Because the ranks are equal to the number of unknowns, a unique solution exists, which is
given by the left division method.
T6.5-2 The Matlab session is
A = [1,-3;3,5;5,-2];
b = [2;7;-4];
rank(A)
ans =
2
rank([A b])
ans =
3
Because the ranks are unequal, no exact solution exists.

6-5

End-of-Chapter Problems
1. (a) x = 2, y = 4 (b) The equations represent parallel lines; thus, no solution exists. (c)
Dividing the second equation by 4 gives the first equation. Thus there is only one equation,
which can be solved for y in terms of x as follows: y = 3 + 2x. (d) The equations represent
parallel lines; thus, no solution exists.
2. x = 3, y = 5, z = 2
3. x = 2, y = 3, z = 5
4. (a) The solution is: x = (4r + 5)/(2r 1), y = (2r 8)/(2r 1), z = 14/(2r 1). (b)
The denominator in the solution is 0 if r = 1/2. Thus, no solution exists if r = 1/2.
5. (a) The session is
A=[2,1;3,-9];b=[5;2];A\b
ans =
2.2381
0.5238
(b) The session is
A=[-8,-5;-2,7];b=[4;10];A\b
ans =
-1.1818
1.0909
(c) The session is
A=[12,-5,0;-3,4,7;6,2,3];b=[11;-3;22];A\b
ans =
3.0000
5.0000
-2.0000
(d) The session is
A=[6,-3,4;12,5,-7;-5,2,6];b=[41;-26;14];A\b
ans =
2
-3
5

6-6

6. The Matlab sessions are:


(a)
A = [-2,1;-2,1];b = [-5;3];
x = A\b
Warning: Matrix is singular to working precision.
x =
Inf
Inf
There is no solution. The two equations represent parallel lines and do not intersect.
(b)
A = [-2,1;-8,4];b = [3;12];
x = A\b
Warning: Matrix is singular to working precision.
x =
Inf
Inf
The second equation can be obtained from the first by multiplying by 4. Thus there is only
one equation. All we can say is that y is related to x as follows: y = 2x + 3
(c)
A = [-2,1;-2,1];b = [-5;-5.00001];
x = A\b
Warning: Matrix is singular to working precision.
x =
Inf
Inf
There is no solution. The two equations represent parallel lines and do not intersect.
(d)
A = [1,5,-1,6;2,-1,1,-2;-1,4,-1,3;3,-7,-2,1];b = [19;7;20;-75];
x = A\b
x =
2.0000
10.0000
3.0000
-5.0000
A*x
6-7

ans =
19.0000
7.0000
20.0000
-75.0000
Because the product A*x gives b, the answer x1 = 2, x2 = 10, x3 = 3, x4 = 5 is correct.
7. There are 7 equations in terms of six variables. Note that i6 appears in only 2 of the
equations. Thus we can use equations 1, 2, 3, 5, and 6 to solve for the five currents i1
through i5 , then use the solution to find i6 from either the fourth or seventh equation. The
script file using the values given in part (b) is
R=[1,5,2,10,5]*1000;
v = 100;
A=[0,-R(2),0,-R(4),0;R(1),-R(2),R(3),0,0;0,0,-R(3),- R(4),R(5);
0,1,1,-1,0;1,0,-1,0,-1];
b=[-v;0;0;0;0];
current = A\b

When this file is run it gives the following output.


current =
0.0189
0.0049
0.0027
0.0076
0.0162

The answers are in amperes. The current i6 is found from the fourth equation: i6 = i1 +i2 =
0.0189 + 0.0049 = 0.0238.
8. (a) Rearrange the equations by bringing all the unknowns to the left side.
R1 q1 + p1 = pa
R2 q2 p1 = pb
R3 q3 p1 = pc
q1 q2 q3 = 0
6-8

These equations have the form Ax = b where

A=

R1
0
0
1
0 R2
0 1

0
0 R3 1
1 1 1
0

b=

pa
pb
pc
0

x=

q1
q2
q3
p1

(b) The script file is


pa = 4320;pb = 3600; pc = 2880;
R = [10000,14000,14000];
A = [R(1),0,0,1;0,R(2),0,-1;0,0,R(3),-1;1,-1,-1,0];
b = [pa;-pb;-pc;0];
format long
x = A\b
When this file is run it gives the following output.
x =
1.0e+003 *
0.00006352941176
0.00000605042017
0.00005747899160
3.68470588235294
Thus q1 = 6.35 102 , q2 = 6.05 103 , q3 = 5.75 102 ft3 /sec, and p1 = 3685 lb/ft2 .
9. (a) Evaluate the expression for 1 (t) at t = tf to get
1 (tf ) = 1 (0) + a1 t3f + a2 t4f + a3 t5f

(1)

The angular velocity 1 (t) is the time derivative of 1 (t):


1 (t) = 3a1 t2 + 4a2 t3 + 5a3 t4
The angular acceleration 1 (t) is the time derivative of 1 (t):
1 (t) = 6a1 t + 12a2 t2 + 20a3 t3
Note that 1 (0) = 0 and 1 (0) = 0. To have zero angular velocity and zero angular
acceleration at time tf , we require that
0 = 3a1 t2f + 4a2 t3f + 5a3 t4f

(2)

0 = 6a1 t + 12a2 t2 + 20a3 t3

(3)

6-9

Equations (1), (2), and (3) can be rearranged into the following set:
t3f a1 + t4f a2 + t5f a3 = 1 (tf ) 1 (0)
3t2f a1 + 4t3f a2 + 5t4f a3 = 0
6tf a1 + 12t2f a2 + 20t3f a3 = 0
This set has the form Ax = b where

t3f
2
A = 3tf
6tf

t4f
4t3f
12t2f

t5f
5t4f

20t3f

1 (tf ) 1 (0)

0
b=

a1

x = a2
a3

The solution vector x contains a1 , a2 , a3 . The equations for the coefficents b1 , b2 , b3 are
identical to the above equations, except that 1 (tf ) 1 (0) is replaced with 2 (tf ) 2 (0).
(b) For tf = 2, 1 (0) = 19 , and 1 (tf ) = 43 ,

8 16 32

A = 12 32 80
12 48 160

43 (19)
62

0
b=
= 0
0
0

The solution is given by the following session.


A = [8,16,32;12,32,80;12,48,160];b = [62;0;0];A\b
ans =
77.5000
-58.1250
11.6250
Thus 1 (t) = 19 + 77.5t3 58.125t4 + 11.625t5 .
To solve for the coefficients b1 , b2 , b3 , use b = [151-44;0;0] = [107;0;0]. The result
is b1 = 133.75, b2 = 100.3125, b3 = 20.0625. Thus 2 (t) = 44 + 133.75t3 100.3125t4 +
20.0625t5 .
(c) With L1 = 4 and L2 = 3 feet, the equations for x and y become
x = 4 cos 1 + 3 cos(1 + 2 )
y = 4 sin 1 + 3 sin(1 + 2 )
The script file to plot y versus x is shown below. Note that we must convert the angles
theta1 and theta2 to radians.
6-10

A = [8,16,32;12,32,80;12,48,160];c1 = [62;0;0];a = A\c1;


c2 = [107;0;0];b = A\c2;
t = [0:.01:2];
theta1 = -19+a(1)*t.^3+a(2)*t.^4+a(3)*t.^5;
theta2 = 44+b(1)*t.^3+b(2)*t.^4+b(3)*t.^5;
th1 = (pi/180)*theta1;
th2 = (pi/180)*theta2;
x = 4*cos(th1)+3*cos(th1+th2);
y = 4*sin(th1)+3*sin(th1+th2);
plot(x,y),xlabel(0x0 ),ylabel(0y0 ) ,gtext(0 Start0 ),gtext(0Finish0 )
The plot is shown in the figure.
4
3.5
3
2.5
Finish

2
1.5
1
0.5
0

Start
0.5
0

Figure : for Problem 9.

6-11

10. The last three equations can be rearranged as follows:


(R1 + R2 )T1 R1 T2 = R2 Ti
R3 T1 (R2 + R3 )T2 + R2 T3 = 0
R4 T2 + (R3 + R4 )T3 = R3 To
Once T1 is computed, q can be computed from first equation: q = (T1 Ti )/R1 . The script
file is:
R
A
b
T
q

=
=
=
=
=

[.036,4.01,.408,.038];Ti = 20;To = -10;


[R(1)+R(2),-R(1),0;R(3),-(R(2)+R(3)),R(2);0,- R(4),R(3)+R(4)];
[R(2)*Ti;0;R(3)*To];
A\b
(1/R(1))*(Ti - T(1))

The results are T = [19.7596, 7.0214, 9.7462] C and q = 6.6785 watts/meter2 . Thus the
heat loss in watts is 10(6.6785) = 66.785.
11. Rearrange the four equations by bringing all the unknowns to the left and clearing the
fractions to obtain
3T1 T2 T3 = Ta
T1 2T2 + T4 = 0
T1 2T3 + T4 = 0
T2 + T3 3T4 = Tb
Thus the equations have the matrix form Ax = b where

A=

3 1 1
0
1 2
0
1
1
0 2
1
0
1
1 3

b=

6-12

Ta
0
0
Tb

x=

T1
T2
T3
T4

The session using Ta = 150 and Tb = 20 is shown below.


A=[3,-1,-1,0;1,-2,0,1;1,0,-2,1;0,1,1,-3];
b=[150;0;0;-20];
x = A\b
x =
106.6667
85.0000
85.0000
63.3333
Thus T1 = 106.6667, T2 = T3 = 85, and T4 = 63.3333 C.
12. The averaging equations are:
T1
T3
T5
T7
T9

= (Ta + T2 + T4 )/3
= (T2 + T6 )/2
= (T2 + T4 + T6 + T8 )/4
= (T4 + T8 )/2
= (T6 + T8 + Tb )/3

T2
T4
T6
T8

= (T1 + T3 + T5 )/3
= (T1 + T5 + T7 )/3
= (T3 + T5 + T9 )/3
= (T7 + T5 + T9 )/3

Rearrange these equations by bringing all the unknowns to the left and clearing the fractions.
The equations have the matrix form Ax = b where

A=

3 1
0 1
0
0
0
0
0
1 3
1
0
1
0
0
0
0
0
1 2
0
0
1
0
0
0
1
0
0 3
1
0
1
0
0
0
1
0
1 4
1
0
1
0
0
0
1
0
1 3
0
0
1
0
0
0
1
0
0 2
1
0
0
0
0
0
1
0
1 3
1
0
0
0
0
0
1
0
1 3

b=

Ta
0
0
0
0
0
0
0
Tb

x=

T1
T2
T3
T4
T5
T6
T7
T8
T9

Because of the large size of A it is better to use a script file rather than an interactive
session to enter the elements. A script file allows for easier editing of mistakes. The script
file using Ta = 150 and Tb = 20 is shown below.
A = [3,-1,0,-1,0,0,0,0,0;
1,-3,1,0,1,0,0,0,0;
0,1,-2,0,0,1,0,0,0;
1,0,0,-3,1,0,1,0,0;
0,1,0,1,-4,1,0,1,0;
0,0,1,0,1,-3,0,0,1;
6-13

0,0,0,1,0,0,-2,1,0;
0,0,0,0,1,0,1,-3,1;
0,0,0,0,0,1,0,1,-3];
b = [150;0;0;0;0;0;0;0;-20];
x = A\b
When this file is run, it produces the result
x =
112.8571
94.2857
85
94.2857
85
75.7143
85
75.7143
57.1429
Thus T1 = 112.8571, T2 = 94.2857, T3 = 85, T4 = 94.2857, T5 = 85, T6 = 75.7143, T7 = 85,
T8 = 75.7143, and T9 = 57.1429 C.
13. For y(x) = a3 x3 + a2 x2 + a1 x + a0 , y(0) = 100 gives a0 = 100. For zero slope at x = 0,
a1 = 0. Thus y(x) = a3 x3 + a2 x2 + 100 and s(x) = 3a3 x2 + 2a2 x. For y(120) = 10, we have
1203 a3 + 1202 a2 + 100 = 10, or
1203 a3 + 1202 a2 = 90
For the slope at x = 120 to be tan 30 , we have
3(1202 )a3 + 2(120)a2 = tan 30
We can use Matlab to solve these two equations. The script file is:
A = [120^3,120^2;3*120^2,240];
b = [-90;tan(30*pi/180)];
x = A\b
a0 = 100
a1 = 0
a2 = x(2)
a3 = x(1)
xp = [0:0.1:120];
y = polyval([a3,a2,a1,a0],xp);
plot(xp,y),xlabel(x (feet)),ylabel(y (feet))

6-14

The solutions are a2 = 0.0236 and a3 = 1.4426 104 . The profile is shown in the figure.
No undesired behavior (such as a large change in slope) is observed.
100

90

80

70

y (feet)

60

50

40

30

20

10

20

40

60
x (feet)

80

100

Figure : for Problem 13.

6-15

120

14. Create the following function file to solve the two linear equations.
function [V, L] = mix(p)
A = [1,1;0.684,0.4];
b = [1;0.01*p];
x = A\b;
V = x(1);
L = x(2);
Typing [V,L] = mix(50) gives the results: V = 0.3521 and L = 0.6479.
15. (a) The solution is C = B1 (A1 B A). (b) The session to evaluate C using this
solution is
A = [3,9;-2,4];B = [2,-3;7,6];
C = inv(B)*(inv(A)*B-A)
C =
-0.6212 -2.3636
1.1970 2.1576
16. a) The inverse A1 is

"

0.4286
0.0476
0.1429 0.0952

and the solution is


"

x=A

b=

0.4286
0.0476
0.1429 0.0952

#"

5
2

"

2.2381
0.5238

The answer is x = 2.2381 and y = 0.5238.


b) The inverse A1 is
"
#
0.1061 0.0758
0.0303
0.1212
and the solution is
"

x=A

b=

0.1061 0.0758
0.0303
0.1212

#"

4
10

The answer is x = 1.1818 and y = 1.0909.


c) The session is
A = [12,-5,0;-3,4,7;6,2,3];b = [11;-3;22];
x = inv(A)*b

6-16

"

1.1818
1.0909

The answer is x = 3, y = 5, and z = 2.


d) The session is
A = [6,-3,4;12,5,-7;-5,2,6];b = [41;-26;14];
x = inv(A)*b
The answer is x = 2, y = 3, and z = 5.
17. (a) The session is
A = [1,-5,-2;6,3,1;7,3,-5];b = [11;13;10];
x = A\b
x =
3.0000
-2.0000
1.0000
Because the parameter c appears as a multiplicative factor on the right sides of the equations,
we can use the linearity principle to obtain the following solution by multiplying the above
answers by c. The answer is x = 3c, y = 2c, z = c.
(b) The following session produces the plot.
A = [1,-5,-2;6,3,1;7,3,-5];b = [11;13;10];
c=[-10:.1:10];
x = (A\b)*c;
plot(c,x(1,:),c,x(2,:),0-- 0 ,c,x(3,:),0:0 ),xlabel(0c0 ), ...
legend(0x vs. c0 ,0 y vs. c0 ,0 z vs. c0 )
The plot consists of three straight lines that intersect at (0,0).
18. Cramers determinant for Problem 1(a) is

5

D=
1

The solutions are


x=


6 1


6 1

1
1




= 6

=2
y=
D
Cramers determinant for Problem 1(b) is

2 1

D=
2 1

Thus, no solution exists.


6-17



5 6




1
6




=0

=4

19. Cramers determinant for Problem 5(a) is


2 1

D=
3 9

The solutions are


5


2

1
9

47
D
21
Cramers determinant for Problem 5(b) is
x=


8

D=
2

The solutions are

x=


4


10

5
7
D

5
7

13
11




= 21

y=


2


3

5
2
D

11
21




= 66

y=


8 4


2 10

12
11

20. Because rank(A) and rank([A b]) both equal 2, which is less than the number of
unknowns, there is no unique solution. Using the rref command, the session is
A = [7,9,-9;3,2,-4;1,5,-1];b = [22;12;-2];
rank(A)
ans =
2
rank([A b])
ans =
2
rref([A b])
ans =
1.0000 0 -1.3846 4.9231
0 1.0000 0.0769 -1.3846
0 0 0 0
Thus the reduced row echelon form gives the solution x = 1.3846z + 4.9231, y = 0.0769z
1.3846, where z can have any value.
21. (a) The equations for the number of hours used per week are, for reactor A,
6x + 2y + 10z = 35
and for reactor B,
3x + 5y + 2z = 40
A session to check the ranks and find the reduced row echelon form is shown below.
6-18

A=[6,2,10;3,5,2];b=[35;40];
rank(A)
ans =
2
rank([A b])
ans =
2
rref([A b])
ans =
1.0000 0 1.9167 3.9583
0 1.0000 -0.7500 5.6250
Because the ranks are equal but one less than the number of unknowns, we can determine
two of the unknowns in terms of a third unknown. The set of equations corresponding to
the reduced row echelon form is
x = 3.9583 1.9167z
y = 5.625 + 0.75z
(b) From the equation for x, we see that x 0 implies that 3.9583 1.9167z 0, or
z 3.9583/1.9167 = 2.0652. Also, x 3.9583 if z 0. Thus the resulting range for x is
0 x 3.9583.
From the equation for y note that y 5.625 if z 0. Thus the allowable range for z is
0 z 2.0652, and the resulting range for y is y 5.625.
(c) The profit P is P = 200x + 300y + 100z. Substituting the expressions for x and y in
to this expression, and collecting terms, we obtain
P = 200(3.9583 1.9167z) + 300(5.625 + 0.75z) + 100z = 2479.16 58.34z
Thus the profit decreases with increasing z, so to maximize profit we should choose z = 0
(that is, not make any of product 3). Thus, x = 3.9583 and y = 5.625 tons per week.
(d) The profit P is P = 200x + 500y + 100z. Substituting the expressions for x and y
in to this expression, and collecting terms, we obtain
P = 200(3.9583 1.9167z) + 500(5.625 + 0.75z) + 100z = 3604.16 + 91.66z
Thus the profit increases with increasing z, so to maximize profit we should choose z equal
to its maximum possible value, which from part (b) is z = 2.0652. Substituting this value
into the equations for x and y, we obtain x = 0 and y = 7.1739 tons per week.
22. Equating the flow in to the flow out at each intersection, we obtain the following
equations:
100 + 200 = f1 + f3
6-19

f1 + 300 = f2 + f4
f2 + f5 = 100 + 500
f3 + f6 = 100 + 300
f4 + f7 = f6 + 200
200 + 400 = f5 + f7
Rearrange these equations by bringing all the unknowns to the left. The equations have
the matrix form Ax = b where

A=

1
0 1
0 0
0 0
1 1 0 1 0
0 0
0
1 0
0 1
0 0
0
0 1
0 0
1 0
0
0 0
1 0 1 1
0
0 0
0 1
0 1

b=

300
300
600
400
200
600

x=

f1
f2
f3
f4
f5
f6

Because of the large size of A it is better to use a script file rather than an interactive
session to enter the elements. A script file allows for easier editing of mistakes. The script
file is shown below.
A = [1,0,1,0,0,0,0;
1,-1,0,-1,0,0,0;
1,-1,0,-1,0,0,0;
0,1,0,0,1,0,0;
0,0,1,0,0,1,0;
0,0,0,1,0,-1,1;
0,0,0,0,1,0,1];
b=[300;-300;600;400;200;600];
rankA = rank(A)
rankAb = rank([A b])
rref([A b])
When this file is run, it produces the result
rankA =
5
rankAb =
5
ans =
1 0 0 0 0 -1 0 -100
0 1 0 0 0 0 -1 0
0 0 1 0 0 1 0 400
6-20

0 0 0 1 0 -1 1 200
0 0 0 0 1 0 1 600
0 0 0 0 0 0 0 0
Because the ranks are equal but 2 less than the number of unknowns, we can express 5 of
the unknowns in terms of the remaining 2 unknowns. The reduced row echelon form given
by the rref command is
f1 = f6 100
f2 = f7
f3 = 400 f6
f4 = f6 f7 + 200
f5 = 600 f7
Thus if we install sensors to measure the traffic flows f6 and f7 , we will be able to use
the above equations to compute the flows on all the streets. Of course, we could choose to
install sensors on any two streets, but the preceding equations would need to be rewritten.
23. Because rank(A) and rank([A b]) both equal 2, which is equal to the number of
unknowns, there is a unique solution, which can be found by left division. The session is
A = [1,-3;1,5;4,-6];b = [2;18;20];
A\b
ans =
8.0000
2.0000
Thus x = 8 and y = 2.
24. Because rank(A) is 2 and rank([A b]) is 3, there is no exact solution. The least squares
solution can be found with the left division method. The session is
A = [1,-3;1,5;4,-6];b = [2;18;10];
A\b
ans =
6.0928
2.2577
Thus the least squares solution is x = 6.0928 and y = 2.2577.
25. (a) Substituting the values of x and y into ax2 + bx + c = y for each point gives the
three equations:
a+b+c=4
6-21

16a + 4b + c = 73
25a + 5b + c = 120
These equations have the form Ax = b where

1 1 1

A = 16 4 1
25 5 1

b = 73
120

x= b
c

Because rank(A) and rank([A b]) both equal 3, which is equal to the number of unknowns,
there is a unique solution, which can be found by left division. The session is
A = [1,1,1;16,4,1;25,5,1];b = [4;73;120];
A\b
ans =
6.0000
-7.0000
5.0000
Thus a = 6, b = 7, and c = 5. The curve given by y = 6x2 7x + 5 passes through all
three points.
(b) Substituting the values of x and y into ax3 + bx2 + cx + d = y for each point gives the
three equations:
a+b+c+d= 4
64a + 16b + 4c + d = 73
125a + 25b + 5c + d = 120
These equations have the form Ax = b where

1 1 1 1

A = 64 16 4 1
125 25 5 1

b = 73
120

x=

a
b
c
d

Because rank(A) and rank([A b]) both equal 3, which is less than the number of unknowns,
there is no exact solution. The least squares solution can be found by left division. The
session is
A = [1,1,1,1;64,16,4,1;125,25,5,1];b = [4;73;120];
A\b
ans =
0.2414
3.5862
0
0.1724

6-22

Thus a = 0.2414, b = 3.5862, c = 0, and d = 0.1724. The curve given by y = 0.2414x3 +


3.5862x2 + 0.1724 does not pass through the three points, but is the best fit to the points
in the least squares sense. These points and the quadratic and cubic curves are shown in
the plot below. The quadatic and cubic curves are very close to one another.
140

120

100
Data
Quadratic
Cubic

80

60

40

20

0
1

1.5

2.5

3
x

3.5

4.5

Figure : for Problem 25.

6-23

Vous aimerez peut-être aussi