Artificial Intelligence 🤖
Matrices
Linear algebraic equations

Linear algebraic equations

In this section we use our knowledge of matrices and vectors to solve simultaneous linear equations. Consider nn linear equations,

a11x1+a12x2++a1nxn=b1a21x1+a22x2++a2nxn=b2an1x1+an2x2++annxn=bn\begin{array}{ccc} a_{11} x_{1}+a_{12} x_{2}+\cdots+a_{1 n} x_{n}= & b_{1} \\ a_{21} x_{1}+a_{22} x_{2}+\cdots+a_{2 n} x_{n}= & b_{2} \\ \vdots & \vdots \\ a_{n 1} x_{1}+a_{n 2} x_{2}+\cdots+a_{n n} x_{n}= & b_{n} \end{array}

where aija_{i j} for 1i,jn1 \leq i, j \leq n and bib_{i} for 1in1 \leq i \leq n are given and we wish to solve for x1,x2,,xnx_{1}, x_{2}, \cdots, x_{n}. We can find solutions by writing this system of equations in terms of matrices and vectors as follows

Ax=b,A \boldsymbol{x}=\boldsymbol{b},

where AA is the coefficient matrix given by A=(aij),x=(x1,x2,,xn)A=\left(a_{i j}\right), \boldsymbol{x}=\left(x_{1}, x_{2}, \cdots, x_{n}\right)^{\top} and b=\boldsymbol{b}= (b1,b2,,bn)\left(b_{1}, b_{2}, \cdots, b_{n}\right)^{\top}.

Homogeneous system of equations

We first consider the case b=0\boldsymbol{b}=\mathbf{0}. Then Eq. (10.30) represents a homogeneous system given by,

Ax=0.A \boldsymbol{x}=\mathbf{0} .

We identify two cases:

  1. If AA is non-singular, then A1A^{-1} exists and therefore
A1(Ax)=A10A^{-1}(A \boldsymbol{x})=A^{-1} \mathbf{0}

giving the single solution x=0\boldsymbol{x}=\mathbf{0}. 2. If AA is singular, then there exist a family of infinitely many solutions for x\boldsymbol{x}.

Note that the homogeneous system (10.31) always has the solution x=0\boldsymbol{x}=\mathbf{0}; the zero solution is called the trivial solution. If any nonzero solutions exist they are called nontrivial solutions.

Let us consider a two-dimensional system given by the following equations

ax+by=0,cx+dy=0;\begin{aligned} & a x+b y=0, \\ & c x+d y=0 ; \end{aligned}

for some given constants a,b,c,da, b, c, d. In matrix form, this is represented by

(abcd)(xy)=(00).\left(\begin{array}{ll} a & b \\ c & d \end{array}\right)\left(\begin{array}{l} x \\ y \end{array}\right)=\left(\begin{array}{l} 0 \\ 0 \end{array}\right) .

We can proceed to solve Eqs. (10.33) through

d(ax+by)b(cx+dy)=(adbc)x=0,d(a x+b y)-b(c x+d y)=(a d-b c) x=0,

or, alternatively, from

a(cx+dy)c(ax+by)=(adbc)y=0.a(c x+d y)-c(a x+b y)=(a d-b c) y=0 .

But adbc=detAa d-b c=\operatorname{det} A and so we can see from Eqs. (10.35) and (10.36) that if AA is nonsingular, then detA0\operatorname{det} A \neq 0 and so xx and yy must both be zero. However, if detA=0\operatorname{det} A=0 then adbc=0a d-b c=0 and, assuming aa and cc are both nonzero, we have d/c=b/ad / c=b / a. From Eqs. (10.33), we have

x=bay,x=dcyx=-\frac{b}{a} y, \quad x=-\frac{d}{c} y

It follows, that if d/c=b/ad / c=b / a then the equations in (10.37) give the same information. We have two unknowns, one equation and so we have an under-determined system with infinite solutions. For instance, we can choose y=1y=1 and from that we deduce [using Eqs. (10.37)] that x=b/ax=-b / a. Further, we can set yy to any number while xx is dictated by (10.37). As a solution to Eqs. (10.33) and equivalently (10.34), we have

c=λ(b/a1)c=\lambda\left(\begin{array}{c} -b / a \\ 1 \end{array}\right)

for arbitrary λ\lambda. Thus, we have infinitely many solutions in this case, forming a line through the origin.

We now consider a three-dimensional system,

3x+4y+z=0x+y+2z=02x+5y+3z=0\begin{aligned} 3 x+4 y+z & =0 \\ -x+y+2 z & =0 \\ 2 x+5 y+3 z & =0 \end{aligned}

or, in matrix form,

(341112253)(xyz)=(000)\left(\begin{array}{ccc} 3 & 4 & 1 \\ -1 & 1 & 2 \\ 2 & 5 & 3 \end{array}\right)\left(\begin{array}{l} x \\ y \\ z \end{array}\right)=\left(\begin{array}{l} 0 \\ 0 \\ 0 \end{array}\right)

