# Matrix Inverses and Cramer's Rule

Determinates can be used to find inverses of matrices, as well as solutions to linear systems in general. We may choose to use these methods when taking the determinate of a matrix is easier than reducing it to solve the system.

**False
Expansion Theorem: **If A is an n x n matrix, and $i
\ne k$, then $a_{i1}C_{k1} + \dots + a_{in}C_{kn} = 0$

To understand this theorem, consider a situation where we replace the k-th row of A with the i-th row of A. This would make the two rows identical, meaning that the determinate of the resulting matrix would be 0. Since the cofactors of the two matrices remain equivalent, we get the result stated by the false expansion theorem.

Expanding on this idea, we define a cofactor matrix as a matrix where $A_{ij} = C_{ij}$. We denote this special matrix as $cof(A)$. Using this idea, we can define the inverse matrix as $A^{-1} = \frac{1}{det(A)}(cof(A))^T$.

One thing this definition does is make it clear why $det(A) \ne 0$ means that A is invertible. If $det(A) = 0$, our inverse definition would have division by 0, meaning it wouldn't be defined.

Cramer's rule takes this a step further, and gives us a definition for solving a linear system rather than just finding the inverse of a matrix. Consider a system of n linear equations, represented as $A\vec{x} = \vec{b}$. If $det(A) \ne 0$, then the solution to the system can be written as: $\vec{x} = A^{-1}\vec{b} = \frac{1}{det(A)}(cof(A))^T\vec{b}$

This means that for an individual solution $x_i$, the solution is defined as $x_i = \frac{b_1C_{1i} + b_2C_{2i} + \dots + b_nc_{ni}}{det(A)}$.

**Example:
**Use Cramer's Rule to solve the system of equations:

$x_1+x_2-x_3 = b_1$

$2x_1+4x_2+5x_3 = b_2$

$x_1+x_2+2x_3 = b_3$

In this case, the coefficient matrix is going to look like below.

$\left[\begin{array}{cc} 1 & 1 & -1 \\ 2 & 4 & 5 \\ 1 & 1 & 2 \end{array}\right]$

To find the determinate, we will reduce this to upper triangular form

$\left[\begin{array}{cc} 1 & 1 & -1 \\ 2 & 4 & 5 \\ 1 & 1 & 2 \end{array}\right] = \left[\begin{array}{cc} 1 & 1 & -1 \\ 0 & 2 & 7 \\ 0 & 0 & 3 \end{array}\right]$

The determinate is the multiple of the diagonals, which gives us det(A) = (1)(2)(3) = 6.

For our first solution, $x_1$, we will find the determinate of the matrix with the first row replaced by the right hand side.

$det(\left[\begin{array}{cc} b_1 & 1 & -1 \\ b_2 & 4 & 5 \\ b_3 & 1 & 2 \end{array}\right]) = 3b_1 - 3b_2 + 9b_3$

We then take this determinate and divide it by the determinate of A, giving us $x_1 = \frac{3b_1 - 3b_2 + 9b_3}{6}$

We can repeat this to get the remaining solutions, meaning $x_2 = \frac{b_1 + 3b_2 - 7b_3}{6}$ and $x_3 = \frac{-2b_1 + 2b_3}{6}$.