If in an equation, a variable stands in a matrix form, then that equation is known as matrix equation. We can solve such type of equations using the following operations:

• Matrix Subtraction
• Matrix Multiplication

## How to Solve Matrix Equations?

Here, let us learn how to solve matrix equations with the help of the following examples.

### Solved Examples

Question 1: Solve for the matrix Z in Z + $\begin{bmatrix} 5 &2 \\ 4 &1 \end{bmatrix}$= $\begin{bmatrix} 7 &4 \\ 5 &3 \end{bmatrix}$
Solution:
We have = Z + $\begin{bmatrix} 5 &2 \\ 4 &1 \end{bmatrix}$ = $\begin{bmatrix} 7 &4 \\ 5 &3 \end{bmatrix}$

Z = $\begin{bmatrix} 7 &4 \\ 5 &3 \end{bmatrix}$ - $\begin{bmatrix} 5 &2 \\ 4 &1 \end{bmatrix}$

Z = $\begin{bmatrix} 2 &2 \\ 1 &2 \end{bmatrix}$

Question 2: If 3 $\begin{bmatrix} y &4 \\ 6 &x-1 \end{bmatrix}$ + $\begin{bmatrix} 3 &-1 \\ 1&1 \end{bmatrix}$ = $\begin{bmatrix} 9 &5 \\ 4 &2 \end{bmatrix}$, find the value of x and y.
Solution:
We have 3 $\begin{bmatrix} y &4 \\ 6 &x-1 \end{bmatrix}$ + $\begin{bmatrix} 3 &-1 \\ 1&1 \end{bmatrix}$ = $\begin{bmatrix} 9 &5 \\ 4 &2 \end{bmatrix}$

$\begin{bmatrix} 3y &12 \\ 18 &3x-3 \end{bmatrix}$ = $\begin{bmatrix} 9 &5 \\ 4 &2 \end{bmatrix}$ - $\begin{bmatrix} 3 &-1 \\ 1&1 \end{bmatrix}$
$\begin{bmatrix} 3y &12 \\ 18 &3x-3 \end{bmatrix}$ = $\begin{bmatrix} 6 &6 \\ 3&1 \end{bmatrix}$

Here, we can easily use matrix equality property.

3y = 6 and 3x-3 =1

y = 2 and x = 4/3

## Solving Systems of Equations with Matrix

A collection of linear equations is known as a system of linear equation, involving the same set of unknown variables, like
2a + b - 3c = 6
a + 3b + c = 5
-a - 2b + 2c = 4
is the system of three equations with three variables a, b and c. If we find out the values of a, b and c that satisfies the above given set of equations simultaneously, then that set of values is called the solution of the given system.

### Solving System of Linear Equations using Matrix

A system of equation, in which each equation is in the linear form is said to be system of linear equation. Consider the set of m simultaneous linear equations with n unknowns as follows:

a11 x1 + a12 x2 + a13 x3 + ...................+ a1n xn = b1
a21 x1 + a22 x2 + a23 x3 + ...................+ a2n xn = b2
.................................................................................
.................................................................................
.................................................................................
am1 x1 + am2 x2 + am3 x3+ ..................+ amn xn = bm

Here, x1, x2 ......xn are unknown variables and the a's and b's are known constants. To solve this system of linear equations by the use of matrix method, first we have to convert it into the matrix form. For this, let Amxn be the matrix in which all a's are present. Bmx1 denote the column matrix formed by all b's and Xnx1 be the matrix formed by unknown variables.

A = $\begin{bmatrix} a_{11} &a_{12} &.. &.. &a_{1n} \\ a_{21} &a_{22} &.. &.. &a_{2n} \\ .. &.. &.. &.. &.. \\ .. &.. &.. &.. &.. \\ a_{m1} &a_{m2} &.. &.. &a_{mn} \end{bmatrix}$ = [ aij ] = coefficient matrix of the system

X = $\begin{bmatrix} x_{1}\\ x_{2}\\ .\\ .\\ x_{n} \end{bmatrix}$ and B = $\begin{bmatrix} b_{1}\\ b_{2}\\ .\\ .\\ b_{m} \end{bmatrix}$

