Euler Hall — free maths guides

Invert a diagonal matrix by taking reciprocals of its diagonal

Write the inverse of a diagonal matrix as the diagonal matrix of reciprocals. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.

The rule

For a diagonal matrixD=diag⁡(d1,…,dn)D=\operatorname{diag}(d_1,\dots,d_n),

D−1=diag⁡ ⁣(1d1,…,1dn),D^{-1}=\operatorname{diag}\!\left(\frac1{d_1},\dots,\frac1{d_n}\right),

andD−1D^{-1} exists exactly when nodid_i is zero.

The zeros off the diagonal stay zero in the inverse. They are not choices to be recomputed: a diagonal matrix has no coupling, so there is no coupling to undo.

The product really is the identity

MultiplyDD by the candidate inverse. Entry(i,j)(i,j) of the product is

∑kdik 1dkj (with the reciprocal understood only when i=j).\sum_k d_{ik}\,\frac1{d_{kj}}\ \text{(with the reciprocal understood only when }i=j\text{)}.

Concretely: rowii ofDD has one nonzero,did_i in columnii; columnii ofD−1D^{-1} has one nonzero,1/di1/d_i in rowii. Their product isdi⋅(1/di)=1d_i\cdot(1/d_i)=1 — the diagonal entry. Any other row and column meet at a position where one of them is zero, so the off-diagonal entries are00. The result is exactlyII, in both orders, and a diagonal matrix commutes with its inverse precisely because nothing mixes.

Note what the check is: a product against the identity, not "I divided each entry". Dividing is how you build the candidate; multiplying is how you know it is right. Those are different acts, and the second one is the one that catches a slip.

Worked: invert, then solve

Let

D=[20005000−4],b=[6108].D=\begin{bmatrix}2&0&0\\0&5&0\\0&0&-4\end{bmatrix},\qquad b=\begin{bmatrix}6\\10\\8\end{bmatrix}.

The inverse:D−1=diag⁡(12,15,−14)D^{-1}=\operatorname{diag}\left(\tfrac12,\tfrac15,-\tfrac14\right).

Check one entry: row 3 ofDD times column 3 ofD−1D^{-1} is(−4)(−14)=1(-4)(-\tfrac14)=1. Row 2 ofDD times column 3 ofD−1D^{-1} is5⋅0+0⋅0+0⋅(−14)=05\cdot0+0\cdot0+0\cdot(-\tfrac14)=0.

SolveDx=bD\mathbf{x}=b. Three separate equations:

2x1=6,5x2=10,−4x3=8.2x_1=6,\qquad 5x_2=10,\qquad -4x_3=8.

Sox=(3, 2, −2)x=(3,\,2,\,-2). The same answer asD−1bD^{-1}b: divide each entry ofbb by the matching diagonal entry.

No elimination was needed, and none would help. A diagonal system is already solved — you only have to read it one coordinate at a time.

By the end you can
  • Write the inverse of a diagonal matrix as the diagonal matrix of reciprocals
  • Decide invertibility from the diagonal entries alone
  • Solve a diagonal system coordinate by coordinate
Test yourself
  1. 1. What isdiag⁡(4,−3,12)−1\operatorname{diag}(4,-3,\tfrac12)^{-1}?
  2. 2. When is a diagonal matrix not invertible?
  3. 3. Why do the off-diagonal zeros stay zero in the inverse?
  4. 4. Solvediag⁡(5,−2)x=(15,6)\operatorname{diag}(5,-2)\mathbf{x}=(15,6).
Answers
  1. 1.diag⁡(14,−13,2)\operatorname{diag}\left(\tfrac14,-\tfrac13,2\right). Check one:(−3)⋅(−13)=1(-3)\cdot(-\tfrac13)=1.
  2. 2. Exactly when some diagonal entry is zero. Equivalently, when its determinant — the product of the diagonal — is zero.
  3. 3. Because the matrix never mixes two coordinates, so there is no mixing to undo. Rowii ofDD and columnii ofD−1D^{-1} are the only pair that meet, and rowii ofDD multiplied by a columnj≠ij\ne i ofD−1D^{-1} hits a zero.
  4. 4.x1=3x_1=3 andx2=−3x_2=-3: divide each entry of the right side by the matching diagonal entry.
Work out where to start — free, no accountAnswer six real questions — free, no account