Can the Diagonal Property of a Matrix be Used to Speed Up Inversion?

In summary, there is a special structure in the given matrix that allows for a faster way to calculate its inverse. By splitting the matrix into blocks and using diagonal matrices, the number of computations can be reduced significantly. This method can be extended to more blocks and does not require actual matrix multiplications or inversions.
  • #1
codenamev
2
0

Homework Statement



Hi, I'm trying to calculate the inverse of a really big matrix (4096x4096) using matlab. The inversion process takes too long on my pc, so i want to find a faster way.
The matrix has a strange property that i think could be useful to solve the problem:
splitting it in 64 blocks (8 rows and 8 columns of 256x256 submatrices), each submatrice is diagonal. Inverting a diagonal matrix is really simple, so i am asking you if this property can be used to calculate the inversion in a faster way.


Homework Equations





The Attempt at a Solution



i found something about block diagonal matrix inversion, but my matrix is a bit different from a block diagonal matrix, because i have no zero submatrices... each block is diagonal...
i'm trying to use the matrix inversion in block form but i feel that there must be a smarter solution...
thanks
 
Physics news on Phys.org
  • #2
codenamev said:

Homework Statement



Hi, I'm trying to calculate the inverse of a really big matrix (4096x4096) using matlab. The inversion process takes too long on my pc, so i want to find a faster way.
The matrix has a strange property that i think could be useful to solve the problem:
splitting it in 64 blocks (8 rows and 8 columns of 256x256 submatrices), each submatrice is diagonal. Inverting a diagonal matrix is really simple, so i am asking you if this property can be used to calculate the inversion in a faster way.

Homework Equations


The Attempt at a Solution



i found something about block diagonal matrix inversion, but my matrix is a bit different from a block diagonal matrix, because i have no zero submatrices... each block is diagonal...
i'm trying to use the matrix inversion in block form but i feel that there must be a smarter solution...
thanks

You are correct: the special structure allow you to reduce the computations from many billions of multiplications and additions, to a few hundred thousand. It gets complicated (but straightforward in principle), so I will just illustrate it for two cases: (I) the 2n x 2n case (4 nxn diagonal blocks); and (II) the 3n x 3n case (9 nxn diagonal blocks).
(I) [tex]M = \pmatrix{A&B\\D&E}, \text{ where } A = \text{diag}(a_1, a_2,\ldots,a_n), \text{ etc.}[/tex] We want to solve the equations [itex] MZ = R,[/itex] where
[tex]R = \pmatrix{u\\v}, u, \, v = \text{given n-dimensional vectors}[/tex] and
[tex] Z = \pmatrix{x\\y}, \; x,\, y = \text{unknown n-dimensional vectors.}[/tex]
These become
[tex] Ax + By = u \longrightarrow x = A^{-1}u - A^{-1}B y\\
Dx+Ey = v \longrightarrow D(A^{-1}u - A^{-1}B y) + Ey = v,\\
\text{so } E'y = v', \text{where } E' = E - D A^{-1}B, \; v' = v - D A^{-1} u.
[/tex]
So, we can get y, then can get x from a previous formula.

Note: this is simplified by using the following simple facts: (1) The inverse of a diagonal matrix is diagonal (if it exists), that is: [tex] (\text{diag}(a_1,\ldots,a_n))^{-1} = \text{diag}(1/a_1, \ldots, 1/a_n).[/tex] (2) The product of two diagonal matrices is diagonal; that is:
[tex] \text{diag}(a_1,\ldots,a_n) \cdot \text{diag}(b_1,\ldots,b_n)
= \text{diag}(a_1 b_1, \ldots, a_n b_n).[/tex].
(3) The product of a scalar and a diagonal matrix is diagonal; that is
[tex] c\: \text{diag}(a_1,\ldots,a_n) = \text{diag}(ca_1,\ldots, ca_n),[/tex] for any constant c.
(4) The sum of diagonal matrices is diagonal; that is
[tex] \text{diag}(a_1,\ldots,a_n) + \text{diag}(b_1,\ldots,n_n)
= \text{diag}(a_1 + b_1, \ldots, a_n + b_n). [/tex]

Therefore, the matrix E' above is diagonal, with (i,i)-element equal to
[tex] E'(i,i) \equiv e'_i = e_i - d_i b_i/a_i, [/tex] so no actual matrix multiplications are needed. Further, solving E'y = v' for y and Ax = u-By for x is easy.

(II) Solve
[tex] \pmatrix{A&B&C\\D&E&F\\G&H&K} \pmatrix{x\\y\\z} = \pmatrix{u\\v\\w},[/tex]
where each of the listed sub-matrices are nxn diagonal.
We can write the first two equations as
[tex] Ax + By = U, Dx + Ey = V, [/tex] where [itex] U = u-Cz,\; V = v - Fz,[/itex] so from above we have
[tex] E' y = V' = V - DA^{-1}U = v - DA^{-1}u + (DA^{-1}C -F)z,[/tex]
which we can write as [itex] E' y = v' + F' z.[/itex]
We can substitute this into the equation for x to get [itex] Ax = u' + C'z, [/itex] where we get u' and C' from messy but straightforward algebra. So now we have x and y solved in terms of z, and can substitute these expressions into the third equation
[tex] Gx + Hy + Kz = w,[/tex]
to get an equation of the form [itex] K' z = w'.[/itex] All the matrices E', F', C', K', etc., are diagonal, so all the computations are very easy.

You can extend the method to 64 blocks in the same way; it just needs lots of labels to keep track of the different matrices throughout. All of the matrices encountered are diagonal, so it is enough to store their diagonals, and no acutal matrix multiplications or inversions are needed.

RGV
 
Last edited:
  • #3
Very nice post, Ray!
 
  • #4
thank you very much for your help!
 

FAQ: Can the Diagonal Property of a Matrix be Used to Speed Up Inversion?

1. What is the Matrix Inversion Problem?

The Matrix Inversion Problem is a mathematical problem that involves finding the inverse of a square matrix. The inverse of a matrix is a matrix that, when multiplied by the original matrix, yields the identity matrix. In simpler terms, it is finding a matrix that "undoes" the effects of the original matrix.

2. Why is the Matrix Inversion Problem important?

The Matrix Inversion Problem is important in various fields such as engineering, physics, and computer science. It is used in solving systems of linear equations, computing determinants, and in various algorithms for data analysis and machine learning.

3. How is the Matrix Inversion Problem solved?

The Matrix Inversion Problem can be solved using various methods such as Gaussian elimination, LU decomposition, and the Gauss-Jordan method. These methods involve using row operations to transform the original matrix into an identity matrix, thus finding the inverse.

4. What are some applications of the Matrix Inversion Problem?

The Matrix Inversion Problem has practical applications in many fields. In engineering, it is used in solving circuit problems and in control systems. In physics, it is used in solving problems involving forces and motion. In computer science, it is used in data compression and optimization algorithms.

5. Are there any limitations to solving the Matrix Inversion Problem?

Yes, there are some limitations to solving the Matrix Inversion Problem. One limitation is that not all matrices have an inverse. For a matrix to have an inverse, it must be a square matrix and its determinant must not be equal to zero. Another limitation is that the computation of the inverse can be computationally expensive for large matrices, so other methods such as matrix decomposition may be used instead.

Similar threads

Back
Top