ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Linear Algebra for Data Science in R

Ver curso

Instrucciones del ejercicio

  • \(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?

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Take the inverse of the 2 by 2 identity matrix
solve(diag(___))

# Take the inverse of the matrix A
Ainv <- ___(A)

# Multiply A inverse by A
___%*%A

# Multiply A by its inverse
A%*%___
Editar y ejecutar código