29

Prove that the inverse of an invertible upper triangular matrix of order 3 is invertible and upper triangular.

I have checked all the similar questions but I couldn't understand any of them.

I supposed random 3x3 upper triangular matrix and tried to find its inverse, but it came out lower triangular matrix, not the upper triangular. Can anyone please give me a suggestion, how to prove it?

$$ A=\left(\begin{array}{rrr}% a&b&c\\% 0&d&e\\% 0&0&f\\% \end{array}\right)% $$ $$ x11=\left(\begin{array}{rrr}% d&e\\% 0&f\\% \end{array}\right)% =df, x12=-\left(\begin{array}{rrr}% 0&e\\% 0&f\\% \end{array}\right)% =0, x13=\left(\begin{array}{rrr}% 0&d\\% 0&0\\% \end{array}\right)% =0 $$ $$ x21=-\left(\begin{array}{rrr}% b&c\\% 0&f\\% \end{array}\right)% =-bf, X22=\left(\begin{array}{rrr}% a&c\\% 0&f\\% \end{array}\right)% =af, X23=-\left(\begin{array}{rrr}% a&b\\% 0&0\\% \end{array}\right)% =0 $$ $$ x31=\left(\begin{array}{rrr}% b&c\\% d&e\\% \end{array}\right)% =bc-cd, x32=-\left(\begin{array}{rrr}% a&c\\% 0&e\\% \end{array}\right)% =ac, x31=\left(\begin{array}{rrr}% a&b\\% 0&d\\% \end{array}\right)% =ad $$ $$ adjoint A = \left(\begin{array}{rrr}% df&0&0\\% -bf&af&0\\% bc-cd&-ac&ad\\% \end{array}\right)% $$ $$ det A = a\left(\begin{array}{rrr}% d&e\\% 0&f\\% \end{array}\right)% =adf $$ $$ Inverse-A =1/adf \left(\begin{array}{rrr}% df&0&0\\% -bf&af&0\\% bc-cd&-ac&ad\\% \end{array}\right)% $$ It came out lower triangular matrix. Is there any way to make it upper triangular matrix?

Henry
  • 5,847
  • If you show your steps when you tried it before and it came out lower triangular, we could probably diagnose the error. – Greg Martin Nov 03 '14 at 07:33
  • I added the steps which I did. – Hafiz Temuri Nov 03 '14 at 15:43
  • 5
    What you call the adjoint is in fact the cofactor matrix, you should take the transpose of this. See http://en.wikipedia.org/wiki/Adjugate_matrix. PS: there is a slight miscalculation in $x_{31}$ and $x_{32}$. – Marc Bogaerts Nov 03 '14 at 16:56
  • 2
    You need to take the transpose of the cofactor or adjoint matrix. See here: http://en.m.wikipedia.org/wiki/Invertible_matrix – Robert Lewis Nov 03 '14 at 17:16
  • I got it, thank guys :) – Hafiz Temuri Nov 03 '14 at 21:54
  • 1
    To be more accurate we don't need to prove that the inverse of an any invertible matrix is .. invertible. It is obvious from the definition of invertible matrix. So we can concentrate solely on upper triangularity. – Widawensen Apr 16 '20 at 07:13

6 Answers6

89

There is a nice trick for calculating the inverse of any invertible upper triangular matrix, one which avoids the computation of complicated determinants. Since it works for any such upper (or lower) triangular matrix $T$ of any size $n$, I'll explain it in that context.

The first thing one needs to remember is that the determinant of a triangular matrix is the product of its diagonal entries. This may easily be seen by induction on $n$. It is trivially true if $n = 1$; for $n = 2$, we have

$T= \begin{bmatrix} t_{11} & t_{12} \\ 0 & t_{22} \end{bmatrix}, \tag{1}$

so obviously

$\det(T) = t_{11} t_{22}. \tag{2}$

If we now formulate the inductive hypothesis that

$\det(T) = \prod_1^k t_{ii} \tag{3}$

for any upper triangular $T$ of size $k$,

$T = [t_{ij}], \; \; 1 \le i, j \le k, \tag{4}$

then for $T$ of size $k + 1$ we have that

