Trusted answers to developer questions

Gutha Vamsi Krishna

In Julia, matrices can store heterogeneous elements. It dynamically decides the type of the value. In this shot, we will learn how to get the inverse of a matrix using Julia.

The **inverse **of a matrix is another matrix which, upon multiplication with the given matrix, gives the identity matrix.

For instance, if

We can get the inverse of the matrix in Julia using the **inv()**** function**.

inv(matrix)

It accepts a matrix as a parameter and returns the inverse matrix of it.

Let us take a look at an example.

#give matrix A = [1 -1; 0 2] #get inverse of matrix display(inv(A))

In the code snippet above:

- Line 2: We declare and initialize matrix
`A`

. - Line 5: We use the
`inv()`

function to get the inverse of the matrix`A`

and display the returned inverse matrix of`A`

.

RELATED TAGS

julia

CONTRIBUTOR

Gutha Vamsi Krishna

RELATED COURSES

View all Courses

Keep Exploring

Related Courses