Solution of Simultaneous Linear Equations AXB Preliminary matrix

Solution of Simultaneous Linear Equations (AX=B) • • Preliminary: matrix multiplication Defining the problem Setting up the equations Arranging the equations in matrix form Solving the equations Meaning of the solution Examples § Geometry § Balancing chemical equations § Dimensional analysis GG 250 F-2004

Matrix Multiplication (*) Operate across rows of A and down columns of B If A*B = C, then A is nxm, B is mxn, and C is nxn GG 250 F-2004 2
![Matrix Multiplication (*) [2 x 3] [3 x 1] = [2 x 1] [2 Matrix Multiplication (*) [2 x 3] [3 x 1] = [2 x 1] [2](http://slidetodoc.com/presentation_image/c92628de639beb69eebeb34feb940289/image-3.jpg)
Matrix Multiplication (*) [2 x 3] [3 x 1] = [2 x 1] [2 x 2] [2 x 1] + [2 x 1] = [2 x 1] GG 250 F-2004 [2 x 2] [2 x 1] + [2 x 1][1 x 1]=[2 x 1] + [2 x 1] = [2 x 1] 3

Matrix Multiplication (. *) Multiply elements of A with counterparts in B If A. *B = C, then A is nxm, B is nxm, and C is nxm GG 250 F-2004 4

Matrix Multiplication (. *) GG 250 F-2004 5

Defining the Problem (Two intersecting lines) • What is the point where two lines in the same plane intersect • Alternative 1: What point that lies on one line also lies on the other line? • Alternative 2: What point with coordinates (x, y) satisfies the equation for line 1 and simultaneously satisfies the equation for line 2? GG 250 F-2004

Setting up the Equations Equation for line 1 Equation for line 2 y = m 1 x + b 1 y = m 2 x + b 2 -m 1 x + y = b 1 -m 2 x + y = b 2 Now multiply both sides by a constant c 1 Now multiply both sides by a constant c 2 c 1(-m 1 x + y) c 2(-m 2 x + y) = (c 1)b 1 = (c 2)b 2 -c 1 m 1 x + c 1 y = (c 1)b 1 -c 2 m 2 x + c 2 y = (c 2)b 2 a 11 x + a 12 y a 21 x + a 22 y GG 250 F-2004 = b*1 = b*2 7

Setting up the Equations Equation for line 1 Equation for line 2 a 11 x + a 12 y a 21 x + a 22 y = b*1 = b*2 The variables are on the left sides of the equations. Only constants are on the right sides of the equations. The left-side coefficients have slope information. The right-side constants have y-intercept information. We have two equations and two unknowns here. This means the equation can have a solution. GG 250 F-2004 8

Arranging the Equations in Matrix Form (AX = B) Form from prior page a 11 x + a 12 y = b*1 a 21 x + a 22 y = b*2 Matrix form Matrix A of known coefficients Matrix X of unknown variables Matrix B of known constants We want to find values of x and y (i. e. , X) that simultaneously satisfy both equations. GG 250 F-2004 9

Solving the equations AX = B (1) a 11 x + a 12 y = b*1 (2) a 21 x + a 22 y = b*2 We use eq. 2 to eliminate x from eq. (1) a 11 x + a 12 y = b*1 -(a 11/a 21)(a 21 x + a 22 y) = -(a 11/a 21)(b*2) [a 12 -(a 11/a 21)(a 22)](y) = b*1 -(a 11/a 21)(b*2) GG 250 F-2004 10

Solving the equations AX = B The equation of the previous slide [a 12 -(a 11/a 21)(a 22)] (y) = b*1 -(a 11/a 21)(b*2) has one equation with one unknown (y). This can be solved for y. y = [b*1 -(a 11/a 21)(b*2)]/ [a 12 -(a 11/a 21)(a 22)] Similarly, we could solve for x: x = [b*2 -(a 22/a 12)(b*1)]/ [a 21 -(a 22/a 12)(a 11)] GG 250 F-2004 11

Solving the Equations (Cramer's Rule) AX = B Note: if the denominators equal zero, the equations have no unique simultaneous solution (e. g. , lines are parallel) GG 250 F-2004 12

Solving the equations AX = B Many equations for many problems can be set up in this form (see examples): AX = B Matlab allows these to be solved like so: X = AB GG 250 F-2004 13

Meaning of the Solution AX = B The solution X is the collection of variables that simultaneously satisfy the conditions described by the equations. GG 250 F-2004 14

Example 1 Intersection of Two Lines 1 x + 1 y =2 0 x + 1 y =1 By inspection, the intersection is at y=1, x=1. In Matlab: A = [1 1; 0 1] B = [2; 1] X = AB GG 250 F-2004 15

Example 2 Intersection of Two Lines 1 x + 1 y =2 2 x + 2 y =2 Doubling the first equation yields the left side of the second equation, but not the right side of the second equation - what does this mean? In Matlab: A = [1 1; 2 2] B = [2; 2] X = AB GG 250 F-2004 16

Example 3 Intersection of Two Lines 1 x + 1 y =1 2 x + 2 y =2 Doubling the first equation yields the second equation - what does this mean? In Matlab: A = [1 1; 2 2] B = [1; 2] X = AB GG 250 F-2004 17

Example 4 Intersection of Two Lines 1 x + 2 y =0 2 x + 2 y =0 Equations where the right sides equal zero are called homogeneous. They can have a “trivial” solution (x=0, y=0) or an infinite number of solutions. Which is the case here? In Matlab: A = [1 2; 2 2] B = [0; 0] X = AB GG 250 F-2004 18

Example 5 Intersection of Two Lines 1 x + 1 y =0 2 x + 2 y =0 Which is the case here? In Matlab: A = [1 1; 2 2] B = [0; 0] X = AB GG 250 F-2004 19

Example 6 Intersection of Three Planes 1 x + 1 y + 0 z = 2 0 x + 1 y + 0 z = 1 0 x + 0 y + 1 z = 0 By inspection, the intersection is at z=0, y=1, x=1. In Matlab: A = [1 1 0; 0 0 1] B = [2; 1; 0] X = AB GG 250 F-2004 20

Example 7 Solution of a Chemical Equation Hydrogen + Oxygen = Water What are the unknowns? H, O, and W (the # of hydrogens, oxygens, and waters) How many unknowns are there? 3 What are the chemical formulas? H * H 2 + O * O 2 = W * H 2 O H * H 2 + O * O 2 - W * H 2 O = 0 GG 250 F-2004 21

Example 7 (cont. ) What are the basic chemical components? H 2, O 2 How many components are there? 2 How many equations are there? 2 (see next page) GG 250 F-2004 22

Example 7(cont. ) H * H 2 + O * O 2 - W * H 2 O = 0 H 2 O 2 Hydrogen Oxygen H 2 O 2 1 0 0 1 Water H 2 O -1 -0. 5 Matrix equation 2 equations and three unknowns… GG 250 F-2004 23

Example 7(cont. ) More unknowns than equations. Need to reduce the # of unknowns. Let the # of waters (W) = 1. Initial Eqn. [2 x 3] [3 x 1] = [2 x 1] [2 x 2] [2 x 1] + [2 x 1] [1 x 1] =[2 x 1] Revised Eqn. [2 x 2] GG 250 F-2004 [2 x 1] + [2 x 1] = [2 x 1] [2 x 2] [2 x 1] = [2 x 1] 24

Example 7(cont. ) H = 1; O = 0. 5; (W = 1) Balanced chemical equation 1*H 2 + 0. 5*O 2 = 1* H 2 O Now we can see why the solution need not be unique: the coefficients on each side of the equation can be scaled to yield other valid solutions. GG 250 F-2004 25

Example 8 Dimensional Analysis The dimensions of a physical equation must be the same on opposing sides of the equal sign GG 250 F-2004 26

Example 8 (cont. ) Fundamental physical quantities and their SI units M: mass (e. g. , kg) L: length (e. g. , m) T: time (e. g. , sec) : Temperature (e. g. , K) Derived physical quantities Gravitational acceleration (g) = LT-2 (e. g. , m/sec 2) Energy = (Force)(Distance) = (MLT-2) (L) = ML 2 T-2 Pressure = Force/area = (MLT-2)/L 2 = ML-1 T-2 GG 250 F-2004 27

Example 8 (cont. ) Suppose the kinetic energy (E) of a body depends on it mass (M) and its velocity (v), such that E= f (M, v). Find the function f. Focus on the dimensions. E = Ma vb Since L, M, and T are independent terms, the ML 2 T-2 = Ma (L/T)b exponent for each term Dimensioned starting equation must be zero. Hence M 1 L 2 T-2 M-a (L/T)-b = 1 1 -a = 0 1 -a = 0 2 -b = 0 } M 1 -a. L 2 -b. T-2+b = 10 -2+b = 0 Dimensionless equation GG 250 F-2004 28

Example 8 (cont. ) 1 -a = 0 2 -b = 0 -a = -1 -b = -2 -1 a = -1 -1 b = -2 -1 a + 0 b = -1 0 a - 1 b = -2 Matrix equation GG 250 F-2004 29

Example 8 (cont. ) E = M a vb a=1 b=2 So the form of the equation is: E = M 1 v 2 This solution generally will need to be multiplied by a dimensionless constant k. Here the dimensionless constant is 1/2. E = k. M 1 v 2 = (1/2)M 1 v 2 This is the form of the final dimensioned equation. GG 250 F-2004 30

Appendix • Re-arranging elements in a matrix equation GG 250 F-2004

Re-arranging elements in a matrix equation Consider the following equations: a 11 x 1 + a 12 x 2 + a 13 x 3 = b 1 a 21 x 1 + a 22 x 2 + a 23 x 3 = b 2 a 31 x 1 + a 32 x 2 + a 33 x 3 = b 3 These yield the following matrix equation: Coefficient aij acts on element xj to contribute to element bi GG 250 F-2004 32

Re-arranging elements in a matrix equation The equations can be re-arranged: a 12 x 2 + a 11 x 1 + a 13 x 3 = b 1 a 22 x 2 + a 21 x 1 + a 23 x 3 = b 2 a 32 x 2 + a 31 x 1 + a 33 x 3 = b 3 These yield the following matrix equation: Coefficient aij acts on element xj to contribute to element bi GG 250 F-2004 33
- Slides: 33