1 Simultaneous Linear Equations Gaussian Elimination
One of the most popular techniques for solving simultaneous linear equations of the form Consists of 2 steps 1. Forward Elimination of Unknowns. 2. Back Substitution
Forward Elimination The goal of Forward Elimination is to transform the coefficient matrix into an Upper Triangular Matrix
Forward Elimination Linear Equations A set of n equations and n unknowns..
Forward Elimination Transform to an Upper Triangular Matrix Step 1: Eliminate x 1 in 2 nd equation using equation 1 as the pivot equation Which will yield
Forward Elimination Zeroing out the coefficient of x 1 in the 2 nd equation. Subtract this equation from 2 nd equation Pivot = (a(2,1)/a(1,1)) For i=1:var+1 i:all element in the same equation a(2,i) = a(2,i) - (pivot * a(1,i) ) end
This procedure is repeated for the remaining equations to reduce the set of equations as... For j=1+1:var j: all equations 1: to eleminate x1 Pivot = (a( j,1)/a(1,1)) For i=1:var+1 a( j,i) = a( j,i) - (pivot * a(1,i) ) End end
Forward Elimination Step 2: Eliminate x 2 in the 3 rd equation. Equivalent to eliminating x 1 in the 2 nd equation using equation 2 as the pivot equation. This procedure is repeated for the remaining equations to reduce the set of equations
Forward Elimination Continue this procedure by using the third equation as the pivot equation and so on. For nx=1:var-1 xn:all the x in all equations For j=nx+1:var j: all equations Pivot = (a( j,nx)/a(nx, nx)) For i=1:var+1 i:all element in the same equation a( j,i) = a( j,i) - (pivot * a(nx,i) ) End end
At the end of (n-1) Forward Elimination steps, the system of equations will look like:..
Forward Elimination At the end of the Forward Elimination steps
Back Substitution The goal of Back Substitution is to solve each of the equations using the upper triangular matrix. Example of a system of 3 equations
Back Substitution Start with the last equation because it has only one unknown Solve the second from last equation using x n solved for previously. This solves for x n-1.
Back Substitution Representing Back Substitution for all equations by formula For i=n-1, n-2,….,1 and
For z= var : -1 : 1 sum= 0 For w=z+1 : 1 : var Sum =sum+(a(z,w)*x(w)) End X(z)= (a(z,4)- sum) / a(z,z) end
Example: Rocket Velocity The upward velocity of a rocket is given at three different times Time, tVelocity, v s m/s
Example: Rocket Velocity Forward Elimination: Step 1 Yields
Example: Rocket Velocity Yields Forward Elimination: Step 1
Example: Rocket Velocity Yields This is now ready for Back Substitution Forward Elimination: Step 2
Example: Rocket Velocity Back Substitution: Solve for a 3 using the third equation
Example: Rocket Velocity Back Substitution: Solve for a 2 using the second equation
Example: Rocket Velocity Back Substitution: Solve for a 1 using the first equation
Example: Rocket Velocity Solution: The solution vector is The polynomial that passes through the three data points is then:
Example: Rocket Velocity Solution: Substitute each value of t to find the corresponding velocity