analytical toolbox simultaneous equations by dr j.p.m. whitty
TRANSCRIPT
Analytical Toolbox
Simultaneous Equations
By
Dr J.P.M. Whitty
2
Learning objectives
• After the session you will be able to:• Find the solution to two simultaneous equations
using graphical means.• Algebraic solutions to systems of two equations.• Appreciate the solution protocol required for
systems of three equations.• Use math software to solve systems of equations.
3
Learning Check: Finding the Line
• Here’s the StarGate bit:• A point in three dimensions needs six pieces of
information to be fully described.• A course therefore seven • Since a line exists essentially in 2D then only two
pieces of information.• Two points• A gradient and a point
4
Example
Find the equation of the line given that it passes though the points (-2,1) and (6,5)
2
1
62
51Gradient theFind
x
ym
cxy 2
1intercept theFind
c )5(2
16 do point willAny c )2(
2
11or
5
Examples
1. Find the equation of the line given the points (-2,4) and (4,1) expressing your answer in the form ax+by=c.
2. A line has a gradient of –0.75 and passes through a point (3,-4), state the equation of the line.
3. Find the equation of a line with a gradient of unity given that it passes through the point (-1,-2).
6
Learning Check
Solve the following using a graphical method
y=2x -1 & y= 8-x
Hence, use MATLAB to verify your results.
Q. Is there a way to solve such problems algebraically?
7
Class Examples Time
• Solve the following problems using a graphical method (via MATLAB) and verify the results using substitution
• y=x+3 & y=7-x• y=x-4 & 2x+y=5• x+y =3 & y=1-2x• y=x+4 & y=3x• y=2x-1 & y=3x+2
8
Algebraic Solution One way to obtain an algebraic solution is to
substitute one equation into the other and obtain the solution of the resulting linear equation. Thus:
• y=x+3 (1) & y=7-x (2)• x+3=7-x• 2x=4; x=2• y=x+3=5 • Also 7-2=5 (which satisfies the second)
9
Algebraic Solution Continued
Solve the following simultaneously x+y =3 & y=1-2x• x+(1-2x)=3• -1x=2• x=-2• -2+y=3; y=5• Does the other equation fire also?
10
Class Examples Time• Use the method of substitution • y=x-4 & 2x+y=5• y=x+4 & y=3x• y=2x-1 & y=3x+2
11
Method of Elimination
Let us consider the class examples Let us consider the class examples again written in a slightly different again written in a slightly different form, i.e. equating the variables to a form, i.e. equating the variables to a number thusnumber thus• y-x=-4 & y+2x=5y-x=-4 & y+2x=5• y-x=4 & y-3x=0y-x=4 & y-3x=0• y-2x=1 & y-3x=2y-2x=1 & y-3x=2• Since in each of these examples that Since in each of these examples that coefficients of y are identical than we are just coefficients of y are identical than we are just able to subtract the equationsable to subtract the equations
12
Method of Elimination Write on equation under the other thus y - x=4 y+2x=5 0-3x=-9 x=3; y-3=4; y=1 Does the other equation also fire?
13
Method of Elimination This method can be used when ever the either the x
or the y coefficients are the same: consider:• 3x+y=7 & x+y=3• 5x+4y=17 & 3x+4y=15• Additionally if the signs are different we add instead
of subtracting• 5x-2y=5 & 3x+2y=19• 4x+3y=19 & 2x-3y=5
14
Class Examples Time• Solve the following simultaneous equations using the
method of elimination verity your answers using MATLAB.
• 2x+y=8 & x-y=1• 2x+3y=14 & 2x-y=6• 3x+5y=5 & x–5y =15• 3x+2y=13 & 3x+y=9• 6x+5y=3 & 2x+5y=9
15
Equations with unlike coefficients So far we have only considered sets of
equations where the coefficients of either the x or the y values are the same. A problem occurs when this is NOT the case, consider:
• 2x+ y= 9• 5x+2y=22
16
General Method of Ellimination(Cross Multiplication)
The method of attack is ALWAYS the same regardless and is as follows:
A. Multiply the first equation by the coefficient of y in the second equation.
B. Multiply the second equation by the coefficient of y in the first equation.
C. The coefficients of y are now equal so they can now be solved as previously. (i.e. if they have the same sign subtract otherwise add)
17
Cross multiplication Let us now consider
how this works when applying this to the last example.
• 2x+ y= 9 (1)• 5x+2y=22 (2)
• 2(2x+ y= 9) (1)• 1(5x+2y=22) (2)
4x+2y=18 4x+2y=18 (1)(1)5x+2y=22 5x+2y=22 (2)(2)
-1x+0=-4-1x+0=-4x=4x=4
2(4)+y=92(4)+y=9y=1y=1
18
Discussion Examples Use the general method of elimination to
solve the following:
1. 2x+y=18 & 2x-3y=1
2. 5x+2y=18 & 7x-8y=9
3. 8x+7y=22 & 12x-5y=2
4. 3x-4y=1 & 9x-7y=13
5. 2x-3y=8 & 8x+15y=5
19
Summary
Simultaneous equations can be solve via the method substitution or elimination generally the following rules apply to which method should be used Method of substitution if one of the equations y=mx+c
of x=ay+b then substitute this equation into the other. If the equations are both un the form ax+by=c then
use the elimination method
20
Solution of three simultaneous equations
12627
8735
26432
321
321
321
III
III
III
Problems occur in scientific and engineering problems where more unknowns are required. Hence more equations are required. We will only concern ourselves here with three unknowns as in principle the methods shown in this lecture can easily be extended.
21
Discussion Examples
62
9532
1043
)1
zyx
zyx
zyx
How would we approach these problems:
2223
33432
4
)2
zyx
zyx
zyx
22
Use of mathematic Software
Once you have more than four equations even with the higher math methods of Matrices and Determinates it is still cumbersome and due to the amount of computations errors inevitably creep in to calculation. Thus the need for computer solutions of such systems of equations is self evident. To solve such systems we can use a number of math software packages inc. MatLab & Derive
23
Computer Solutions of Equations
Let us consider the systems of equations as before:The solution protocol is the same each time using the math package
62 3#
9532 2#
1043 1#
zyx
zyx
zyx
Go to SOLVE in the top menu
Select system and enter the appropriate expression numbers (in this case #1,#2 and #3)
The package then returns the solution vector for the system
24
MatLab Computer Solution
12627
8735
26432
)1
321
321
321
III
III
IIIUse the following method to solve the following systems of equations:
2223
33432
4
)2
zyx
zyx
zyx
I. Type each of the coefficients on the RHS into a matrix A=[2, 4, -4;1 -5 -3; -7 2 6] (Important to remember the semicolons)
II. Type the RHS as a column vector [26; -87; 12]
III. Type in x=A\b and the system will return the solution (NB a backslash \ is required)
25
Summary
• Have we met our learning objectives?• Specifically: are you able to:
• Find the solution to two simultaneous equations using graphical means.
• Algebraic solutions to systems of two equations.• Appreciate the solution protocol required for systems of
three equations.• Use math software to solve systems of equations.
26
Derive Solution of Equations
Let us consider the systems of equations as before:The solution protocol is the same each time using the math package
62 3#
9532 2#
1043 1#
zyx
zyx
zyx
Go to SOLVE in the top menu
Select system and enter the appropriate expression numbers (in this case #1,#2 and #3)
The package then returns the solution vector for the system
27
Homework
1. Find the equation of the line given the points (-1,6) and (4,1) expressing your answer in the form ax+by=c.
2. A line has a gradient of 1/2 and passes through a point (-2,4), state the equation of the line.
3. Find the equation of a line with a gradient of unity given that it passes through the point (0,-4).
28
Homework
Use the most suitable method to solve the following simultaneous equations:
1. 7x-10y=16 & 4x-15y=372. y=3x-1 & 2y-6x=23. 3x-5y=13 & 7x+3y=14. 3x+5y=5 & x-5y=155. 3x+2y=8 & 7x+10y=24