Matrix Methods for Linear Equations

Sets of linear algebraic equations can be expressed in matrix notation, a standard and compact method that is useful for expressing solutions and for developing software applications with an arbitrary number of variables. This section describes the use of matrix notation.
As you saw in Chapter 2, a matrix is an ordered array of rows and columns containing numbers, variables, or expressions. A vector is a special case of a matrix that has either one row or one column. A row vector has one row. A column vector has one column. In this chapter a vector is taken to be a column vector unless otherwise specified. Usually, when printed in text, lowercase boldface letters denote a vector, and uppercase boldface letters denote a matrix. . Matrix notation enables us to represent multiple equations as a single matrix equation. For example, consider the following set:


The matrix A corresponds in an ordered fashion to the coefficients of X1 and X2
in (6.2-1) and (6.2-2). Note that the first row in A consists of the coefficients of

X1 and X2 on the left side of (6.2-1). and the second row contains the coefficients
on the left side of (6.2-2). The vector x contains the variables X1 and X2, and the
vector b contains the right sides of (6.2-1) and (6.2-2).
In general, the set of m equations in n unknown


The matrix A has m rows and n columns, so its dimension is expressed as m x n.
Determinants are useful for finding out whether a set of equations has a solution. A determinant is a special square array that, unlike a matrix, can be reduced to a single number. Vertical bars are used to denote a determinant, whereas square brackets denote a matrix. A determinant having two rows and two columns is a
2 x 2 determinant. The rule for reducing a 2 x 2 determinant to a single number
is shown below


Rules exist to evaluate n x n determinants by hand, but we can use MATLAB to do this. First enter the determinant as an array. Then use the det function to evaluate the determinant. For example, a MATLAB session to compute the

would look like:
»A = [3,-4,1;6,10,2;9,-7,8);
»det( A)
ans =

As we have seen, a determinant is not the same as a matrix, but a determinant
can be found from a matrix. In the previous MATLAB session, MATLA B can treat
the array A as matrix. When it executes the function det  (A) , MATLAB obtains
a determinant from the matrix A. The determinant obtained from the matrix A is
expressed as IAI.
Determinants and Singular Problems
We saw in Section 6.1 that a singular problem refers to a set of equations that has either no unique solution or no solution at all. We can use the matrix A in the equation set Ax = b to determine whether or not the set is singular. For example, in Section 6.1, we saw that the set
3x – 4y = 5
6x – 8y = 10
has no unique solution, because the second equation is identical to the first equation, multiplied by 2. The matrix A and the vector b for this set are

The fact that IAI = 0 indicates that the equation set is singular. We have not proved this statement, but it can be proved. Consider another example from Section 6.1.
3x – 4y = 5
6x – 8y = 3
This set has no solution. The matrix A is the same as for the previous set, but the
vector b is different.

Because )A) = 0, this equation set is also singular. These two examples show that if IAI = 0, the set has either no unique solution or no solution at all. Now consider another example from Section 6.1, a set of homogeneous equations (the right-hand sides are all zero):
6x +ay = 0
where a is a parameter. As we saw in Section 6.1, this set has the solution x = y = 0 unless a = 12, in which case there are an infinite number of solutions of the form x = -2y. The matrix A and the vector b for this set are

Thus if a = 12, IAI = 0 and the equation set is singular. These examples indicate that for the equation set Ax = b, if IAI = 0, then there is no unique solution. Depending on the values in the vector b, there may be no solution at all, or an infinite number of solutions.

The Left-Division Method
MATLAB provides the left-division method for solving the equation set Ax = b. The left-division method is based on Gauss elimination. To use the left-division method to solve for x, type x = A /b. This method also works in some cases where the number of unknowns does not equal the number of equations. However, this section focuses on problems in which the number of equations equals the number of unknowns. In Sections 6.4 and 6.5, we examine other cases. If the number of equations equals the number of unknowns and if IAI =I- 0, then the equation set has a solution and it is unique. If IAI = 0 or if the number of equations does not equal the number of unknowns, then you must use the methods presented in Section 6.4.

