Matrices

The Identity Matrix: Definition, Properties and How to Use It

The identity matrix InI_n is the n×nn \times n square matrix with 11 in every main-diagonal position and 00 everywhere else. It leaves any matrix of matching size unchanged: AI=IA=AAI = IA = A.

InA=AIn=AI_n A = A I_n = A

That makes it the matrix version of the number 11, and nearly every idea about “undoing” a matrix, from inverses to solving equations, is built on it. Below you will find the one-line reason the rule works, the size trap that catches people with non-square matrices, a fast way to check an inverse, the mistake of subtracting a plain number from a matrix, and where the identity shows up outside the classroom.

What is an identity matrix, and how do you write it?

An identity matrix has ones along the main diagonal (top left to bottom right) and zeros in every other position. It is written II, or InI_n when the size matters:

I2=[1001],I3=[100010001]I_2=\begin{bmatrix}1&0\\0&1\end{bmatrix},\qquad I_3=\begin{bmatrix}1&0&0\\0&1&0\\0&0&1\end{bmatrix}

In entry form, Iij=1I_{ij}=1 when i=ji=j and Iij=0I_{ij}=0 when i≠ji\neq j. Each size has exactly one identity matrix, so “the identity matrix” really means “the one that fits.” You will also see it called the unit matrix, and a few books write EE (from the German Einheitsmatrix).

The most useful way to read the pattern is by columns. Column 1 of I3I_3 is (1,0,0)(1,0,0), column 2 is (0,1,0)(0,1,0), and column 3 is (0,0,1)(0,0,1). These are the standard basis vectors, one unit step along each axis. Keep that in mind, because it is the whole reason the identity does what it does.

Two traps are worth knowing now. The identity must be square, so a 2×32\times 3 block of ones and zeros is not an identity matrix. And the ones must run from top left to bottom right: the matrix [0110]\begin{bmatrix}0&1\\1&0\end{bmatrix} has ones on the other diagonal, and it swaps rows instead of preserving them.

Quick check

How many entries of I4I_4 equal 11, and how many equal 00?

Why does multiplying by the identity matrix change nothing?

Entry (i,j)(i,j) of a product is row ii of the left matrix multiplied term by term with column jj of the right matrix, then added (the full procedure is on the matrix multiplication page). When the right-hand matrix is II, column jj is all zeros except for a single 11 in position jj. Every term in the sum vanishes except one:

(AI)ij=∑kaikIkj=aij⋅1=aij(AI)_{ij}=\sum_k a_{ik}I_{kj}=a_{ij}\cdot 1=a_{ij}

That is the entire proof. Multiplying AA by the first basis vector picks out column 1 of AA, the second picks out column 2, and so on, in order. The columns come back in their original places, so AI=AAI=A.

Worked example 1. Compute AI2AI_2 for A=[2534]A=\begin{bmatrix}2&5\\3&4\end{bmatrix}.

Row 1 with column 1: 2⋅1+5⋅0=22\cdot1+5\cdot0=2. Row 1 with column 2: 2⋅0+5⋅1=52\cdot0+5\cdot1=5. Row 2 with column 1: 3⋅1+4⋅0=33\cdot1+4\cdot0=3. Row 2 with column 2: 3⋅0+4⋅1=43\cdot0+4\cdot1=4.

AI2=[2534]=AAI_2=\begin{bmatrix}2&5\\3&4\end{bmatrix}=A

Because the identity never touches the entries, negatives and fractions need no special care. For A=[−1230−4]A=\begin{bmatrix}-\tfrac12&3\\0&-4\end{bmatrix}, the product AI2AI_2 is still AA, signs and fractions intact. What makes this special is that matrix multiplication normally depends on order (AB≠BAAB\neq BA for most pairs), yet the identity commutes with everything of its size, so AI=IAAI=IA.

Which size works for a non-square matrix?

Three products of a 2×3 matrix with identity matrices showing which identity size is defined
For a 2×3 matrix, I₂ goes on the left and I₃ goes on the right, while A·I₂ is undefined.