So, the matrix representation of the set of linear equations is as follows:

$\begin{bmatrix} a_{11} &a_{12} &.. &.. &a_{1n} \\ a_{21} &a_{22} &.. &.. &a_{2n} \\ .. &.. &.. &.. &.. \\ .. &.. &.. &.. &.. \\ a_{m1} &a_{m2} &.. &.. &a_{mn} \end{bmatrix}$ . $\begin{bmatrix} x_{1}\\ x_{2}\\ .\\ .\\ x_{n} \end{bmatrix}$ = $\begin{bmatrix} b_{1}\\ b_{2}\\ .\\ .\\ b_{n} \end{bmatrix}$

AX = B

For values of unknown variables, we can write the above equation as follows:

X = A-1B
This is valid only if IAI $\neq$ 0.

### Solved Example

Question: If x + y + z = 4, 2x + y - z = 1, x - y + 2z = 2 is the set of linear equations, find the value of x, y and z by matrix method.
Solution:
We have x + y + z = 4
2x + y - z = 1
x - y + 2z = 2
First, convert it into matrix form,
$\begin{bmatrix} 1 &1 &1 \\ 2 &1 &-1 \\ 1 &-1 &2 \end{bmatrix}$ . $\begin{bmatrix} x\\ y\\ z \end{bmatrix}$= $\begin{bmatrix} 4\\ 1\\ 2 \end{bmatrix}$

$\begin{bmatrix} x\\ y\\ z \end{bmatrix}$ = $\begin{bmatrix} 1 &1 &1 \\ 2 &1 &-1 \\ 1 &-1 &2 \end{bmatrix}^{-1} . \begin{bmatrix} 4\\ 1\\ 2 \end{bmatrix}$

We know that, A-1 = $\frac{adj A}{\left | A \right |}$

= $\frac{1}{\left | A \right |}$ .adj A
Here, |A| = -7$\neq$ 0

and adj A = $\begin{bmatrix} 1 &-3 &-2 \\ -5 &1 &3 \\ -3 &2 &-1 \end{bmatrix}$

Then, A-1 = $\frac{1}{-7}$ x $\begin{bmatrix} 1 &-3 &-2 \\ -5 &1 &3 \\ -3 &2 &-1 \end{bmatrix}$

Therefore, $\begin{bmatrix} x\\ y\\ z \end{bmatrix}$ = $\frac{1}{-7}$ x $\begin{bmatrix} 1 &-3 &-2 \\ -5 &1 &3 \\ -3 &2 &-1 \end{bmatrix}. \begin{bmatrix} 4\\ 1\\ 2 \end{bmatrix}$

$\begin{bmatrix} x\\ y\\ z \end{bmatrix}$ = $\frac{1}{-7}$ x $\begin{bmatrix} -3\\ -13\\ -12 \end{bmatrix}$

Hence, using the matrix equality property, we get
x = 3/7, y = 13/7 and z = 12/7.

These values satisfy the above set of equations. And so, these values are the solution of the given system.

## Cramer's Rule

In matrices, we use the determinant for finding the inverse of a matrix. For this, the matrix is non-singular i.e. determinant of the matrix is non-zero. In the Cramer's rule, we use this property of determinant for finding the solution of linear equations. In Cramer's rule, we express the set of linear equations in matrix form and the solution in terms of the determinant of the coefficient matrix. The matrices are formed by replacing one column by the basis vector.

Consider the two linear equations shown below:
a11 x + a12 y = b1
a21 x + a22 y =b2,

Then, by Cramer's rule,

x = $\frac{\begin{vmatrix} b_{1} &a_{12} \\ b_{2} &a_{22} \end{vmatrix}}{\begin{vmatrix} a_{11} &a_{12} \\ a_{21} &a_{22} \end{vmatrix}}$, y = $\frac{\begin{vmatrix} a_{11} &b_{1} \\ a_{21} &b_{2} \end{vmatrix}}{\begin{vmatrix} a_{11} &a_{12} \\ a_{21} &a_{22} \end{vmatrix}}$