The backward slash (\) is used for left division. Be careful to distinguish between the backward slash (\) and the forward slash (I) which is used for right division. Sometimes equation sets are written as xC = d, where x and d are row vectors. In that case you can use right division to solve the set xC = d for x by typing x =  d/c, or you can convert the equations to the form Ax = b. For example, the matrix equation


corresponds to the equations
6Xt + 3X2 = 3
2Xt +5X2 == -19


which is in the form Ax = b. Linear equations are useful in many engineering fields. Electrical circuits are
a common source of linear equation models. The circuit designer must be able to solve them to predict the currents that will exist in the circuit. This information is often needed to determine the power supply requirements, among other things

Matrix Inverse
The solution of the scalar equation ax = b is x = b/a if a =/. O. The division operation of scalar algebra has an analogous operation in matrix algebra. For example, to solve the matrix equation
Ax=b                                                             (6,2-9)
for x, we must somehow “divide” b by A. This procedure is developed from the concept of a matrix inverse. The inverse of a matrix A is defined only if A is square and non-singular. It is denoted by A-1 and has the property that
A-IA = AA-I = I                                                   (6.2-10)
where I is the identity matrix. Using this property, we multiply both sides of
(6.2-9) from the left by A-I to obtain
A-lAx = A-1b
Because A-I Ax = Ix = x, we obtain
x = A-1b                                                              (6.2-11)
The solution form (6.2-11), x = A-I b, is rarely applied in practice to obtain numerical solutions, because calculation of the matrix inverse is subject to numerical inaccuracy, especially for large matrices. However, the equation x = A-I b is a concise representation of the solution and therefore is useful for developing
symbolic solutions to problems (for example, such problems are encountered in the solutions of differential equations; see Chapters 8 and 10).

The matrix equation Ax = b possesses the linearity property. The solution x is x = A-I b, and thus x is proportional to the vector b. We can use this fact to obtain a more generally useful algebraic solution in cases where the right sides are all multiplied by the same scalar. For example, suppose the matrix equation is Ay = bc, where c is a scalar. The solution is y = A-1bc = xc. Thus if we obtain the solution to Ax = b, the solution to Ay = bc is given by y = xc. We demonstrate the usefulness of this fact in Example 6.2-4.
When designing structures, engineers must be able to predict how much force will be exerted on each part of the structure so that they can properly select the part’s size and material to make it strong enough. The engineers often must solve linear equations to determine these forces. These equations are obtained by
applying the principles of statics, which state that the vector sums of forces and moments zero if the structure does not move.

Calculating a matrix inverse by hand is tedious. The inverse of a 3 x 3 matrix requires us to evaluate nine 2 x 2 determinants. We do not give the general procedure here because we will soon explain how to use MATLAB to compute a matrix inverse. The details of computing a matrix inverse can be found in many texts; for example, see [Kreyzig, 1998]. However, the inverse of a 2 x 2 matrix

Calculation of A-I can be checked by determining whether A-IA’=I. Note that the preceding formula shows that A-I does not exist if IAI = 0 (that is, if A is singular).

The Matrix Inverse in MATLAB
The MATLAB command inv (A) computes the inverse of the matrix A.•The following MATLAB session solves the equations given in Example 6.2-5 using MATLAB.
»A = [2,9;3,-4);
»b = [5;7)
»x inv(A)*b
If you attempt to solve a singular problem using the inv command, MATLAB
displays an error message.

Test Your Understanding
T6.2-1 Use the matrix inverse method to solve the following set by hand and by
using MATLAB
3x – 4y = 5
6x – 10y = 2
(Answer: x =7, y =4.)
T6.2-2 Use the matrix inverse method to solve the following set by hand and by
using MATLAB:
3x – 4y =5
6x – 8y = 2
(Answer: no solution.)

Share This