<<

Solving Linear Systems

Thursday, 20 September 2007 CUBIC INTERPOLATION

PROBLEM: Find the cubic 3 X 3−i p(x) = cix i=0 whose graph contains the four points ˜ Pk = (xk, yk), k ∈ {1, 2, 3, 4} such that k 6= k ⇒ xk 6= x˜k . T SOLUTION: The unknown coefficients [c0 c1 c2 c3] are subject to the linear equation system 3 2 1 0 P (x1) = y1 = c0x1 + c1x1 + c2x1 + c3x1 3 2 1 0 P (x2) = y2 = c0x2 + c1x2 + c2x2 + c3x2 3 2 1 0 P (x3) = y3 = c0x3 + c1x3 + c2x3 + c3x3 3 2 1 0 P (x4) = y4 = c0x4 + c1x4 + c2x4 + c3x4 featuring the augmented Vandermonde  3 2 1 0  x1 x1 x1 x1 y1        x3 x2 x1 x0 y   2 2 2 2 2       3 2 1 0   x x x x y3   3 3 3 3     3 2 1 0  x4 x4 x4 x4 y4 k 2 EXAMPLE: With xk = k, yk = (−1) k , k ∈ {1, 2, 3, 4} we find  1 1 1 1 −1   8 4 2 1 4       27 9 3 1 −9  64 16 4 1 16 with Reduced  1 0 0 0 | 28/3   0 1 0 0 65   | −     0 0 1 0 | 404/3  0 0 0 1 | −80 resulting in the cubic polynomial 28 404 P (x) = x3 − 65 x2 + x − 80 . 3 3 Possible MATLAB commands for this example:

A=[vander([1 2 3 4]),[-1 4 -9 16]’] B = rref(A) polyval(B(:,5)’,[1 2 3 4]) TEMPERATURE DISTRIBUTION

Consider an array of temperature sensors n n n t1 t2 t3 w e t1 T1 T2 T3 t1 w e t2 T4 T5 T6 t2 s s s t1 t2 t3 where n n n e e s s s w w t1, t2, t3, t1, t2, t1, t2, t3, t1 , t2 are supposed to have known values.

PROBLEM: Find the values registered by the temperature sen- sors T1,T2,T3,T4,T5,T6 if each of these sensors registers the av- erage of the values of its four nearest neighbors. The resulting system of linear equations is n w 4T1 = t1 + T2 + T4 + t1 n 4T2 = t2 + T3 + T5 + T1 n e 4T3 = t3 + t1 + T6 + T2 s w 4T4 = T1 + T5 + t1 + t2 s 4T5 = T2 + T6 + t2 + T4 e s 4T6 = T3 + t2 + t3 + T5 which has the  n w  4 −1 0 −1 0 0 t1 + t1  n   −1 4 −1 0 −1 0 t2   n e   0 −1 4 0 0 −1 t + t   3 1   −1 0 0 4 −1 0 ts + tw   1 2   0 1 0 1 4 1 s   − − − t2  e s 0 0 −1 0 −1 4 t2 + t3 EXAMPLE: Using the boundary data presented in Fig. 2.2, page 105 of the text we have

n w n n e s w s e s t1+t1 = 160, t2 = 100, t3+t1 = 140, t1+t2 = 60, t2 = 0, t2+t3 = 40 T The reduced row echelon form takes the form [I6 | [Tj] ] and provides the approximate solution

T1 = 66.77,T2 = 66.21,T3 = 61.43,T4 = 40.85,T5 = 36.65,T6 = 39.52 MOCK GLOBAL POSITIONING SYSTEM

Four distinct satellites at positions Si(ai, bi, ci), i ∈ {1, 2, 3, 4} have distances ri, i ∈ {1, 2, 3, 4} from the point in space P (x, y, z), whose position is to be determined by the GPS system.

2 2 2 2 2 |S1P | = r1 = (x − a1) + (y − b1) + (z − c1) 2 2 2 2 2 |S2P | = r2 = (x − a2) + (y − b2) + (z − c2) 2 2 2 2 2 |S3P | = r3 = (x − a3) + (y − b3) + (z − c3) 2 2 2 2 2 |S4P | = r4 = (x − a4) + (y − b4) + (z − c4) Expanding the right hand sides of these equations and taking the differences of successive rows the quadratic terms in x, y, z cancel and the following linear equation system results