$\det(T) = t_{11} \det(T_{11}), \tag{5}$

where $T_{11}$ is the $k \times k$ matrix formed by deleting the first row and comumn of $T$. (4) follows easily from the expansion of $\det(T)$ in terms of its first-column minors (see this wikipedia page), since $t_{i1} = 0$ for $i \ge 2$. From our inductive hypothesis,

$\det(T_{11}) = \prod_2^{k + 1} t_{ii}, \tag{6}$

whence from (5)

$\det(T) = t_{11} \det(T_{11}) = t_{11} \prod_2^{k + 1} t_{ii} = \prod_1^{k + 1} t_{ii}, \tag{7}$

proving our assertion.

It follows immediately from (7) that the characteristic polynomial $p_T(\lambda)$ of $T$ is

$p_T(\lambda) = \det(T - \lambda I) = \prod_1^n (t_{ii} - \lambda), \tag{8}$

and from (8) that the eigenvalues of $T$ are precisely its diagonal entries, i.e. the $t_{ii}$, $1 \le i \le n$; also follows from (7) the related fact that $T$ is nonsingular, that is, $\det(T) \ne 0$, precisely when its diagonal entries are all nonzero.

For non-singular $T$ we may compute $T^{-1}$ as follows: write

$T = \Lambda + T_u, \tag{9}$

where $\Lambda$ is the diagonal matrix formed from the diagonal of $T$; viz.,

$\Lambda = [\delta_{ij} t_{ij}]; \tag{10}$

then $\Lambda$ is nonsingular and $T_u = T - \Lambda$ is the strictly upper triangular matrix obtained by setting the diagonal of $T$ to zero, i.e. setting $t_{ii} = 0$ for $1 \le i \le n$. We may write

$T = \Lambda (I + \Lambda^{-1} T_u), \tag{11}$

whence

$T^{-1} = (I + \Lambda^{-1} T_u)^{-1} \Lambda^{-1}. \tag{12}$

The matrix $\Lambda^{-1} T_u$ occurring in (12) is itself in fact strictly upper triagnular as well as is $T_u$; indeed, for any diagonal $D$, $DT_u$ is strictly upper tirangular, an assertion which is easily validated by direct calculation. It follows that $\Lambda^{-1} T_u$ is in fact nilpotent; that is, $(\Lambda^{-1} T_u)^n = 0$. We may now use the well-known algebraic identity

$(1 + x)(\sum_0^m (-x)^j) = 1 - (-x)^{m + 1}, \tag{13}$

easily seen to hold in any unital ring, applied to the matrix $x =\Lambda^{-1} T_u$, yielding, with $m = n - 1$,

$(I + \Lambda^{-1}T_u)(\sum_0^m (-\Lambda^{-1}T_u)^j) = I - (-\Lambda^{-1}T_u)^{m + 1} = I - (-\Lambda^{-1}T_u)^n = I. \tag{13}$

(13) shows that the inverse of $I + \Lambda^{-1}T_u$ is given by

$(I + \Lambda^{-1} T_u)^{-1} = \sum_0^m (-\Lambda^{-1}T_u)^j. \tag{14}$

It follows from (14) that $(I + \Lambda T_u)^{-1}$ is upper triangular, since each of the matrices $(-\Lambda^{-1}T_u)^j$, $j \ge 1$, is strictly upper triangular, and $(-\Lambda^{-1}T_u)^0 = I$. It further follows then that $T^{-1} = (I + \Lambda T_u)^{-1}\Lambda^{-1}$ is also upper triangular, being the product of the upper triangular matrix $(I + \Lambda T_u)^{-1}$ and the diagonal matrix $\Lambda^{-1}$. We have thus shown that the inverse of any invertible upper triangular matrix, of any size $n$, is itself an upper triangular matrix.

The inverse of any invertible matrix is invertible, the inverse of the inverse being the original matrix.

We can apply these considerations to the calculation of $A^{-1}$, where

$A = \begin{bmatrix} a & b & c \\ 0 & d & e \\ 0 & 0 & f \end{bmatrix}; \tag{14}$

here we have

$\Lambda = \begin{bmatrix} a & 0 & 0 \\ 0 & d & 0 \\ 0 & 0 & f \end{bmatrix} \tag{15}$