The rule AI=AAI=A comes with fine print: the product must be defined. A product exists only when the columns of the left matrix equal the rows of the right matrix, and the result keeps the left matrix’s rows and the right matrix’s columns. For a 2×32\times 3 matrix AA, that gives three cases:

  • AI3AI_3 works: (2×3)(3×3)(2\times 3)(3\times 3) gives 2×32\times 3.
  • I2AI_2A works: (2×2)(2×3)(2\times 2)(2\times 3) gives 2×32\times 3.
  • AI2AI_2 is undefined, because 3≠23\neq 2.
Size rule

On the left of AA, use the identity with as many rows as AA has. On the right of AA, use the identity with as many columns as AA has.

Worked example 2. Compute I2AI_2A for A=[123456]A=\begin{bmatrix}1&2&3\\4&5&6\end{bmatrix}.

Row 1 of I2I_2 is (1,0)(1,0). Against the three columns of AA: 1⋅1+0⋅4=11\cdot1+0\cdot4=1, 1⋅2+0⋅5=21\cdot2+0\cdot5=2, 1⋅3+0⋅6=31\cdot3+0\cdot6=3. Row 2 of I2I_2 is (0,1)(0,1): 0⋅1+1⋅4=40\cdot1+1\cdot4=4, 0⋅2+1⋅5=50\cdot2+1\cdot5=5, 0⋅3+1⋅6=60\cdot3+1\cdot6=6.

I2A=[123456]=AI_2A=\begin{bmatrix}1&2&3\\4&5&6\end{bmatrix}=A

Students lose points here by writing "AI=AAI=A" without checking sizes, or by using I3I_3 on both sides. A five-second habit prevents it: write the dimensions under each matrix before multiplying.

Is the identity matrix its own inverse? Key properties

Yes, and it is one of four facts that follow straight from the definition:

  • IT=II^{T}=I, because the pattern is symmetric across the diagonal.
  • Ik=II^{k}=I for every positive integer kk, since II=III=I (apply AI=AAI=A with A=IA=I).
  • I−1=II^{-1}=I: because II=III=I, the identity meets the definition of an inverse of itself. There is nothing to undo.
  • det⁡(I)=1\det(I)=1 for every size.

For the determinant, the 2×22\times 2 formula from the determinant of a 2×2 matrix gives 1⋅1−0⋅0=11\cdot1-0\cdot0=1. For I3I_3, expanding along the first row (see the determinant of a 3×3 matrix) leaves 1⋅(1⋅1−0⋅0)=11\cdot(1\cdot1-0\cdot0)=1, since the other two terms are multiplied by zeros.

Triangular shortcut

The determinant of any triangular matrix is the product of its diagonal entries, so det⁡(In)=1n=1\det(I_n)=1^n=1 without any expansion.

Being its own inverse does not make the identity unique. The swap matrix B=[0110]B=\begin{bmatrix}0&1\\1&0\end{bmatrix} also satisfies B2=IB^2=I, so B2=IB^2=I never proves that B=IB=I. By convention, A0=IA^0=I for any square AA, the matrix echo of b0=1b^0=1 (and of log⁡b1=0\log_b 1=0 from the logarithm rules). For more determinant work on larger matrices, the 3×3 determinant practice problems are a good next step.

How do you check that two matrices are inverses?

Two square matrices AA and BB are inverses exactly when AB=IAB=I. The identity is the target: if the product comes out as the identity, the matrices undo each other, and if it does not, they do not.

Worked example 3. Is B=[3−1−52]B=\begin{bmatrix}3&-1\\-5&2\end{bmatrix} the inverse of A=[2153]A=\begin{bmatrix}2&1\\5&3\end{bmatrix}?

Row 1 of AA with column 1 of BB: 2⋅3+1⋅(−5)=12\cdot3+1\cdot(-5)=1. Row 1 with column 2: 2⋅(−1)+1⋅2=02\cdot(-1)+1\cdot2=0. Row 2 with column 1: 5⋅3+3⋅(−5)=05\cdot3+3\cdot(-5)=0. Row 2 with column 2: 5⋅(−1)+3⋅2=15\cdot(-1)+3\cdot2=1.

AB=[1001]=I2AB=\begin{bmatrix}1&0\\0&1\end{bmatrix}=I_2

