Cramer's rule


Cramer's Rule

Cramer's rule is a theorem in linear algebra that provides an explicit solution to a system of linear equations with as many equations as unknowns, provided that the system has a unique solution. It uses determinants to solve for each variable and is applicable when the coefficient matrix is square (the same number of equations as unknowns) and non-singular (its determinant is not zero).

Understanding the System of Linear Equations

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

[ \mathbf{A}\mathbf{x} = \mathbf{b} ]

where:

  • $\mathbf{A}$ is an $n \times n$ matrix of coefficients,
  • $\mathbf{x}$ is a column vector of $n$ variables $(x_1, x_2, \ldots, x_n)^T$,
  • $\mathbf{b}$ is a column vector of $n$ constants $(b_1, b_2, \ldots, b_n)^T$.

The Determinant

The determinant of a matrix is a scalar value that is a function of the entries of a square matrix. It provides important information about the matrix, such as whether it is invertible or not. The determinant of matrix $\mathbf{A}$ is denoted as $|\mathbf{A}|$ or $\det(\mathbf{A})$.

Cramer's Rule Formula

Cramer's rule states that for the system $\mathbf{A}\mathbf{x} = \mathbf{b}$, if $\det(\mathbf{A}) \neq 0$, then the system has a unique solution. The solution for each variable $x_i$ is given by:

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

where $\mathbf{A}_i$ is the matrix formed by replacing the $i$-th column of $\mathbf{A}$ with the vector $\mathbf{b}$.

Steps to Apply Cramer's Rule

  1. Ensure that the system is square and the determinant of the coefficient matrix $\mathbf{A}$ is non-zero.
  2. Calculate $\det(\mathbf{A})$.
  3. For each variable $x_i$, form matrix $\mathbf{A}_i$ by replacing the $i$-th column of $\mathbf{A}$ with $\mathbf{b}$.
  4. Calculate $\det(\mathbf{A}_i)$ for each $i$.
  5. Solve for each variable using the formula for $x_i$.

Example

Consider the system of equations:

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

The matrix form is:

[ \begin{bmatrix} 2 & 1 \ 1 & -3 \end{bmatrix} \begin{bmatrix} x \ y

\end{bmatrix}

\begin{bmatrix} 5 \ -1 \end{bmatrix} ]

Here, $\mathbf{A} = \begin{bmatrix} 2 & 1 \ 1 & -3 \end{bmatrix}$ and $\mathbf{b} = \begin{bmatrix} 5 \ -1 \end{bmatrix}$.

  1. Calculate $\det(\mathbf{A}) = (2)(-3) - (1)(1) = -6 - 1 = -7$.
  2. Form $\mathbf{A}_1$ by replacing the first column of $\mathbf{A}$ with $\mathbf{b}$:

[ \mathbf{A}_1 = \begin{bmatrix} 5 & 1 \ -1 & -3 \end{bmatrix} ]

Calculate $\det(\mathbf{A}_1) = (5)(-3) - (1)(-1) = -15 + 1 = -14$.

  1. Form $\mathbf{A}_2$ by replacing the second column of $\mathbf{A}$ with $\mathbf{b}$:

[ \mathbf{A}_2 = \begin{bmatrix} 2 & 5 \ 1 & -1 \end{bmatrix} ]

Calculate $\det(\mathbf{A}_2) = (2)(-1) - (5)(1) = -2 - 5 = -7$.

  1. Solve for $x$ and $y$:

[ x = \frac{\det(\mathbf{A}_1)}{\det(\mathbf{A})} = \frac{-14}{-7} = 2 ]

[ y = \frac{\det(\mathbf{A}_2)}{\det(\mathbf{A})} = \frac{-7}{-7} = 1 ]

Comparison and Important Points

Aspect Cramer's Rule Other Methods (e.g., Gaussian Elimination)
Applicability Only for square systems with non-zero determinant For any system of linear equations
Computation Requires calculation of $n+1$ determinants for an $n \times n$ system Involves row operations and back substitution
Efficiency Less efficient for large systems More efficient and scalable for large systems
Uniqueness Guarantees a unique solution if applicable Can handle systems with no solution or infinitely many solutions

Conclusion

Cramer's rule is a straightforward method for solving small systems of linear equations with a unique solution. However, for larger systems or systems that do not meet the criteria for Cramer's rule, other methods such as Gaussian elimination or matrix inversion are more practical. It is important to understand the limitations and computational costs associated with Cramer's rule when choosing a method to solve a system of linear equations.