# Find the minor (secondary) diagonal of a matrix.

This short tutorial shows how to find elements of a minor (secondary) diagonal of a matrix.

Minor diagonal is the collection of elements of a matrix that go from it top right corner to the in the bottom-left direction. So, it is a collection of elements Aij, where i = number of columns - j.

Let's say we have a matrix in a two-dimensional table Integer[n][m]. Then, to find the minor diagonal, we follow the algorithm below:

To see the above algorithm in action in Javascript, visit our minor diagonal sandbox script.

### What is a minor diagonal

Minor diagonal is the collection of elements of a matrix that go from it top right corner to the in the bottom-left direction. So, it is a collection of elements Aij, where i = number of columns - j.

### Java code to find the minor diagonal

Let's say we have a matrix in a two-dimensional table Integer[n][m]. Then, to find the minor diagonal, we follow the algorithm below:

// the matrix

Integer[][] = new Integer[m][n];

for (i = 0; 0 < n; i++)

{

for (j = 0; j < m; j++)

{

if (i == (m - j - 1))

{

// element i,j lies on the diagonal

}

else

{

// element i,j does not lie on the diagonal

}

}

}

### Javascript code

To see the above algorithm in action in Javascript, visit our minor diagonal sandbox script.

Comments

thanks a lot! You're great!

## Add comment

Has this tutorial been helpful to you? Or do you see anything wrong? We appreciate your opinion!

+ Ask a question

If you have a technical question related to programming and computers, ask it here. Other users will help you solve it!

Unanswered questions

Share your knowledge by helping others solve their problems

como reconquistar http://www.reconquistar2.com/