So B=A−1B=A^{-1}. As a cross-check, det⁡A=2⋅3−1⋅5=1\det A=2\cdot3-1\cdot5=1, and the recipe on the inverse of a 2×2 matrix page (swap the diagonal, negate the other two entries, divide by the determinant) produces exactly BB.

Two shortcuts save time. For square matrices, one product equal to II is enough, so there is no need to compute BABA as well. And you can reject a wrong candidate early: if the top-left entry of ABAB is not 11, or any off-diagonal entry is not 00, stop. The method has one failure point: if det⁡A=0\det A=0, no matrix BB can ever give AB=IAB=I, because AA has no inverse.

Quick check

Is B=[1201]B=\begin{bmatrix}1&2\\0&1\end{bmatrix} the inverse of A=[1−201]A=\begin{bmatrix}1&-2\\0&1\end{bmatrix}?

How do you subtract a number from a matrix?

Matrix A minus 3I changes only the diagonal entries, while A minus 3 is undefined
Writing the number as 3I lets A − 3I change only the diagonal, giving [[1,1],[2,0]].

You cannot. An expression like A−3A-3 is undefined, because a matrix and a single number have different shapes. The fix is to turn the number into a matrix that is allowed in the subtraction: 3I3I, the identity scaled by 33. Then A−3IA-3I subtracts 33 from the diagonal entries only, and the rules for adding and subtracting matrices apply because both matrices have the same size.

Worked example 4. For A=[4123]A=\begin{bmatrix}4&1\\2&3\end{bmatrix}, find the values of λ\lambda that make det⁡(A−λI)=0\det(A-\lambda I)=0.

First, A−λI=[4−λ123−λ]A-\lambda I=\begin{bmatrix}4-\lambda&1\\2&3-\lambda\end{bmatrix}. Then take the determinant:

(4−λ)(3−λ)−1⋅2=λ2−7λ+12−2=λ2−7λ+10(4-\lambda)(3-\lambda)-1\cdot2=\lambda^2-7\lambda+12-2=\lambda^2-7\lambda+10

Factor: (λ−2)(λ−5)=0(\lambda-2)(\lambda-5)=0, so λ=2\lambda=2 or λ=5\lambda=5. These are the eigenvalues of AA. If a quadratic does not factor so neatly, the quadratic formula practice problems cover the fallback.

The identity also keeps algebra honest when expanding. Because AI=IAAI=IA, matrix expressions with II expand like ordinary algebra: (A+I)2=A2+2A+I(A+I)^2=A^2+2A+I, where the last term is II, not 11. As with numbers, powers and products come before sums (see order of operations practice problems if that needs a refresher).

Try this: Let A=[1234]A=\begin{bmatrix}1&2\\3&4\end{bmatrix}. Compute A−2IA-2I, then compute (A+I)2(A+I)^2 and A2+2A+IA^2+2A+I separately and confirm they match. (Answers: A−2I=[−1232]A-2I=\begin{bmatrix}-1&2\\3&2\end{bmatrix} and both sides equal [10142131]\begin{bmatrix}10&14\\21&31\end{bmatrix}.)

Identity matrix vs matrix of ones, zero matrix and scalar matrix

Four special matrices get mixed up constantly. Each has a different job:

Matrix Entries (2×22\times 2 case) Acts like
Identity II [1001]\begin{bmatrix}1&0\\0&1\end{bmatrix} the number 11: AI=AAI=A
Zero matrix OO [0000]\begin{bmatrix}0&0\\0&0\end{bmatrix} the number 00: A+O=AA+O=A
Scalar matrix kIkI [k00k]\begin{bmatrix}k&0\\0&k\end{bmatrix} multiplying by kk: (kI)A=kA(kI)A=kA
Matrix of ones JJ [1111]\begin{bmatrix}1&1\\1&1\end{bmatrix} nothing like 11: J2=2JJ^2=2J

The matrix of ones is the usual confusion. Its entries are all 11, but multiplying by it does not preserve anything: J2=[2222]=2JJ^2=\begin{bmatrix}2&2\\2&2\end{bmatrix}=2J, which is not JJ. The zero matrix is the additive identity (it leaves a matrix unchanged under addition), while the identity is the multiplicative identity. A scalar matrix kIkI is the identity stretched by kk, which is why (kI)A(kI)A simply multiplies every entry of AA by kk.