and

$T_u = \begin{bmatrix} 0 & b & c \\ 0 & 0 & e \\ 0 & 0 & 0 \end{bmatrix}; \tag{16}$

then

$\Lambda^{-1} T_u = \begin{bmatrix} a^{-1} & 0 & 0 \\ 0 & d^{-1} & 0 \\ 0 & 0 & f^{-1} \end{bmatrix} \begin{bmatrix} 0 & b & c \\ 0 & 0 & e \\ 0 & 0 & 0 \end{bmatrix} = \begin{bmatrix} 0 & ba^{-1} & ca^{-1} \\ 0 & 0 & ed^{-1} \\ 0 & 0 & 0 \end{bmatrix}; \tag{17}$

$(\Lambda^{-1} T_u)^2 = \begin{bmatrix} 0 & ba^{-1} & ca^{-1} \\ 0 & 0 & ed^{-1} \\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} 0 & ba^{-1} & ca^{-1} \\ 0 & 0 & ed^{-1} \\ 0 & 0 & 0 \end{bmatrix} = \begin{bmatrix} 0 & 0 & bea^{-1}d^{-1} \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}; \tag{18}$

$(\Lambda^{-1} T_u)^3 = 0; \tag{19}$

$\sum_0^2 (-\Lambda^{-1} T_u)^j = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} - \begin{bmatrix} 0 & ba^{-1} & ca^{-1} \\ 0 & 0 & ed^{-1} \\ 0 & 0 & 0 \end{bmatrix} + \begin{bmatrix} 0 & 0 & bea^{-1}d^{-1} \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}$ $= \begin{bmatrix} 1 & -ba^{-1} & (be - cd)a^{-1}d^{-1} \\ 0 & 1 &- ed^{-1} \\ 0 & 0 & 1 \end{bmatrix}; \tag{20}$

finally,

$T^{-1} = (I + \Lambda^{-1} T_u)^{-1} \Lambda^{-1} = (\sum_0^2 (-\Lambda^{-1} T_u)^j) \Lambda^{-1}$ $= \begin{bmatrix} 1 & -ba^{-1} & (be - cd)a^{-1}d^{-1} \\ 0 & 1 &- ed^{-1} \\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} a^{-1} & 0 & 0 \\ 0 & d^{-1} & 0 \\ 0 & 0 & f^{-1} \end{bmatrix}$ $= \begin{bmatrix} a^{-1} & -ba^{-1}d^{-1} & (be - cd)a^{-1}d^{-1}f^{-1} \\ 0 & d^{-1} &- ed^{-1}f^{-1} \\ 0 & 0 & f^{-1} \end{bmatrix}, \tag{21}$

this in agreement with Nimda's calculations. Indeed, we have

$\begin{bmatrix} a & b & c \\ 0 & d & e \\ 0 & 0 & f \end{bmatrix}\begin{bmatrix} a^{-1} & -ba^{-1}d^{-1} & (be - cd)a^{-1}d^{-1}f^{-1} \\ 0 & d^{-1} &- ed^{-1}f^{-1} \\ 0 & 0 & f^{-1} \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}, \tag{22}$

as some simple algebra reveals.

Of course all this stuff applies to lower triangular matrices as well, and the demonstrations are similar and analogous, that is, essentially the same.

Hope this helps! Cheers,

and as always,

Fiat Lux!!!

Robert Lewis
  • 72,871
  • 1
    Great answer! Can you please take a look at my question too? – Henry Apr 06 '18 at 19:33
  • 2
    Thanks. Yeah, give me a few minutes. And thanks for the bounty-boost! Cheers! – Robert Lewis Apr 06 '18 at 19:45
  • 1
    @Henry: I took a look at your problem but have nothing quite certain to add yet. Still thinking . . . – Robert Lewis Apr 06 '18 at 22:21
  • 2
    Bounty boost fully deserved IMO! thanks a lot for this sexy piece of work. – fr_andres Nov 27 '19 at 16:29
  • @fr_andresSupportsMonicaCellio: that's a nice way to put it, thanks! – Robert Lewis Nov 27 '19 at 16:31
  • 1
    @RobertLewis I just got my hands on this paper: https://arxiv.org/pdf/1301.6820.pdf do you know if this or any other method would allow me to express a specific element $T_{ij}^{-1}$ as a function of $T$ elements, for arbitrary matrix size? At first sight I can't tell if having an all-zero diagonal could be a problem – fr_andres Nov 29 '19 at 03:47
  • Nevermind, that method allows for element-wise inversion directly (that p-object is pretty misterious to me). Thanks anyway! – fr_andres Dec 11 '19 at 21:21
  • 1
    @fr_andres that paper your provided shows how to efficiently compute powers of upper-diagonal matrices. This is really nice! since it makes this ingenious answer even more efficient – Car Loz Sep 23 '21 at 15:32