2(a2 − a1) x + 2(b2 − b1) y + 2(c2 − c1) z  2 2 2 2  2 2 2 2 = r1 − a1 − b1 − c1 − r2 − a2 − b2 − c2

2(a3 − a2) x + 2(b3 − b2) y + 2(c3 − c2) z  2 2 2 2  2 2 2 2 = r2 − a2 − b2 − c2 − r3 − a3 − b3 − c3

2(a4 − a3) x + 2(b4 − b3) y + 2(c4 − c3) z  2 2 2 2  2 2 2 2 = r3 − a3 − b3 − c3 − r4 − a4 − b4 − c4 HOMOGENEOUS SYSTEMS

THEOREM: If 0 < m < n and A ∈ Mm×n(R) then the homoge- nous equation

A x = 0m always has a non-trivial solutions space, i.e. ker (A) 6= {0n} .

Proof: Let r denote the number of leading ones occurring in the RREF of the matrix A. Then 0 ≤ r ≤ m . The number of real variables parameterizing the solution set for A x = 0m is n − r ≥ n − m > 0 . It follows that there are infinitely many solutions other than the obvious solution 0n . Q.E.D. CHEMICAL BALANCE EQUATIONS

EXAMPLE: Nitric oxide, NO, is involved in an aqueous reaction of the type

x1 NaNO2 + x2 FeSO4 + x3 H2SO4 → x4 Fe2 (SO4)3 + x5 NaHSO4 + x6 H2O + x7 NO Balancing the number of atoms for each element appearing in the reaction summary one finds the linear system

H : 2x3 = 1x5 + 2x6 Fe : 1x2 = 2x4 N : 1x1 = 1x7 Na : 1x1 = 1x5 O : 2x1 + 4x2 + 4x3 = 12x4 + 4x5 + 1x6 + 1x7 S : 1x2 + 1x3 = 3x4 + 1x5 The corresponding matrix of format 6 × 7 is  0 0 2 0 −1 −2 0     0 1 0 −2 0 0 0     1 0 0 0 0 0 −1     1 0 0 0 −1 0 0     2 4 4 12 4 1 1   − − − −  0 1 1 −3 −1 0 0 h T i The RREF for this matrix is of the form I6, v , where v = [−1, −1, −1.5, −0.5, −1, −1] .

The solution set for this homogeneous system therefore is pa- rameterized by x7 ∈ R :

x1 = x7 x2 = x7 x3 = 1.5 x7 x4 = 0.5 x7 x5 = x7 x6 = x7 Among these solutions the one with smallest natural number values is obtained by choosing x7 = 2

x1 = 2, x2 = 2, x3 = 3, x4 = 1, x5 = 2, x6 = 2, x7 = 2 . This produces the balanced reaction equation

2 NaNO2 + 2 FeSO4 + 3 H2SO4 → 1 Fe2 (SO4)3 + 2 NaHSO4 + 2 H2O + 2 NO . NONHOMOGENEOUS AND HOMOGENEOUS LINEAR SYSTEMS

n For a b 6= 0m assume that xp ∈ R is a particular solution of the nonhomogeneous system

A xp = b .

If xh is an arbitrary solution of the homogeneous system

A xh = 0m then

A (xh + xp) = A xh + A xp = 0m + b = b also solves the inhomogeneous system. Conversely, ifx ˜p is any particular solution of the nonhomoge- neous system, then xh =x ˜p−xp is a solution of the homogeneous system:

A xh = A (x˜p − xp) = A x˜p − A xp = b − b = 0m . Thus, the set of all solutions to a consistent nonhomogenous system is of the form

xp + kerA = {xp + xh | A xh = 0m} . SOLVING LINEAR SYSTEMS WITH COMPLEX ENTRIES

Practically everything that has been established up to this point for real matrices remains valid for matrices with complex entries.

The only change involves the replacement of real algebraic oper- ations, i.e. real addition, subtraction, multiplication and division, by the corresponding complex operations.

Examples are in the text.