
The Excel MUNIT function returns the identity matrix for a specified dimension. An identity matrix is a square matrix with 1s on the main diagonal and 0s everywhere else.
Its importance comes from how it behaves in matrix multiplication. The identity matrix plays the same role for matrices that the number 1 plays in ordinary multiplication: multiplying by it leaves the original value unchanged. That is why MUNIT is useful for checking matrix logic and understanding results from functions such as MMULT and MINVERSE.
MUNIT is a support function for matrix work. It creates an identity matrix quickly, which makes it useful in demonstrations, testing, and formulas where a standard matrix baseline is needed before more advanced matrix operations begin.
Returns a square array with 1s on the diagonal and 0s elsewhere.
The result size is determined by the dimension you supply.
=MUNIT(dimension)
The argument is the size of the matrix you want to create. Microsoft notes that the dimension must be greater than 0. Because the function returns an array, the output spills in modern Excel and must be confirmed as an array formula in older versions.
| Property | Matrix Meaning | Why It Matters |
|---|---|---|
| Identity property | MMULT(A,MUNIT(n))=A |
Shows that the identity matrix leaves a matrix unchanged. |
| Inverse check | MMULT(A,MINVERSE(A)) should equal MUNIT |
Helps verify that a matrix inverse was computed correctly. |
| Diagonal form | 1s on the diagonal, 0s elsewhere | Defines the standard identity pattern for any size. |
The most common reason to use MUNIT in Excel is verification. If a matrix is multiplied by its inverse, the expected result is the identity matrix. Because of that, MUNIT gives you a clean reference point when checking whether a matrix calculation behaved as expected.
MUNIT is also useful for understanding what matrix multiplication should preserve. Multiplying by the identity matrix does not change the original matrix, so it becomes a natural test case when learning MMULT or debugging a model that uses several matrix steps.
As with other matrix functions, the result is an array, not a single value. That means the output area has to be available. If the result cannot spill into nearby cells, Excel may not display the full matrix properly.
This is the basic use of MUNIT.
=MUNIT(2)
The result is a 2x2 matrix with 1s on the diagonal and 0s elsewhere. This is the simplest identity matrix you will usually see in matrix examples.
In cell D1, create a 2x2 identity matrix with MUNIT.
The same pattern extends to larger dimensions.
=MUNIT(3)
The output becomes a 3x3 matrix, but the rule stays the same: diagonal entries are 1 and all off-diagonal entries are 0. This makes the function easy to scale as your matrix size changes.
In cell D4, create a 3x3 identity matrix with MUNIT.
This demonstrates the main property of the identity matrix.
=MMULT(A1:B2,MUNIT(2))
The result should match A1:B2 exactly. This is useful as a check because it confirms that matrix multiplication is being applied in a way that preserves the original matrix when the second matrix is the identity.
In cell D8, multiply matrix A1:B2 by MUNIT(2) and confirm that the matrix stays unchanged.
This is a common matrix verification pattern.
=MMULT(A1:B2,MINVERSE(A1:B2))
If the inverse is valid, the result should match the identity matrix of the same size. In real work, tiny rounding differences can appear, so values that should be 0 may sometimes appear as very small decimals.
In cell D11, multiply a matrix by its inverse and compare the result with the identity matrix.
MUNIT returns #VALUE! if the dimension is 0 or smaller. Since the function returns an array, it is also worth making sure the destination area is clear before entering the formula in modern Excel.
MMULT and MINVERSE.MUNIT creates the identity matrix, which is the matrix version of multiplying by 1. The lesson kept coming back to that one idea, because it explains why the function matters even though it only returns a simple pattern of 1s and 0s.
The examples showed how that pattern helps in real matrix work. You can generate identity matrices of different sizes, use them with MMULT to check neutral multiplication, and compare them with inverse results to see whether a matrix calculation looks correct.
MUNIT returns the identity matrix for a chosen dimension.Tell your friends about this post