The first thing to do is calculate the determinant of the matrix to determine whether it is singular. To simplify the calculation we may perform row operations as done in Example 10.7. Using the row operation (R3R1R2)R3\left(R_{3}-R_{1}-R_{2}\right) \rightarrow R_{3}, obtain

detA=341112000\operatorname{det} A=\left|\begin{array}{ccc} 3 & 4 & 1 \\ -1 & 1 & 2 \\ 0 & 0 & 0 \end{array}\right|

it is clear from Eq. (10.41) that the determinant, by expansion along the third row, is zero and the matrix is singular. We notice that the third row of AA is a linear combination of rows 1 and 2 since R3=R1+R2R_{3}=R_{1}+R_{2}; this makes the rows linearly dependent. Informally this means that the third equation gives no further information than that obtained from the first two. We proceed with the first two equations in Eq. (10.39). Like in the 2D system we saw above, we are left with an under-determined system since we have two equations and three unknowns,

3x+4y+z=0x+y+2z=0.\begin{aligned} 3 x+4 y+z & =0 \\ -x+y+2 z & =0 . \end{aligned}

We can rewrite the system (10.42) with z=λz=\lambda for some arbitrary λ\lambda and solve to get y=λy=-\lambda and x=λx=-\lambda; the solution then becomes

x=λ(111)\boldsymbol{x}=\lambda\left(\begin{array}{c} 1 \\ -1 \\ 1 \end{array}\right)

for λR\lambda \in \mathbb{R}. Geometrically we have two planes containing the origin, which intersect along a line.

Nonhomogeneous system of equations

The nonhomogeneous or inhomogeneous case in Eq. (10.30) corresponds to b0\boldsymbol{b} \neq 0. Again, we have two cases:

  1. If AA is non-singular then, A1A^{-1} exits and the unique solution is x=A1b\boldsymbol{x}=A^{-1} \boldsymbol{b};
  2. If AA is singular then, solutions may or may not exist. In that case we have an undetermined system of equations; they are called consistent if solutions exist and inconsistent if solutions do not exist.

We proceed with an example. Consider the linear system

(341112253)(xyz)=(c15)\left(\begin{array}{ccc} 3 & 4 & 1 \\ -1 & 1 & 2 \\ 2 & 5 & 3 \end{array}\right)\left(\begin{array}{l} x \\ y \\ z \end{array}\right)=\left(\begin{array}{l} c \\ 1 \\ 5 \end{array}\right)

where cc is some constant. This is the same matrix used in Eq. (10.40) which we know to be singular and so we want to determine for what values of cc solutions exist. With AA singular, we can deduce that one of its columns is dependent on the other two (for a square matrix, if the rows are dependent so are the columns). To solve the system, we require that (c,1,5)(c, 1,5)^{\top} is a linear combination of two of the columns of AA. Choosing the first and last columns we obtain,

(c15)=λ(312)+μ(123).\left(\begin{array}{l} c \\ 1 \\ 5 \end{array}\right)=\lambda\left(\begin{array}{c} 3 \\ -1 \\ 2 \end{array}\right)+\mu\left(\begin{array}{l} 1 \\ 2 \\ 3 \end{array}\right) .

We solve the following equations for λ\lambda and μ\mu

1=λ+2μ5=2λ+3μ;\begin{aligned} & 1=-\lambda+2 \mu \\ & 5=2 \lambda+3 \mu ; \end{aligned}

there give λ=1\lambda=1 and μ=1\mu=1. It follows that cc must satisfy

c=3λ+μc=3 \lambda+\mu

which gives c=4c=4. Therefore, if c4c \neq 4, no solutions exist. If c=4c=4, the first equation in Eq. (10.43) can be obtained from the second and third equation in Eq. (10.43). To proceed, we set z=λz=\lambda for arbitrary λ\lambda and solve,

3x+4y+λ=4x+y+2λ=1;\begin{aligned} 3 x+4 y+\lambda & =4 \\ -x+y+2 \lambda & =1 ; \end{aligned}

the above equations come from writing out the first two scalar equations from the system in Eq. (10.43). Equations (10.47) give x=λx=\lambda, and y=1λy=1-\lambda. The solution is then described by the line,

x=(010)+λ(111),\boldsymbol{x}=\left(\begin{array}{l} 0 \\ 1 \\ 0 \end{array}\right)+\lambda\left(\begin{array}{c} 1 \\ -1 \\ 1 \end{array}\right),

for λR\lambda \in \mathbb{R}.

To solve systems of linear equations we follow the steps outlined below:

(i) Determine whether the matrix describing the system is singular or not;

(ii) If the matrix is non-singular, we may invert it (see later sections for matrix inversion as well). In the homogeneous case, the only solution is zero. In the nonhomogeneous case, we need to invert the matrix;

(iii) If the matrix is singular, then we know that at least one equation is redundant. For the nonhomogeneous case, we will need to check whether a solution exists. We may establish this by checking whether b\boldsymbol{b} may be written as the linear combination of two of the columns. Once this is established, we set one variable to λ\lambda, acting as the parameter and solve the equations in terms of this free parameter.