Exercise

# Intro to The Matrix Inverse

We talked briefly about the identity matrix in the video. Another important concept to understand in matrix multiplication is that of the matrix inverse.

For any number \(a\) (aside from \(0\)), there's always a number \(\frac{1}{a}\) that can be used to "undo" multiplication by \(a\).

For matrices, this is not always true. However, when it is, we call the matrix that, when applied to \(A\), yields the identity matrix \(I\), that matrix's inverse.

The `solve()`

function in R will find the inverse of a matrix if it exists and provide an error if it does not.

Instructions

**100 XP**

\(A\) is loaded for you. Show that the inverse of the identity matrix with \(n = 2\) is the identity matrix with \(n = 2\).

Find the inverse of the matrix \(A\) with the following R output:

```
> A
[,1] [,2]
[1,] 1 2
[2,] -1 2
```

and assign it to the variable `Ainv`

.

- Multiply
`Ainv`

by A in both directions. What is the resulting matrix?