---
jupytext:
  formats: md:myst
  text_representation:
    extension: .md
    format_name: myst
    format_version: '0.8'
    jupytext_version: 1.4.1+dev
kernelspec:
  display_name: Python 3
  language: python
  name: python3
---

+++

(section:uge7L-extra)=
# Extra (optional) exercises -- Short Day

+++

These exercises are optional extra material for students who have finished the exercises of the day and have the time and interest for more.

+++

## Extra exercise 1: Cramer's rule

+++

Let $n$ be a natural number. A system of linear equations is given in matrix form, $\mathbf A \cdot \mathbf x = \mathbf b$, where $\mathbf b \in \mathbb{F}^n$, and $\mathbf x$ is a vector of the variables $x_1,\dots,x_n \in \Bbb F$. We will assume that $\mathbf A \in \mathbb F^{n \times n}$ is a square matrix with $\det(\mathbf A) \neq 0$. 

+++

### Question a

+++

Let $k$ be an integer between $1$ and $n$, and denote by $\mathbf X_k$ the matrix obtained by replacing the $k$'th column of the identity matrix $\mathbf I_n$ by $\mathbf x$. Show that $\det(\mathbf X_k)=x_k$, meaning the $k$'th entry in the vector $\mathbf x$.

+++

### Question b

+++

Again, let $k$ be an integer between $1$ and $n$, and denote by $\mathbf M_k$ the matrix obtained by replacing the $k$'th column of the matrix $\mathbf A$ by $\mathbf b$. Show that $\mathbf A \cdot \mathbf x = \mathbf b$ implies $\mathbf A \cdot \mathbf X_k= \mathbf M_k$.

+++

### Question c

+++

Show that $x_k$ satisfies $x_k=\det(\mathbf M_k)/\det(\mathbf A)$. 

This method for finding the solution to a system of linear equations with an invertible coefficient matrix is known as *Cramer's rule*.

```{hint}
:class: dropdown
Calculate the determinant of $\mathbf M_k$.
```
