The MUNIT function in Google Sheets is a valuable tool for creating a unit matrix, which is a square matrix with ones on the diagonal and zeros elsewhere. This function is particularly useful in various mathematical and statistical applications, where unit matrices play a crucial role in linear algebra, transformations, and certain calculations involving matrices.
Syntax
MUNIT(dimension)
- dimension: This parameter specifies the size of the square matrix to be created. It must be a positive integer.
Example #1
MUNIT(3)
This call creates a 3×3 unit matrix. The result would be: 1 0 0
0 1 0
0 0 1
Example #2
MUNIT(2)
This function call generates a 2×2 unit matrix. The result would be: 1 0
0 1
Example #3
MUNIT(4)
This creates a 4×4 unit matrix. The resulting matrix will be: 1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Error handling
- VALUE! – This error appears if the dimension is not a positive integer.
- REF! – This error occurs if the dimension exceeds the maximum allowable matrix size.
- NAME? – This error indicates that the function name is unrecognized, which may be due to a typo or unsupported version of Google Sheets.