Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Disclosure: My content contains affiliate links.

43,227 questions

56,129 answers

573 users

How to calculate the determinant of a 3X3 matrix in Dart

1 Answer

0 votes
/* 
 *       a b c
 * arr = d e f
 *       g h i
 * 
 * determinant = a*(e*i - f*h) - b*(d*i-f*g) + c*(d*h - e*g)
 * 
 */

void main() {
    List<List<int>> matrix = [[6, 1, 1], [4, -2, 5], [2, 8, 7]];
    
    var determinant = 
            matrix[0][0] * (matrix[1][1] * matrix[2][2] - matrix[1][2] * matrix[2][1]) - 
            matrix[0][1] * (matrix[1][0] * matrix[2][2] - matrix[1][2] * matrix[2][0]) + 
            matrix[0][2] * (matrix[1][0] * matrix[2][1] - matrix[1][1] * matrix[2][0]);
    
    print(determinant);
}




/*
run:
    
-306 
      
*/

 



answered May 21, 2023 by avibootz

Related questions

1 answer 234 views
1 answer 209 views
1 answer 174 views
1 answer 175 views
1 answer 200 views
1 answer 203 views
1 answer 243 views
...