Project 9: Inverse of 2x2 Matrix

In the algebra equation: 3X + 5 = 14 we can solve by:

subtracting 5 from both sides: 3x = 9

dividing both sides by 3: x = 3


Suppose matrix A and B are defined below:

The inverse of a matrix is a matrix when multiplied by another matrix produces the identity.  An example of a 2x2 matrix is shown above.  Also, the formula for finding the inverse of a 2x2 matrix is shown above.

Project 9: Variable 'matrix' has been initialized.  The variable 'matrix' is a two-dimensional array with 2 rows and 2 columns.  

Task: Appropriately initialize the values for 'inverse' which represents the inverse of matrix.

Note:  matrix[0][0] represents the value in the 0th row and 0th column of matrix (3 for the example given above).  

matrix[1][0] represents the value in the 1st row and 0th column of matrix (1 for the example given above).


Assume 'inverse' has already been declared and initialized as an empty 2D array.

**If your code works for 5 test cases in a row, you can enter your e-mail address.