MUNIT Function

MUNIT Function

MUNIT Function

Returns the identity matrix for a chosen dimension.

ExcelClash Team
PUBLISHED

Summary

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.

Purpose

Create an identity matrix

Returns a square array with 1s on the diagonal and 0s elsewhere.

Return Value

A square numeric array

The result size is determined by the dimension you supply.

Syntax

=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.

Arguments

  • dimension - [required] A positive integer that sets the number of rows and columns in the identity matrix.

MUNIT and Matrix Properties

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.

Using MUNIT

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.

Example 1 - Generate a 2x2 Identity Matrix

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.

Check Answer
Challenge #1
Target: Sheet1!F1
Create 2x2 Identity Matrix

In cell F1, create a 2x2 identity matrix with MUNIT.

Example 2 - Generate a 3x3 Identity Matrix

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.

Check Answer
Challenge #2
Target: Sheet1!F2
Create 3x3 Identity Matrix

In cell F2, create a 3x3 identity matrix with MUNIT.

Example 3 - Multiply by the Identity Matrix

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.

Check Answer
Challenge #3
Target: Sheet1!F3
Verify Neutral Multiplication

In cell F3, multiply matrix A1:B2 by MUNIT(2) and confirm that the matrix stays unchanged.

Example 4 - Compare an Inverse Product to MUNIT

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.

Check Answer
Challenge #4
Target: Sheet1!F4
Verify Inverse Product

In cell F4, multiply a matrix by its inverse and compare the result with MUNIT(2).

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.

  • MUNIT always returns a square matrix.
  • The dimension controls both rows and columns.
  • MUNIT is most useful when paired with MMULT and MINVERSE.

Conclusion Recap

  • Summary: MUNIT returns the identity matrix for a chosen dimension.
  • Main idea: The identity matrix is the matrix version of multiplying by 1.
  • Common use: Verify inverse and matrix multiplication results.
  • Key rule: The dimension must be greater than 0.
  • Important behavior: The result is an array, so it needs space to spill.
Tactical Arena
Select Scenario:
Share MUNIT Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.