# MUNIT

The `MUNIT` function returns a unit matrix of a specified dimension. A unit matrix is a square matrix in which all the elements of the principal diagonal are ones and all other elements are zeros. The dimension argument specifies the number of rows or columns in the resulting matrix.

## Usage

Use the `MUNIT` formula with the syntax shown below, it has 1 required parameter:

Parameters:
1. dimension (required):
The number of rows or columns in the resulting matrix. Must be a positive integer.

## Examples

Here are a few example use cases that explain how to use the `MUNIT` formula in Google Sheets.

### Creating an identity matrix

You can use the `MUNIT` function to create an identity matrix, which is a square matrix with ones on the diagonal and zeros elsewhere. For example, the formula `=MUNIT(3)` returns a 3x3 identity matrix.

### Multiplying by the unit matrix

Multiplying a matrix by a unit matrix of the appropriate size leaves the matrix unchanged. You can use `MUNIT` to create a unit matrix for this purpose. For example, if you have a 3x3 matrix in A1:C3, the formula `=MMULT(A1:C3, MUNIT(3))` returns the same matrix.

## Common Mistakes

`MUNIT` not working? Here are some common mistakes people make when using the `MUNIT` Google Sheets Formula:

### Incorrect dimension input

If the dimension input is not a positive integer, the MUNIT formula will return an error. Make sure to input a valid dimension.

### Missing dimension input

If the dimension input is not provided, the MUNIT formula will return an error. Make sure to provide a valid dimension.

The following functions are similar to `MUNIT` or are often used with it in a formula:

• `MMULT`

The `MMULT` formula in Google Sheets multiplies two matrices together and returns the resulting matrix. It is commonly used in linear algebra for matrix multiplication.

• `TRANSPOSE`

The `TRANSPOSE` formula in Google Sheets allows you to flip a table of data by turning rows into columns and columns into rows. This can be useful for reorganizing data or preparing it for use in other formulas.

• `MINVERSE`

The `MINVERSE` function in Google Sheets returns the inverse matrix of a given square matrix. The inverse matrix is such that when multiplied by the original matrix, it results in an identity matrix. This function is commonly used in linear algebra, such as solving systems of linear equations or finding determinants of matrices.

You can learn more about the `MUNIT` Google Sheets function on Google Support.