3 Systems of Equations 3.1 Systems of equations 3.1.1 Notation and Examples In this chapter we look at algorithms to solve systems of equations. A system of n linear equations with n unknowns can be written in the form Ax = b, where A is the nn matrix of coefficients, x is the column vector of n unknowns and b is the column vector of numbers on the right-hand side. Before discussing algorithms to solve linear equations we look at a typical example where solving linear equations arises. Example 1: Equilibrium Temperature Distribution. A building has a rectangular cross section 40' wide and 30' high. The bottom rests on the ground at a temperature of 50°. The left side which is away from the sun is at a temperature of 60°. The top and right sides are exposed to the sun at a temperature of 70°. The other two ends are insulated so we can assume we are working with the rectangular cross section. We want to find (at least approximately) the temperatures inside. To illustrate linear equation solving we will use a discrete model of the interior. We choose a coordinate system with the origin at the lower left corner of the rectangle so that the corners of the rectangle are at the points (0, 0), (40, 0), (0, 30), and (40, 30). We consider the six interior points. p4 = (10, 20) p5 = (20, 20) p6 = (30, 20) p1 = (10, 10) p2 = (20, 10) p3 = (30, 10) which are 10 feet apart and 10 or 20 feet above the ground and 10 or 20 feet from the walls. We assume the temperatures, t1, t2, t3, t4, t5, t6, at these points are the average of the temperatures at the four points 10 feet above and below and to the right and left. This gives the following six equations. 1 t1 = 4 (60 + t4 + t2 + 50) 1 t2 = 4 (t1 + t5 + t3 + 50) 1 t3 = 4 (t2 + t6 + 70 + 50) 1 t4 = 4 (60 + 70 + t5 + t1) 1 t5 = 4 (t4 + 70 + t6 + t2) 1 t6 = 4 (t5 + 70 + 70 + t3) We write the equations in standard form as follows. 3.1.1 - 1 - - 4t1 - t2 - t1 + 4t2 - t3 - t2 4t3 - - t2 - t5 - t1 - t4 t6 = 110 = 50 = 120 = 130 + 4t4 - t5 - t4 - 4t5 - t6 = 70 - t5 4t6 = 140 t3 + We can write it in matrix form At = b with A = -1 0 -10 0 4 -1 4 -1 0 -1 0 0 -1 4 0 0 -1 -1 0 0 4 -1 -1 0 -1 0 -1 4 -1 0 0 -1 0 -1 4 t t tt t t1 2 t = 3 4 5 6 50 120 130 70 140 110 b = It is convenient to use Mathematical software to solve these equations. In the next section we do this with Mathematica and in the following section we do this with MATLAB. The solution turns out to be t1 = 57.8675 t2 = 58.3851 t3 = 61.2008 t4 = 63.0849 t5 = 64.4720 t6 = 66.4182 A general system of n linear equations and n unknowns can be written as a11x1 + a12x2 + . . . + a1nxn = b1 a21x1 + a22x2 + . . . + a2nxn = b2 . . . + annxn = bn (1) an1x1 + . . . . . . an2x2 + where the aij and bi are given numbers and the xi are unknowns. This can be writen in matrix form Ax = b with A = a . . a a11 a12 21 a22 . . n1 an2 . . . . . . . . . . a1n a2n . . ann x . . x x1 x = b . . b b1 2 2 b = n n If det(A) 0 then there is one and only one solution. Furthermore the matrix A has an inverse, denoted by A-1 with the properties AA-1 = I and A-1A = I. The solution to the system of equations (1) is given by x = A-1b. If det(A) = 0 then there is either no solution or infinitely many solutions. This may be an indication that more information is needed or that the information that led to the equations is inconsistent. 3.1.1 - 2