22

It is not too difficult to solve directly $$ \left(\begin{array}{rrr}% a&b&c\\% 0&d&e\\% 0&0&f\\% \end{array}\right)% \left(\begin{array}{rrr}% x&y&z\\% 0&y&v\\% 0&0&w\\% \end{array}\right)% = \left(\begin{array}{rrr}% 1&0&0\\% 0&1&0\\% 0&0&1\\% \end{array}\right)% $$ giving

$$ \left(\begin{array}{rrr}% 1/a& -b/(ad)&(be-cd)/(afd)\\% 0&1/d&-e/(fd)\\% 0&0&1/f\\% \end{array}\right)% $$ from which we see directly that the matrix is invertible if all $a,d$ and $f$ are different from zero.

  • That's my question, how you come up with that inverse? cos when I try to solve it, I got lower triangular matrix. Please check my steps which I just added to my main question, and let me know if you find any mistake in it. Thanks! – Hafiz Temuri Nov 03 '14 at 15:45
  • Note. A particular case appears in the study of the Heisenberg group, wherein $a = d = f = 1$. Then the inverse greatly simplifies. – dohmatob Nov 08 '18 at 19:23
  • 1
    small typo, two $y$'s in the second matrix – Dylan Dijk Feb 19 '24 at 17:28
5

As the question was made once more alive I will give for it the answer in a much more general sense, valid not only for the upper-triangularity property of matrices, but also for other properties if they are present in the described below circumstances.

Now suppose that for some matrices $A,B$ you consider a pattern of entries, say it could be mentioned "upper-triangularity" (UT) and you have proved that for any matrices with UT property the sum $A+B$ and the product $AB$ preserves UT (what is easy to prove).

If so then also powers $A^k$ preserve UT.

Consequently since any inverse can be expressed as polynomial $p(A)$ of $A$ directly calculated from Cayley-Hamilton theorem then also $ A^{-1} $ has the UT property.

Widawensen
  • 8,517
  • 1
    To be more accurate in order to make polynomial we need also that $kA$ (where $k$ is a scalar) also has the property of $A$ ( important for constructing any polynomial) In some cases of considering properties we can take into account that multiplying by a scalar is equivalent by multiplying by the proper scalar matrix ( which obviously should have the same property as in considered type of matrix). One can notice that considered "property" is very abstract in its nature and particular pattern of entries is just one possible case of such property. – Widawensen Apr 16 '20 at 07:02
4

Just to be add a simple answer, I will add another one. Note that, by the $QR$ decomposition, for any invertible upper-triangular matrix $U$, there exist an upper-triangular matrix $R$ and an orthogonal matrix $Q$ so that $U^{-1} = Q R.$ Hence, ${(R U)^{-1}} = Q.$ This implies that, inverting both sides, $$R U = Q^{T}.$$ Since the product of two upper-triangular matrices are still upper triangular, we have found an orthogonal upper-triangular matrix, which is impossible unless $Q=D$, for some diagonal Matrix $D$, see this link.. Thus the result follows by noting that $$U^{-1}=Q R = DR,$$ which is upper-triangular.

1

Here's Python code to invert an upper triangular matrix of any order, using a traditional looping approach:

import numpy as np

def mat_inverse_upper(U):

inverse of upper triangular directly

n = len(U) result = np.eye(n) # Identity matrix for k in range(n): for j in range(n): for i in range(k): result[j][k] -= result[j][i] * U[i][k] result[j][k] /= U[k][k] return result

