How to use MUNIT function in Excel?

The `MUNIT` function in Excel is used to generate a unit matrix or identity matrix. An identity matrix is a square matrix with ones on the main diagonal and zeros elsewhere.

Here’s how you can use the `MUNIT` function:

Syntax

MUNIT(n)
  • n: This argument specifies the number of rows and columns in the identity matrix. The result will be an n x n matrix.

Steps to Use MUNIT

  • Select a Range:
    • First, select an n x n range in your Excel sheet where you want to display the identity matrix. For example, if you want a 3×3 matrix, select a 3×3 range of cells.
  • Enter the Formula:
    • While still having your range selected, type the formula `=MUNIT(n)`, where `n` is the size of the identity matrix you want. For a 3×3 identity matrix, you would enter `=MUNIT(3)`.
  • Array Formula:
    • Since `MUNIT` returns an array, you must enter it as an array formula.
    • If you are using Excel 365 or Excel 2019, just press Enter after typing your formula. Excel automatically handles dynamic array formulas.
    • In earlier versions of Excel, you need to press Ctrl + Shift + Enter instead of just Enter after typing the formula. This will place curly brackets `{}` around your formula, indicating it’s an array formula.
  • Result:
    • Excel will fill the selected range with the identity matrix based on the specified size.

Example

If you want to create a 3×3 identity matrix, you would:

  • Select a 3×3 range of cells in Excel.
  • Enter `=MUNIT(3)`.
  • Press Ctrl + Shift + Enter (for versions prior to Excel 365/2019) or just Enter if you are using one of the newer versions.

This will populate the selected range with:

1 0 0
0 1 0
0 0 1

Using the `MUNIT` function is straightforward once you understand the basics of array formulas in Excel. Remember that you need to select a range that matches your desired matrix size before entering the function.

Unlock Your Potential

Excel

Basic - Advanced

Access

Access Basic - Advanced

Power BI

Power BI Basic - Advanced

Help us grow the project