Here, $\begin{vmatrix} a_{11} &a_{12} \\ a_{21} &a_{22} \end{vmatrix}$ is non-zero.

Consider the three linear equations as follows:

Let a1x + b1y + c1z = d1
a2x + b2y + c2z = d2
a3x + b3y + c3z = d3

Then applying Cramer's rule,

D = $\begin{vmatrix} a_{1} &b_{1} &c_{1} \\ a_{2} &b_{2} &c_{2} \\ a_{3} &b_{3} &c_{3} \end{vmatrix}$.$\neq$ 0

Dx = coefficient determinant with constant column in x-column = $\begin{vmatrix} d_{1} &b_{1} &c_{1} \\ d_{2} &b_{2} &c_{2} \\ d_{3} &b_{3} &c_{3} \end{vmatrix}$

Dy = coefficient determinant with constant column in y-column = $\begin{vmatrix} a_{1} &d_{1} &c_{1} \\ a_{2} &d_{2} &c_{2} \\ a_{3} &d_{3} &c_{3} \end{vmatrix}$

Dz = coefficient determinant with constant column in z-column = $\begin{vmatrix} a_{1} &b_{1} &d_{1} \\ a_{2} &b_{2} &d_{2} \\ a_{3} &b_{3} &d_{3} \end{vmatrix}$

Hence, x = $\frac{Dx}{D}$, y = $\frac{Dy}{D}$, z = $\frac{Dz}{D}$

### Solved Examples

Question 1: Let 2x + 3y = -10 and x - y = 1 are the set of equations. Then, find the value of x and y, using Cramer's rule.
Solution:
2 x + 3 y = -10 and x - y = 1

$\begin{vmatrix} 2&3 \\ 1&-1 \end{vmatrix}$ = -2 -3 = -5 $\neq$ 0

x = $\frac{\begin{vmatrix} -10 &3 \\ 1&-1 \end{vmatrix}}{\begin{vmatrix} 2 &-10 \\ 1&1 \end{vmatrix}}$ and y = $\frac{\begin{vmatrix} 2 &-10 \\ 1&1 \end{vmatrix}}{\begin{vmatrix} 2 &-10 \\ 1&1 \end{vmatrix}}$

x = $\frac{7}{-5}$ and y = $\frac{12}{-5}$

So, x = -7/5 and y = -12/5

Question 2: If x + y + z = 6, x - y + 2 z = 5 and 3 x + y + z = 8 be the set of linear equations, find the values of x, y and z by the use of Cramer's rule.
Solution:
First, we have to find the determinant of the coefficient matrix,

D = $\begin{vmatrix} 1 &1 &1 \\ 1 &-1 &2 \\ 3 &1 &1 \end{vmatrix}$ = 1 $\begin{vmatrix} -1 &2 \\ 1 &1 \end{vmatrix}$ - 1 $\begin{vmatrix} 1 &2 \\ 3&1 \end{vmatrix}$ + 1 $\begin{vmatrix} 1 &-1 \\ 3& 1 \end{vmatrix}$
D = 1(-1 - 2) - 1(1 - 6) + 1(1 + 3) = -3 + 5 + 4 = 6 $\neq$ 0

Dx = $\begin{vmatrix} 6 &1 &1 \\ 5 &-1 &2 \\ 8&1 &1 \end{vmatrix}$

= 6 $\begin{vmatrix} -1 &2 \\ 1 &1 \end{vmatrix}$ - 1 $\begin{vmatrix} 5 &2 \\ 8 &1 \end{vmatrix}$ + 1 $\begin{vmatrix} 5 &-1 \\ 8 &1 \end{vmatrix}$ = 6(-1 - 2) -1(5 - 16) + 1(5 + 8)

Dx = -18 + 11 + 13 = 6

Dy = $\begin{vmatrix} 1 &6 &1 \\ 1 &5 &2 \\ 3 &8 &1 \end{vmatrix}$

