Skip to content

Instantly share code, notes, and snippets.

@sanket143
Created May 29, 2017 06:51
Show Gist options
  • Save sanket143/c6d4200f2c513200f1b5ec423cb8b1f9 to your computer and use it in GitHub Desktop.
Save sanket143/c6d4200f2c513200f1b5ec423cb8b1f9 to your computer and use it in GitHub Desktop.
To get determinant of 3*3 matrix
var matrix=[];
function Solve(matrix) {
var Det = matrix[0][0]*(matrix[1][1]*matrix[2][2] - matrix[1][2]*matrix[2][1])-matrix[0][1]*(matrix[1][0]*matrix[1][1]-matrix[1][2]*matrix[2][0])+matrix[0][2]*(matrix[1][0]*matrix[2][1]-matrix[1][1]*matrix[2][0]);
return Det;
}
Solve([[1,2,2],[3,4,5],[4,5,6]]);//Here goes your three cross three matrix;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment