Solution of linear equations using Cramer's Rule


Solution of Linear Equations Using Cramer's Rule

Cramer's Rule is a theorem in linear algebra that provides an explicit formula for the solution of a system of linear equations with as many equations as unknowns, provided that the system has a unique solution. It uses determinants to solve the system.

Understanding the System of Linear Equations

A system of linear equations can be represented in matrix form as:

[ AX = B ]

where:

  • ( A ) is the coefficient matrix
  • ( X ) is the column matrix of the variables
  • ( B ) is the column matrix of constants

For a system of ( n ) linear equations with ( n ) unknowns:

[ \begin{align*} a_{11}x_1 + a_{12}x_2 + \ldots + a_{1n}x_n &= b_1 \ a_{21}x_1 + a_{22}x_2 + \ldots + a_{2n}x_n &= b_2 \ &\vdots \ a_{n1}x_1 + a_{n2}x_2 + \ldots + a_{nn}x_n &= b_n \ \end{align*} ]

Cramer's Rule

Cramer's Rule states that for the system ( AX = B ), if the determinant of ( A ) (denoted as ( \det(A) )) is non-zero, then the system has a unique solution. The solution can be found using the following formulas:

[ x_i = \frac{\det(A_i)}{\det(A)} ]

where ( A_i ) is the matrix formed by replacing the ( i )-th column of ( A ) with the column matrix ( B ).

Important Points and Differences

Point Description
Determinant of A Must be non-zero for Cramer's Rule to be applicable.
Unique Solution Cramer's Rule only works if there is a unique solution.
Computational Complexity Using Cramer's Rule can be computationally expensive for large systems.
Practicality More practical for small systems or when the determinant is readily available.

Formulas

The determinant of a matrix ( A ) is calculated as:

  • For a ( 2 \times 2 ) matrix:

[ \det(A) = a_{11}a_{22} - a_{12}a_{21} ]

  • For a ( 3 \times 3 ) matrix:

[ \det(A) = a_{11}(a_{22}a_{33} - a_{23}a_{32}) - a_{12}(a_{21}a_{33} - a_{23}a_{31}) + a_{13}(a_{21}a_{32} - a_{22}a_{31}) ]

  • For larger matrices, the determinant is calculated using cofactor expansion or other methods.

Examples

Example 1: Solving a ( 2 \times 2 ) System

Consider the system of equations:

[ \begin{align*} 2x + 3y &= 5 \ 4x - y &= 1 \end{align*} ]

The coefficient matrix ( A ) and the constant matrix ( B ) are:

[ A = \begin{bmatrix} 2 & 3 \ 4 & -1 \ \end{bmatrix}, B = \begin{bmatrix} 5 \ 1 \ \end{bmatrix} ]

To find ( x ), we replace the first column of ( A ) with ( B ) to get ( A_x ):

[ A_x = \begin{bmatrix} 5 & 3 \ 1 & -1 \ \end{bmatrix} ]

Now, we calculate the determinants:

[ \det(A) = (2)(-1) - (4)(3) = -2 - 12 = -14 ] [ \det(A_x) = (5)(-1) - (1)(3) = -5 - 3 = -8 ]

Using Cramer's Rule:

[ x = \frac{\det(A_x)}{\det(A)} = \frac{-8}{-14} = \frac{4}{7} ]

Similarly, to find ( y ), we replace the second column of ( A ) with ( B ) to get ( A_y ):

[ A_y = \begin{bmatrix} 2 & 5 \ 4 & 1 \ \end{bmatrix} ]

Calculate the determinant:

[ \det(A_y) = (2)(1) - (4)(5) = 2 - 20 = -18 ]

Using Cramer's Rule:

[ y = \frac{\det(A_y)}{\det(A)} = \frac{-18}{-14} = \frac{9}{7} ]

So, the solution to the system is ( x = \frac{4}{7} ) and ( y = \frac{9}{7} ).

Example 2: Solving a ( 3 \times 3 ) System

Consider the system of equations:

[ \begin{align*} x + 2y + 3z &= 1 \ 2x + 5y + 3z &= 2 \ 1x + 0y + 8z &= 3 \end{align*} ]

We would follow a similar process as in Example 1, but with a ( 3 \times 3 ) matrix. We would calculate the determinant of the coefficient matrix ( A ) and the determinants of the matrices ( A_x ), ( A_y ), and ( A_z ) formed by replacing the respective columns with the constant matrix ( B ). Then, we would apply Cramer's Rule to find the values of ( x ), ( y ), and ( z ).

Cramer's Rule provides a direct method to solve a system of linear equations, but it is not always the most efficient, especially for large systems. Other methods, such as Gaussian elimination or matrix inversion, are often used in practice for their computational efficiency.