16 LP 2 1 Substitution
16 LP 2 1 Substitution
16 LP 2 1 Substitution
Daniel Kane
Department of Computer Science and Engineering
University of California, San Diego
x +y = 5
2x + 4y = 12.
Method of Substitution
x +y = 5
2x + 4y = 12.
Example
x +y = 5
2x + 4y = 12.
First equation implies
x = 5 − y.
Example
x +y = 5
2x + 4y = 12.
First equation implies
x = 5 − y.
Substituting into second:
12 = 2x + 4y = 2(5 − y ) + 4y = 10 + 2y .
Example
x +y = 5
2x + 4y = 12.
First equation implies
x = 5 − y.
Substituting into second:
12 = 2x + 4y = 2(5 − y ) + 4y = 10 + 2y .
So y = 1, x = 5 − 1 = 4.
Problem
x + 2y = 6
3x − y = −3.
Solution
x = 6 − 2y .
Solution
x = 6 − 2y .
−3 = 3(6 − 2y ) − y = 18 − 7y .
Solution
x = 6 − 2y .
−3 = 3(6 − 2y ) − y = 18 − 7y .
Solving gives, y = 3, so x = 6 − 2 · 3 = 0.
Another Example
x +y +z = 5
2x + y − z = 1.
Another Example
x +y +z = 5
2x + y − z = 1.
Solve by substitution.
Solution
x = 5 − y − z.
Solution
x = 5 − y − z.
2(5 − y − z) + y − z = 1,
or
y = 9 + 3z.
Cannot Solve for z!
No equations left.
Cannot Solve for z!
y = 9 + 3z
x = 5 − y − z = −4 − 4z.
Cannot Solve for z!
y = 9 + 3z
x = 5 − y − z = −4 − 4z.