The identity is also a special case of a diagonal matrix, one whose only nonzero entries lie on the main diagonal. A general diagonal matrix scales each row or column by a different amount. The identity scales them all by exactly 11, which is the same as doing nothing.

Where is the identity matrix used in real life?

In geometry, every 2×22\times 2 transformation matrix moves points around, and the identity is the transformation that moves nothing. A rotation by angle θ\theta is [cos⁡θ−sin⁡θsin⁡θcos⁡θ]\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}, and at θ=0∘\theta=0^\circ (or a full turn of 360∘360^\circ, from types of angles) it becomes I2I_2. Graphics and game software start every object with the identity transform, then multiply rotations, scalings and shifts onto it one at a time.

In solving, the identity is the finish line. To find an inverse by Gauss-Jordan elimination, write [A∣I][A\mid I] and row-reduce until the left half becomes II. The same row operations that turn AA into II turn the right half into A−1A^{-1}. For a system Ax=bAx=b with invertible AA, multiplying both sides by A−1A^{-1} gives Ix=A−1bIx=A^{-1}b, so x=A−1bx=A^{-1}b.

In economics, the Leontief input-output model asks how much total output xx an economy must produce to meet outside demand dd when producing goods consumes other goods, described by a matrix AA. The balance x=Ax+dx=Ax+d rearranges to (I−A)x=d(I-A)x=d, so x=(I−A)−1dx=(I-A)^{-1}d. The identity is what lets "x−Axx-Ax" be written as a single matrix times xx. In code, you create one with numpy.eye(n) in Python or eye(n) in MATLAB.

The smallest case ties back to lines. The 1×11\times 1 identity is [1][1], ordinary multiplication by one. As a function, y=xy=x is the “do nothing” line, with slope 11 and intercept 00 in slope-intercept form.

Quick check

What is the rotation matrix [cos⁡θ−sin⁡θsin⁡θcos⁡θ]\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix} when θ=0∘\theta=0^\circ?

Practice problems

0 of 5 solved

  1. Find xx and yy if [x00y−3]\begin{bmatrix}x&0\\0&y-3\end{bmatrix} is the 2×22\times 2 identity matrix.

  2. A matrix AA is 4×24\times 2. Which identity matrix makes AI=AAI=A true, and which makes IA=AIA=A true?

  3. Let A=[2−145]A=\begin{bmatrix}2&-1\\4&5\end{bmatrix}. Find det⁡(A−2I)\det(A-2I).

  4. Is B=[5221]B=\begin{bmatrix}5&2\\2&1\end{bmatrix} the inverse of A=[1−2−25]A=\begin{bmatrix}1&-2\\-2&5\end{bmatrix}?

  5. Find kk so that A2=IA^2=I for A=[120k]A=\begin{bmatrix}1&2\\0&k\end{bmatrix}.

Common questions

What is the identity matrix?

It is the square matrix with 11 in every main-diagonal position and 00 everywhere else. Multiplying any matrix of compatible size by it returns the same matrix, so it plays the role of the number 11.

Is the identity matrix always square?

Yes. The identity matrix has to be n×nn\times n so that the diagonal of ones fits and so that it can multiply a matrix from either side. When you multiply a non-square matrix, you use a different-sized identity on each side.

What is the determinant of the identity matrix?

It is always 11, for every size. The identity is triangular, so its determinant is the product of the diagonal entries, which is 1⋅1⋯1=11\cdot1\cdots1=1.

Is the identity matrix its own inverse?

Yes, I−1=II^{-1}=I. The inverse of a matrix is the matrix that multiplies with it to give II, and I⋅I=II\cdot I=I already does that.

Is the identity matrix the same as a unit matrix?

Yes, the two names mean the same thing. Some textbooks also write it as EE, from the German word Einheitsmatrix, but II is the standard symbol in US courses.

Does AI equal IA?

For a square matrix AA and the identity of the same size, yes: both products equal AA. The identity is one of the few matrices that commutes with every matrix of its size, even though matrix multiplication usually depends on order.

Up next