= 1 $\begin{vmatrix} 5 &2 \\ 8 &1 \end{vmatrix}$ -6 $\begin{vmatrix} 1 &2 \\ 3 &1 \end{vmatrix}$ + 1 $\begin{vmatrix} 1 &5 \\ 3 &8 \end{vmatrix}$ = 1(5 - 16) - 6(1 - 6) + 1(8 - 15)

Dy = -11 + 30 - 7 = 12

Dz = $\begin{vmatrix} 1 &1 &6 \\ 1 &-1 &5 \\ 3 &1 &8 \end{vmatrix}$

= 1 $\begin{vmatrix} -1 &5 \\ 1 &8 \end{vmatrix}$ -1 $\begin{vmatrix} 1 &5 \\ 3 &8 \end{vmatrix}$ + 6 $\begin{vmatrix} 1&-1 \\ 3 &1 \end{vmatrix}$ = 1(-8 - 5) - 1(8 - 15) + 6(1 + 3)

Dz = -13 + 7 + 24 = 18
We know that x = $\frac{Dx}{D}$, y = $\frac{Dy}{D}$, z = $\frac{Dz}{D}$

x = 6/6 = 1 , y = 12/6 = 2 and z = 18/6 = 3.

## Cayley Hamilton Method

Every square matrix satisfies its own characteristic equation. If A be any square matrix then, $\left ( A - \lambda I \right )X = 0$, where $\lambda$ be the eigenvalue of the equation corresponding to the eigenvector. Here, In be the identity matrix. So, if A be any square matrix of order nxn then,

$\left | A -\lambda I \right |= 0$

Therefore, $(-1)^{n}\lambda ^{n}+ c_{1}\lambda ^{n-1}+ c_{2}\lambda ^{n-2}+.....+c_{n-1}\lambda + c_{n}I_{n}= 0$, be the characteristic equation. Then, matrix A satisfies the above equation.

Hence, $(-1)^{n}A ^{n}+ c_{1}A ^{n-1}+ c_{2}A ^{n-2}+.....+c_{n-1}A + c_{n}I_{n}= 0$

### Working Rule of Cayley Hamilton Method

Step 1: Write down the determinant IA - $\lambda$ InI = 0, which gives the characteristic equation of the matrix.
Step 2: After solving the characteristic equation, we have to find all its roots or say eigenvalues of A.
Step 3: To find the eigenvector corresponding to each eigenvalue, solve the matrix equation (A - $\lambda$ In)X = 0. We set $\lambda$ = $\lambda_{1}$ and solve it for X (eigenvector). For other eigenvalues and eigenvectors, we follow the same method.

### Solved Example

Question: Find the eigenvalues and eigenvectors of the matrix A = $\begin{bmatrix} -3 &8 \\ -2&7 \end{bmatrix}$
Solution:
For the matrix A, we can write

| A - $\lambda$ In| = $\begin{vmatrix} -3-\lambda &8 \\ -2&7- \lambda \end{vmatrix}$

= (-3 -$\lambda$)(7-$\lambda$) + 16

= $\lambda^2$ - 4$\lambda$ - 5 ..........................................(a)

Therefore, characteristic equation for A is |A - $\lambda$ In| = 0

$\lambda^2$ - 4$\lambda$ - 5 = 0

($\lambda$ - 5 )( $\lambda$ + 1) = 0

So, we get two eigenvalues(roots of A), $\lambda_1$ = 5 and $\lambda_2$ = -1.

Then, for eigenvectors, the matrix equation (A - $\lambda$ I)X = 0

$\begin{bmatrix} -3-\lambda &8 \\ -2&7-\lambda \end{bmatrix}$ . $\begin{bmatrix} x\\ y\end{bmatrix}$ = $\begin{bmatrix} 0\\ 0\end{bmatrix}$ ...................... ......................... (b)

Let $\lambda$ = $\lambda_1$ = 5. So, from (b), we get

$\begin{bmatrix} -3-5 &8 \\ -2&7-5 \end{bmatrix}$ . $\begin{bmatrix} x\\ y\end{bmatrix}$ = $\begin{bmatrix} 0\\ 0\end{bmatrix}$

= $\begin{bmatrix} -8 &8 \\ -2&2 \end{bmatrix}$ . $\begin{bmatrix} x\\ y\end{bmatrix}$ = $\begin{bmatrix} 0\\ 0\end{bmatrix}$

