Formula and interpretation
Matrix multiplication is not element-wise multiplication. For A of size m×n and B of size n×p, the product A×B has size m×p. An element-wise product needs compatible shapes and multiplies corresponding values. A matrix inverse exists only for a nonsingular square matrix.
Worked 2×2 determinant example
Let A = [1 2; 3 4]. For a 2×2 matrix [a b; c d], the determinant is ad − bc. Substitution gives 1×4 − 2×3 = −2. Because the determinant is nonzero, A is invertible. Compare this hand calculation with the Math Lab result to check the entered rows and columns.