|
| 1 | +--- |
| 2 | +title: Cramer's Rule is a fundamental algorithm in linear algebra |
| 3 | +date: 2025-11-24 |
| 4 | +image: "https://pbs.twimg.com/media/G54ixwBWIAAjioi.jpg" |
| 5 | +authors: |
| 6 | + - name: Aryan |
| 7 | + link: https://github.com/simplearyan |
| 8 | + image: https://github.com/simplearyan.png |
| 9 | +tags: |
| 10 | + - Linear Algebra |
| 11 | + - Mathematics |
| 12 | +width: wide |
| 13 | +--- |
| 14 | + |
| 15 | +Cramer's Rule is a fundamental algorithm in linear algebra designed specifically to **find the unique solution of a system of linear equations**. It leverages the concept of determinants to solve for each variable individually. |
| 16 | + |
| 17 | +The material is presented clearly, drawing on the provided sources, including specific examples for $2 \times 2$ and $3 \times 3$ systems. |
| 18 | + |
| 19 | +### 1. Explanation of Cramer's Rule |
| 20 | + |
| 21 | +Cramer’s Rule can only be applied to a system of linear equations that has a unique solution. For this rule to be applicable, two critical conditions regarding the matrix representation $Ax=b$ must be met: |
| 22 | + |
| 23 | +1. The **coefficient matrix ($A$)** must be a **square matrix** (meaning the number of equations equals the number of variables). |
| 24 | +2. The **determinant of the coefficient matrix ($\det(A)$)** must be **non-zero** ($\det(A) \neq 0$), which means the matrix $A$ is invertible. |
| 25 | + |
| 26 | +If these conditions are satisfied, the value of the $i$-th unknown variable, $x_i$, is calculated using the following formula: |
| 27 | + |
| 28 | +$$\mathbf{x_i = \frac{det(A_{x_i})}{det(A)}}$$ |
| 29 | + |
| 30 | +Where: |
| 31 | +* $A$ is the coefficient matrix of the system. |
| 32 | +* $\det(A)$ is the determinant of the coefficient matrix. |
| 33 | +* $A_{x_i}$ (or $A_i$) is the matrix obtained by **replacing the $i$-th column of $A$ with the column vector $b$** (the vector of constants on the right side of the equations). |
| 34 | + |
| 35 | +### 2. Cramer's Rule for Order 2 (2x2 Systems) |
| 36 | + |
| 37 | +Consider the system of two linear equations with two variables: |
| 38 | +$$a_{11}x_1 + a_{12}x_2 = b_1$$ |
| 39 | +$$a_{21}x_1 + a_{22}x_2 = b_2$$ |
| 40 | + |
| 41 | +The matrix representation is $Ax = b$, where: |
| 42 | +$$A = \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}, \quad x = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}, \quad b = \begin{bmatrix} b_1 \\ b_2 \end{bmatrix}$$ |
| 43 | + |
| 44 | +**Step-by-step Process:** |
| 45 | + |
| 46 | +1. **Calculate $\det(A)$:** $\det(A) = a_{11}a_{22} - a_{12}a_{21}$. |
| 47 | +2. **Define $A_{x_1}$ and $\det(A_{x_1})$:** Replace the first column of $A$ with $b$: |
| 48 | + $$A_{x_1} = \begin{bmatrix} b_1 & a_{12} \\ b_2 & a_{22} \end{bmatrix} \implies \det(A_{x_1}) = b_1a_{22} - b_2a_{12}$$ |
| 49 | +3. **Define $A_{x_2}$ and $\det(A_{x_2})$:** Replace the second column of $A$ with $b$: |
| 50 | + $$A_{x_2} = \begin{bmatrix} a_{11} & b_1 \\ a_{21} & b_2 \end{bmatrix} \implies \det(A_{x_2}) = b_2a_{11} - b_1a_{21}$$ |
| 51 | +4. **Find the Solution:** |
| 52 | + $$x_1 = \frac{\det(A_{x_1})}{\det(A)} \quad \text{and} \quad x_2 = \frac{\det(A_{x_2})}{\det(A)}$$ |
| 53 | + |
| 54 | +#### Example 2.4.1 (Order 2 System) |
| 55 | + |
| 56 | +**Question:** Find the solution of the system of linear equations: |
| 57 | +$$2x_1 + x_2 = 1$$ |
| 58 | +$$3x_1 + 4x_2 = -1$$ |
| 59 | + |
| 60 | +**Solution:** |
| 61 | + |
| 62 | +The coefficient matrix $A$ and vector $b$ are: |
| 63 | +$$A = \begin{bmatrix} 2 & 1 \\ 3 & 4 \end{bmatrix}, \quad b = \begin{bmatrix} 1 \\ -1 \end{bmatrix}$$ |
| 64 | + |
| 65 | +1. **Calculate $\det(A)$:** |
| 66 | + $$\det(A) = (2)(4) - (1)(3) = 8 - 3 = \mathbf{5}$$ |
| 67 | + |
| 68 | +2. **Calculate $\det(A_{x_1})$:** Replace column 1 of $A$ with $b$: |
| 69 | + $$A_{x_1} = \begin{bmatrix} 1 & 1 \\ -1 & 4 \end{bmatrix}$$ |
| 70 | + $$\det(A_{x_1}) = (1)(4) - (1)(-1) = 4 + 1 = \mathbf{5}$$ |
| 71 | + |
| 72 | +3. **Calculate $\det(A_{x_2})$:** Replace column 2 of $A$ with $b$: |
| 73 | + $$A_{x_2} = \begin{bmatrix} 2 & 1 \\ 3 & -1 \end{bmatrix}$$ |
| 74 | + $$\det(A_{x_2}) = (2)(-1) - (3)(1) = -2 - 3 = \mathbf{-5}$$ |
| 75 | + |
| 76 | +4. **Find the Solution ($x_1, x_2$):** |
| 77 | + $$x_1 = \frac{\det(A_{x_1})}{\det(A)} = \frac{5}{5} = \mathbf{1}$$ |
| 78 | + $$x_2 = \frac{\det(A_{x_2})}{\det(A)} = \frac{-5}{5} = \mathbf{-1}$$ |
| 79 | + |
| 80 | +The solution is $(x_1, x_2) = (1, -1)$. |
| 81 | + |
| 82 | +### 3. Cramer's Rule for Order 3 (3x3 Systems) |
| 83 | + |
| 84 | +Consider the system of three linear equations with three variables: |
| 85 | +$$a_{11}x_1 + a_{12}x_2 + a_{13}x_3 = b_1$$ |
| 86 | +$$a_{21}x_1 + a_{22}x_2 + a_{23}x_3 = b_2$$ |
| 87 | +$$a_{31}x_1 + a_{32}x_2 + a_{33}x_3 = b_3$$ |
| 88 | + |
| 89 | +The coefficient matrix $A$ and the vector $b$ are: |
| 90 | +$$A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix}, \quad b = \begin{bmatrix} b_1 \\ b_2 \\ b_3 \end{bmatrix}$$ |
| 91 | + |
| 92 | +1. **Calculate $\det(A)$.** |
| 93 | +2. **Construct $A_{x_1}$, $A_{x_2}$, and $A_{x_3}$** by replacing columns 1, 2, and 3 of $A$ respectively with $b$. |
| 94 | + $$A_{x_1} = \begin{bmatrix} \mathbf{b_1} & a_{12} & a_{13} \\ \mathbf{b_2} & a_{22} & a_{23} \\ \mathbf{b_3} & a_{32} & a_{33} \end{bmatrix}, \quad A_{x_2} = \begin{bmatrix} a_{11} & \mathbf{b_1} & a_{13} \\ a_{21} & \mathbf{b_2} & a_{23} \\ a_{31} & \mathbf{b_3} & a_{33} \end{bmatrix}, \quad A_{x_3} = \begin{bmatrix} a_{11} & a_{12} & \mathbf{b_1} \\ a_{21} & a_{22} & \mathbf{b_2} \\ a_{31} & a_{32} & \mathbf{b_3} \end{bmatrix}$$ |
| 95 | +3. **Calculate the corresponding determinants** $\det(A_{x_1})$, $\det(A_{x_2})$, and $\det(A_{x_3})$. |
| 96 | +4. **Find the Solution:** |
| 97 | + $$x_1 = \frac{\det(A_{x_1})}{\det(A)}, \quad x_2 = \frac{\det(A_{x_2})}{\det(A)}, \quad x_3 = \frac{\det(A_{x_3})}{\det(A)}$$ |
| 98 | + |
| 99 | +#### Example 2.4.2 (Order 3 System) |
| 100 | + |
| 101 | +**Question:** Find the solution of the system of linear equations: |
| 102 | +$$x_1 - x_2 + x_3 = 1$$ |
| 103 | +$$2x_1 + x_2 - 2x_3 = -1$$ |
| 104 | +$$-x_1 - 2x_2 + 4x_3 = 1$$ |
| 105 | + |
| 106 | +**Solution:** |
| 107 | + |
| 108 | +The coefficient matrix $A$ and vector $b$ are: |
| 109 | +$$A = \begin{bmatrix} 1 & -1 & 1 \\ 2 & 1 & -2 \\ -1 & -2 & 4 \end{bmatrix}, \quad b = \begin{bmatrix} 1 \\ -1 \\ 1 \end{bmatrix}$$ |
| 110 | + |
| 111 | +1. **Calculate $\det(A)$:** |
| 112 | + The determinant of $A$ is given as $\mathbf{\det(A) = 3}$. |
| 113 | + |
| 114 | +2. **Calculate Determinants of $A_{x_i}$:** |
| 115 | + $$A_{x_1} = \begin{bmatrix} \mathbf{1} & -1 & 1 \\ \mathbf{-1} & 1 & -2 \\ \mathbf{1} & -2 & 4 \end{bmatrix} \implies \det(A_{x_1}) = \mathbf{-1}$$ |
| 116 | + $$A_{x_2} = \begin{bmatrix} 1 & \mathbf{1} & 1 \\ 2 & \mathbf{-1} & -2 \\ -1 & \mathbf{1} & 4 \end{bmatrix} \implies \det(A_{x_2}) = \mathbf{-7}$$ |
| 117 | + $$A_{x_3} = \begin{bmatrix} 1 & -1 & \mathbf{1} \\ 2 & 1 & \mathbf{-1} \\ -1 & -2 & \mathbf{1} \end{bmatrix} \implies \det(A_{x_3}) = \mathbf{-3}$$ |
| 118 | + |
| 119 | +3. **Find the Solution ($x_1, x_2, x_3$):** |
| 120 | + $$x_1 = \frac{\det(A_{x_1})}{\det(A)} = \frac{-1}{3} = \mathbf{-\frac{1}{3}}$$ |
| 121 | + $$x_2 = \frac{\det(A_{x_2})}{\det(A)} = \frac{-7}{3} = \mathbf{-\frac{7}{3}}$$ |
| 122 | + $$x_3 = \frac{\det(A_{x_3})}{\det(A)} = \frac{-3}{3} = \mathbf{-1}$$ |
| 123 | + |
| 124 | +### 4. Exercise (System of Linear Equations) |
| 125 | + |
| 126 | +**Question 42:** Consider a system of linear equations: |
| 127 | +$$x_1 + x_3 = 1$$ |
| 128 | +$$-x_1 + x_2 - x_3 = 1$$ |
| 129 | +$$-x_2 + x_3 = 1$$ |
| 130 | +Let the matrix representation of the above system be $Ax = b$. Apply Cramer's Rule steps to define the matrices needed for the solution. |
| 131 | + |
| 132 | +**Solution (Setup for Cramer's Rule):** |
| 133 | + |
| 134 | +The coefficient matrix $A$ and the vector $b$ are: |
| 135 | +$$A = \begin{bmatrix} 1 & 0 & 1 \\ -1 & 1 & -1 \\ 0 & -1 & 1 \end{bmatrix}, \quad b = \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix}$$ |
| 136 | + |
| 137 | +To find the solution $x_i = \frac{\det(A_{x_i})}{\det(A)}$, we first compute $\det(A)$, and then define the matrices $A_{x_1}$, $A_{x_2}$, and $A_{x_3}$ used in the numerators: |
| 138 | + |
| 139 | +1. **$A_{x_1}$** (Column 1 replaced by $b$): |
| 140 | + $$A_{x_1} = \begin{bmatrix} \mathbf{1} & 0 & 1 \\ \mathbf{1} & 1 & -1 \\ \mathbf{1} & -1 & 1 \end{bmatrix}$$ |
| 141 | +2. **$A_{x_2}$** (Column 2 replaced by $b$): |
| 142 | + $$A_{x_2} = \begin{bmatrix} 1 & \mathbf{1} & 1 \\ -1 & \mathbf{1} & -1 \\ 0 & \mathbf{1} & 1 \end{bmatrix}$$ |
| 143 | +3. **$A_{x_3}$** (Column 3 replaced by $b$): |
| 144 | + $$A_{x_3} = \begin{bmatrix} 1 & 0 & \mathbf{1} \\ -1 & 1 & \mathbf{1} \\ 0 & -1 & \mathbf{1} \end{bmatrix}$$ |
| 145 | + |
| 146 | +(To complete the solution using the rule, one would calculate the determinant of $A$ and the three matrices above, and then find the ratios.) |
0 commit comments