or -8x + 8y = 0 and -2x + 2y = 0

From both equations, we get x - y = 0.

So, we can arbitrarily choose y = t (arbitrary), then y = x = t.

Then, for $\lambda$ = $\lambda_1$ = 5, the eigenvector X1 = $\begin{bmatrix} t\\ t \end{bmatrix}$ .........................................(c)

Now, $\lambda$ = $\lambda_2$ = -1. So, from equation (b)

$\begin{bmatrix} -3+1 &8 \\ -2&7+1 \end{bmatrix}$ . $\begin{bmatrix} x\\ y\end{bmatrix}$ = $\begin{bmatrix} 0\\ 0\end{bmatrix}$

$\begin{bmatrix} -2 &8 \\ -2&8 \end{bmatrix}$ . $\begin{bmatrix} x\\ y\end{bmatrix}$ = $\begin{bmatrix} 0\\ 0\end{bmatrix}$

-2x + 8y = 0 and -2x + 8y = 0

x - 4y = 0

For this, again we choose y = s, then x = 4s.

Now, $\lambda$ = $\lambda_2$ = -1, we have X2 = $\begin{bmatrix} s\\ s\end{bmatrix}$ ...............................................(d)
Here, s and t are thearbitrary constants and s$\neq$0 and t$\neq$0. If we take, s = 1 and t = 1, then X1 = $\begin{bmatrix} t\\ t \end{bmatrix}$ and X2 = $\begin{bmatrix} s\\ s\end{bmatrix}$

These are the eigenvectors of A correspondence to the eigenvalues -5 and -1. Now, the characteristic equation of matrix A, is $\lambda^2$ - 4$\lambda$ - 5 = 0

So, A2 - 4 A - 5 In = 0, where 0 is the null matrix and In is the identity matrix of order 2 respectively.

$\begin{bmatrix} -3 &8 \\ -2&7 \end{bmatrix}$ . $\begin{bmatrix} -3 &8 \\ -2&7 \end{bmatrix}$ - 4 $\begin{bmatrix} -3 &8 \\ -2&7 \end{bmatrix}$ + 5 $\begin{bmatrix} 1 &0 \\ 0&1 \end{bmatrix}$ = $\begin{bmatrix} 0&0 \\ 0&0 \end{bmatrix}$

$\begin{bmatrix} -7 &32 \\ -8&33 \end{bmatrix}$ - $\begin{bmatrix} -12 &32 \\ -8&28 \end{bmatrix}$ - $\begin{bmatrix} 5&0 \\ 0&5 \end{bmatrix}$ = $\begin{bmatrix} 0&0 \\ 0&0 \end{bmatrix}$

$\begin{bmatrix} -12+12&-32+32 \\ -8+8 &-33+33 \end{bmatrix}$ = $\begin{bmatrix} 0&0 \\ 0&0 \end{bmatrix}$

$\begin{bmatrix} 0&0 \\ 0&0 \end{bmatrix}$ = $\begin{bmatrix} 0&0 \\ 0&0 \end{bmatrix}$

Hence, matrix A satisfies its own characteristics equation.

## Determinant Method

Determinant method is the same as that of Cramer's rule. Lets learn about it with an example.
Let 4x - 2y = 10 and 2x + y = 3.
Here, D = $\begin{vmatrix} 4 &-2\\ 2 &1 \end{vmatrix}$ = 4 + 4 = 8

Dx = $\begin{vmatrix} 10&-2 \\ 3 &1 \end{vmatrix}$ = 10 + 6 = 16

Dy = $\begin{vmatrix} 4 &10\\ 2 &3 \end{vmatrix}$ = 12 - 20 = -8

Hence, x = $\frac{Dx}{D}$, y = $\frac{Dy}{D}$

x = 16/8 = 2 and y = -8/8 = -1.

For the solution of linear equations, we have matrix method, Cramer's rule and the determinant method. These all are applicable only if the value of the determinant of the coefficient matrix of the given set of linear equations is non-zero.