0

We give a closed form expression for the inverse of the matrix in question in arbitrary dimension. Here we implemented the technique being proposed by Robert Lewis.

Let $L_{i,j} = 1_{j \ge i} \cdot l_{-\frac{i^2}{2} + j -N + i(\frac{1}{2} + N)}$ for $i,j=1,\cdots,N$. This is an upper diagonal matrix that looks as follows:

\begin{eqnarray} L = \left.\left( \begin{array}{lllll} l_1 & l_2 & l_3 & l_4 & \cdots &l_N \\ 0 & l_{N+1} & l_{N+2} &l_{N+3} & \cdots & l_{2 N-1} \\ 0 & 0 & l_{2 N} & l_{2N+1} & \cdots & l_{3N-3} \\ 0 & 0 & 0 & l_{3N-2} & \cdots & l_{4N-6} \\ \vdots \\ 0 & 0 & 0 & 0 & \cdots & l_{\binom{N+1}{2}} \end{array} \right)\right._{N \times N} \tag{1} \end{eqnarray}

The inverse of the matrix above is given as follows:

\begin{eqnarray} &&(L^{-1})_{i,j} =\\ && \sum\limits_{p=0}^{N-1} (-1)^p \sum\limits_{i+1 \le \xi_{p-2} < \xi_{p-3} < \xi_{p-4} < \cdots < \xi_1 < \xi \le j-1} \left( \prod\limits_{q=-1}^{p-1} \frac{l_{(\left(N+\frac{3}{2}\right) \xi _q-N-\frac{\xi _q^2}{2})+(\xi _{q-1}-\xi_q)}}{ l_{(\left(N+\frac{3}{2}\right) \xi _q-N-\frac{\xi _q^2}{2})}} \right) \tag{2} \end{eqnarray}

subject to $\xi_{-2},\xi_{-1},\xi_{p-1} = \infty,j, i$ and $l_\infty=1$.

The code below verifies the formula in question:

In[1770]:= NN = RandomInteger[{3, 10}];
myRoutine[l_List, NN_] := Module[{L, S, count, i, j},
   L = ConstantArray[0, {NN, NN}];
   count = 1;
   Do[L[[i, j]] = l[[count]]; count++;, {i, 1, NN}, {j, i, NN}];
   S = Transpose[L] . L;
   {S, L}
   ];
tmp = myRoutine[Table[l[p], {p, 1, (NN + 1) NN/2}], NN];
S = tmp[[1]]; L = tmp[[2]];
\[CapitalLambda] = DiagonalMatrix[Diagonal[L]];
Tu = L - \[CapitalLambda];

mat = Inverse[[CapitalLambda]] . Tu; mat1 = Table[ If[p == 0, IdentityMatrix[NN], MatrixPower[mat, p]] . Inverse[[CapitalLambda]], {p, 0, NN - 1}];

f[i_, j_] := l[-i^2/2 + j - NN + i (1/2 + NN)]/l[-i^2/2 - NN + i (3/2 + NN)]; mat2 = Table[ Table[ Which[ p == 0, If[i == j, 1/l[-j^2/2 - NN + j (3/2 + NN)], 0], p == 1, If[j - i > 0, f[i, j], 0]/l[-j^2/2 - NN + j (3/2 + NN)], True, Sum[ Product[f[If[q == p - 1, i, [Xi][q]], If[q == 0, j, [Xi][q - 1]]], {q, 0, p - 1}]/ l[-j^2/2 - NN + j (3/2 + NN)] , Evaluate[ Sequence @@ Table[{[Xi][q], If[q == p - 2, i, [Xi][q + 1]] + 1, j - 1}, {q, p - 2, 0, -1}]]] ] , {i, 1, NN}, {j, 1, NN}] , {p, 0, NN - 1}]; Flatten[(mat1 - mat2)] // Expand // Total

LI = Sum[mat2[[p + 1]] (-1)^p, {p, 0, NN - 1}]; Simplify[LI . L] === IdentityMatrix[NN] && Simplify[L . LI] === IdentityMatrix[NN]

The inverse matrix for <span class=$N=6$" />

Przemo
  • 11,971
  • 1
  • 25
  • 56