1. Chapter 5
SOLVING THE SYSTEMS OF LINEAR EQUATIONS
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 1
2. Solving the linear algebraic equation
The equations
Have graphs that intersect at the solution y=4, x=7
Can be solve by MATLAB programing
6 10 2
3 4 5
x y
x y
[6 10;3 4]
6 10
3 4
[2; 5]
2
5
A
A
B
B
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 2
4. MATLAB calculation of root
The MATLAB command inv(A) computes the inverse of the matrix A. The following MATLAB session solves
the following equations using MATLAB.
2x + 9y = 5
3x - 4y = 7
>>A = [2,9;3,-4];
>>b = [5;7]
>>x = inv(A)*b
x =
2.3714
0.0286 If you attempt to solve a singular problem using the inv command, MATLAB displays an
error message.
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 4
5. Cramer’s rule
Solves equations using determinants. Gives insight into the existence and
uniqueness of solutions and into the effects of numerical inaccuracy.
Cramer’s determinant D is the determinant of the matrix A in the matrix form Ax =
b. D = |A|.
When the number of variables equals the number of equations, a singular problem
can be identified by computing Cramer’s determinant D.
If the determinant D is zero, the equations are singular because D appears in the
denominator of the solutions.
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 5
6. Cramer’s rule
Cramer’s Determinant and Singular Problems
For the set
3x - 4y = 5
6x - 8y = 3
Cramer’s determinant is
D = 3(8) – (-4)(6) = 0
Because D = 0, the equation set is singular.
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 6
7. Cramer’s rule
In general, for a set of homogeneous linear algebraic equations
that contains the same number of equations as unknowns,
● a nonzero solution exists only if the set is singular; that is, if
Cramer’s determinant is zero;
● furthermore, the solution is not unique.
If Cramer’s determinant is not zero, the homogeneous set has a
zero solution; that is, all the unknowns are zero.
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 7
8. Cramer’s rule
You can use determinants to solve a system of linear equations.
You use the coefficient matrix of the linear system.
Linear System Coeff Matrix
ax+by=e
cx+dy=f
If then the system has exactly one solution:
dc
ba
det 0A
A
df
be
x
det
A
fc
ea
y
det
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 8
9. Example 1
Solve the system:
8x+5y=2
2x-4y=-10
The coefficient matrix is:
42
58
42)10()32(
42
58
42
410
52
x
42
102
28
y
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 9
11. Example 2
Solve the system:
2x+y=1
3x-2y=-23
The solution is: (x, y)=(-3,7) !!!
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 11
12. Example 3
Solve the system:
x+3y-z=1
-2x-6y+z=-3
3x+5y-2z=4 1
4
4
253
162
131
453
362
131
z
Let’s solve for Z
The answer is: (-2,0,1)!!!
Z=1
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 12
13. Slide ends here for
chapter 5
Dr. Mohammed Danish,
Malaysian Institute of Chemical and Bioengineering Technology,
UNIKL, Alor gajah 7800 Melaka, Malaysia
4/5/2016 DR. MOHAMMED DANISH/UNIKL-MICET 13