## Gauss Jordan Method

For the Gauss Jordan method, first we have to know about augmented matrix. If we have below system of linear equations,

a11 x1 + a12 x2 + a13 x3 + ...................+ a1n xn = b1
a21 x1 + a22 x2 + a23 x3 + ...................+ a2n xn = b2
.................................................................................
.................................................................................
.................................................................................
am1 x1 + am2 x2 + am3 x3+ ..................+ amn xn = bm

Here, we know about the coefficient matrix(A), unknown column matrix(X) and known constant column matrix(b).

### Augmented Matrix:

If we add extra column B(column matrix) in the coefficient matrix A, then the resultant matrix of order m x (n+1) is called the "augmented matrix" associated to the given system of linear equations, represented as follows:

### Gauss Jordan Method Steps:

To solve the system of linear equations, we can use Gauss Jordan method. This is quite simple from the above mentioned methods. In this, we can create an augmented matrix from the coefficient matrix and the basis matrix. Then, apply the row operations on the augmented matrix and try to convert the coefficient matrix in to the diagonal form and get the answer.

For this we follow some steps:
• We can interchange any two rows.
• Multiply or divide each element of a row by a scalar or constant.
• Try to convert the coefficient matrix into the diagonal matrix. If, on the diagonal position, a zero is located then interchange that row by another row.
• Then, we get the solution from the right-hand -side of the augmented matrix.

### Solved Example

Question: Solve the following system of equation by using the Gauss-Jorden method:
3x + y + 2z = 3
2x - 3y - z = -3
x + 2y + z = 4
Solution:
First, we convert the given system in to matrix form,

$\begin{bmatrix} 3 &1 &2 \\ 2 &-3 &-1 \\ 1 &2 &1 \end{bmatrix}$ . $\begin{bmatrix} x\\ y\\ z\end{bmatrix}$ = $\begin{bmatrix} 3\\ -3\\ 4\end{bmatrix}$

So, the augmented matrix is

$\begin{bmatrix} 3 &1 &2 &. &3 \\ 2 &-3 &-1 &. &-3 \\ 1&2 &1 &. &4 \end{bmatrix}$

Applying R1$\leftrightarrow$ R3

$\approx \begin{bmatrix} 1 &2 &1 &. &4 \\ 2 &-3 &-1 &. &-3 \\ 3 &1 &2 &. &3 \end{bmatrix}$

Using R2 $\rightarrow$ R2 - 2R1 and R3 $\rightarrow$ R3 - 3R1

$\approx \begin{bmatrix} 1 &2 &1 &. &4 \\ 0 &-7 &-3 &. &-11 \\ 0 &-5 &-1&. &-9 \end{bmatrix}$

Now, using R3 $\rightarrow$ 7R3 - 5R2

$\approx \begin{bmatrix} 1 &2 &1 &. &4 \\ 0 &-7 &-3 &. &-11 \\ 0 &0 &8&. &-8 \end{bmatrix}$

Use R3 $\rightarrow$ R3/8

$\approx \begin{bmatrix} 1 &2 &1 &. &4 \\ 0 &-7 &-3 &. &-11 \\ 0 &0 &1&. &-1 \end{bmatrix}$

Using R1 $\rightarrow$ R1 - R3 , R2 $\rightarrow$ R2 + 3R3

$\approx \begin{bmatrix} 1 &2 &0 &. &5 \\ 0 &-7 &0&. &-14 \\ 0 &0 &1&. &-1 \end{bmatrix}$

Now using R2 $\rightarrow$ R2/(-7)

$\approx \begin{bmatrix} 1 &2 &0 &. &5 \\ 0 &1 &0&. &2\\ 0 &0 &1&. &-1 \end{bmatrix}$

Finally, using R1 $\rightarrow$ R1 - 2R2

$\approx \begin{bmatrix} 1 &0 &0 &. &1 \\ 0 &1 &0&. &2\\ 0 &0 &1&. &-1 \end{bmatrix}$

We observe that A is now reduced to a diagonal matrix, and we get x = 1, y = 2 and z = -1 as the solution of the given system of equations.