Menu
Topics Index
...
`

Determinant Of 2x2 Matrix


If you need explanation Read this topic

If you need Answer Take test on this topic

Write a program to get the determinant of 2 x 2 matrix.

Input (Two Dimensional matrix) Output (Integer)
5   8
8   0
-64
-3   -1
5   -2
11
1   0
0   1
1
-11 -22
-13 -19
-77
20  45
2   5
10



class FindTheDeterminantOf2X2Matrix
{
    public static void main(String s[])
    {
        int input[][] = {{20, 45}, {2, 5}};
        System.out.println("Determinant of 2 x 2 matrix is : " + getTheDeterminant(input));

    }


    public static int getTheDeterminant(int matrix[][]) {
    int result = 0;
    return result;
    }

}
Topic: Java Multidimensional Array

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

here we concept of the matrix determinant ..we have formula for that ad-bc
* so result=(matrix[0][0]*matrix[1][1])-(matrix[0][1]*matrix[1][0])

Posted by Uday Kumar    2015-03-03 06:23:45


here in this program we need to get the 2 x 2 matrix determinant.. we have formula is ad-bc

i.e., result = (matrix[0][0] * matrix[1][1]) - (matrix[0][1] * matrix[1][0])

Posted by Gopinath Manchikanti    2015-03-03 07:25:54


Determinant of a 2*2 matrix can be found out by following formulae:

a1b2-b1a2
If following is a matrix:
|a1 b1|
|a2 b2|

--Program to find determinant of 2*2 matrix is :
Int d=matrix[0][0]*matrix[1][1]-matrix[0][1]*matrix[1][0].

To print the result we use println() method as follows:
system.out.println("Determinant="+d)

Posted by Mânïshå Mùlchåndânï    2015-03-03 14:25:44


This dose is now closed and the winners are Uday Kumar,  for 'First Correct Comment', Gopinath Manchikanti, Mânïshå Mùlchåndânï,  for 'Second Correct Comment'. The 'lucky liker' is Sonu Nagdev. Please login into Merit Campus using facebook, to claim your recharge. Go to http://java.meritcampus.com/earnings to raise the recharge.

Posted by Merit Campus    2015-03-04 04:07:26


© meritcampus 2019

All Rights Reserved.

Open In App