Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Diagonal matrix

From Wikipedia, the free encyclopedia

Matrix whose only nonzero elements are on its main diagonal
This article includes a list ofgeneral references, butit lacks sufficient correspondinginline citations. Please help toimprove this article byintroducing more precise citations.(June 2025) (Learn how and when to remove this message)

Inlinear algebra, adiagonal matrix is amatrix in which the entries outside themain diagonal are all zero; the term usually refers tosquare matrices. Elements of the main diagonal can either be zero or nonzero. An example of a 2×2 diagonal matrix is[3002]{\displaystyle \left[{\begin{smallmatrix}3&0\\0&2\end{smallmatrix}}\right]}, while an example of a 3×3 diagonal matrix is[600050004]{\displaystyle \left[{\begin{smallmatrix}6&0&0\\0&5&0\\0&0&4\end{smallmatrix}}\right]}. Anidentity matrix of any size, or any multiple of it is a diagonal matrix called ascalar matrix, for example,[0.5000.5]{\displaystyle \left[{\begin{smallmatrix}0.5&0\\0&0.5\end{smallmatrix}}\right]}. Ingeometry, a diagonal matrix may be used as ascaling matrix, since matrix multiplication with it results in changing scale (size) and possibly alsoshape; only a scalar matrix results in uniform change in scale.

Definition

[edit]

As stated above, a diagonal matrix is a matrix in which all off-diagonal entries are zero. That is, the matrixD = (di,j) withn columns andn rows is diagonal ifi,j{1,2,,n},ijdi,j=0.{\displaystyle \forall i,j\in \{1,2,\ldots ,n\},i\neq j\implies d_{i,j}=0.}

However, the main diagonal entries are unrestricted.

The termdiagonal matrix may sometimes refer to arectangular diagonal matrix, which is anm-by-n matrix with all the entries not of the formdi,i being zero. For example:[100040003000]or[100000400000300]{\displaystyle {\begin{bmatrix}1&0&0\\0&4&0\\0&0&-3\\0&0&0\\\end{bmatrix}}\quad {\text{or}}\quad {\begin{bmatrix}1&0&0&0&0\\0&4&0&0&0\\0&0&-3&0&0\end{bmatrix}}}

More often, however,diagonal matrix refers to square matrices, which can be specified explicitly as asquare diagonal matrix. A square diagonal matrix is asymmetric matrix, so this can also be called asymmetric diagonal matrix.

The following matrix is square diagonal matrix:[100040002]{\displaystyle {\begin{bmatrix}1&0&0\\0&4&0\\0&0&-2\end{bmatrix}}}

If the entries arereal numbers orcomplex numbers, then it is anormal matrix as well.

In the remainder of this article we will consider only square diagonal matrices, and refer to them simply as "diagonal matrices".

Vector-to-matrix diag operator

[edit]

A diagonal matrixD can be constructed from a vectora=[a1an]T{\displaystyle \mathbf {a} ={\begin{bmatrix}a_{1}&\dots &a_{n}\end{bmatrix}}^{\textsf {T}}} using thediag{\displaystyle \operatorname {diag} } operator:D=diag(a1,,an).{\displaystyle \mathbf {D} =\operatorname {diag} (a_{1},\dots ,a_{n}).}

This may be written more compactly asD=diag(a){\displaystyle \mathbf {D} =\operatorname {diag} (\mathbf {a} )}.

The same operator is also used to representblock diagonal matrices asA=diag(A1,,An){\displaystyle \mathbf {A} =\operatorname {diag} (\mathbf {A} _{1},\dots ,\mathbf {A} _{n})} where each argumentAi is a matrix.

Thediag operator may be written asdiag(a)=(a1T)I,{\displaystyle \operatorname {diag} (\mathbf {a} )=\left(\mathbf {a} \mathbf {1} ^{\textsf {T}}\right)\circ \mathbf {I} ,}where{\displaystyle \circ } represents theHadamard product, and1 is a constant vector with elements 1.

Matrix-to-vector diag operator

[edit]

The inverse matrix-to-vectordiag operator is sometimes denoted by the identically nameddiag(D)=[a1an]T,{\displaystyle \operatorname {diag} (\mathbf {D} )={\begin{bmatrix}a_{1}&\dots &a_{n}\end{bmatrix}}^{\textsf {T}},} where the argument is now a matrix, and the result is a vector of its diagonal entries.

The following property holds:diag(AB)=j(ABT)ij=(ABT)1.{\displaystyle \operatorname {diag} (\mathbf {A} \mathbf {B} )=\sum _{j}\left(\mathbf {A} \circ \mathbf {B} ^{\textsf {T}}\right)_{ij}=\left(\mathbf {A} \circ \mathbf {B} ^{\textsf {T}}\right)\mathbf {1} .}

Scalar matrix

[edit]

A diagonal matrix with equal diagonal entries is ascalar matrix; that is, a scalar multipleλ of theidentity matrixI. Its effect on avector isscalar multiplication byλ. For example, a 3×3 scalar matrix has the form:[λ000λ000λ]λI3{\displaystyle {\begin{bmatrix}\lambda &0&0\\0&\lambda &0\\0&0&\lambda \end{bmatrix}}\equiv \lambda {\boldsymbol {I}}_{3}}

The scalar matrices are thecenter of the algebra of matrices: that is, they are precisely the matrices thatcommute with all other square matrices of the same size.[a] By contrast, over afield (like the real numbers), a diagonal matrix with all diagonal elements distinct only commutes with diagonal matrices (itscentralizer is the set of diagonal matrices). That is because if a diagonal matrixD=diag(a1,,an){\displaystyle \mathbf {D} =\operatorname {diag} (a_{1},\dots ,a_{n})} hasaiaj,{\displaystyle a_{i}\neq a_{j},} then given a matrixM withmij0,{\displaystyle m_{ij}\neq 0,} the(i,j) term of the products are:(DM)ij=aimij{\displaystyle (\mathbf {DM} )_{ij}=a_{i}m_{ij}} and(MD)ij=mijaj,{\displaystyle (\mathbf {MD} )_{ij}=m_{ij}a_{j},} andajmijmijai{\displaystyle a_{j}m_{ij}\neq m_{ij}a_{i}} (since one can divide bymij), so they do not commute unless the off-diagonal terms are zero.[b] Diagonal matrices where the diagonal entries are not all equal or all distinct have centralizers intermediate between the whole space and only diagonal matrices.[1]

For an abstract vector spaceV (rather than the concrete vector spaceKn), the analog of scalar matrices arescalar transformations. This is true more generally for amoduleM over aringR, with theendomorphism algebraEnd(M) (algebra of linear operators onM) replacing the algebra of matrices. Formally, scalar multiplication is a linear map, inducing a mapREnd(M),{\displaystyle R\to \operatorname {End} (M),} (from a scalarλ to its corresponding scalar transformation, multiplication byλ) exhibitingEnd(M) as aR-algebra. For vector spaces, the scalar transforms are exactly thecenter of the endomorphism algebra, and, similarly, scalar invertible transforms are the center of thegeneral linear groupGL(V). The former is more generally truefree modulesMRn,{\displaystyle M\cong R^{n},} for which the endomorphism algebra is isomorphic to a matrix algebra.

Vector operations

[edit]

Multiplying a vector by a diagonal matrix multiplies each of the terms by the corresponding diagonal entry. Given a diagonal matrixD=diag(a1,,an){\displaystyle \mathbf {D} =\operatorname {diag} (a_{1},\dots ,a_{n})} and a vectorv=[x1xn]T{\displaystyle \mathbf {v} ={\begin{bmatrix}x_{1}&\dotsm &x_{n}\end{bmatrix}}^{\textsf {T}}}, the product is:Dv=diag(a1,,an)[x1xn]=[a1an][x1xn]=[a1x1anxn].{\displaystyle \mathbf {D} \mathbf {v} =\operatorname {diag} (a_{1},\dots ,a_{n}){\begin{bmatrix}x_{1}\\\vdots \\x_{n}\end{bmatrix}}={\begin{bmatrix}a_{1}\\&\ddots \\&&a_{n}\end{bmatrix}}{\begin{bmatrix}x_{1}\\\vdots \\x_{n}\end{bmatrix}}={\begin{bmatrix}a_{1}x_{1}\\\vdots \\a_{n}x_{n}\end{bmatrix}}.}

This can be expressed more compactly by using a vector instead of a diagonal matrix,d=[a1an]T{\displaystyle \mathbf {d} ={\begin{bmatrix}a_{1}&\dotsm &a_{n}\end{bmatrix}}^{\textsf {T}}}, and taking theHadamard product of the vectors (entrywise product), denoteddv{\displaystyle \mathbf {d} \circ \mathbf {v} }:

Dv=dv=[a1an][x1xn]=[a1x1anxn].{\displaystyle \mathbf {D} \mathbf {v} =\mathbf {d} \circ \mathbf {v} ={\begin{bmatrix}a_{1}\\\vdots \\a_{n}\end{bmatrix}}\circ {\begin{bmatrix}x_{1}\\\vdots \\x_{n}\end{bmatrix}}={\begin{bmatrix}a_{1}x_{1}\\\vdots \\a_{n}x_{n}\end{bmatrix}}.}

This is mathematically equivalent, but avoids storing all the zero terms of thissparse matrix. This product is thus used inmachine learning, such as computing products of derivatives inbackpropagation or multiplying IDF weights inTF-IDF,[2] since someBLAS frameworks, which multiply matrices efficiently, do not include Hadamard product capability directly.[3]

Matrix operations

[edit]

The operations of matrix addition andmatrix multiplication are especially simple for diagonal matrices. Writediag(a1, ...,an) for a diagonal matrix whose diagonal entries starting in the upper left corner area1, ...,an. Then, foraddition, we have

diag(a1,,an)+diag(b1,,bn)=diag(a1+b1,,an+bn){\displaystyle \operatorname {diag} (a_{1},\,\ldots ,\,a_{n})+\operatorname {diag} (b_{1},\,\ldots ,\,b_{n})=\operatorname {diag} (a_{1}+b_{1},\,\ldots ,\,a_{n}+b_{n})}

and formatrix multiplication,

diag(a1,,an)diag(b1,,bn)=diag(a1b1,,anbn).{\displaystyle \operatorname {diag} (a_{1},\,\ldots ,\,a_{n})\operatorname {diag} (b_{1},\,\ldots ,\,b_{n})=\operatorname {diag} (a_{1}b_{1},\,\ldots ,\,a_{n}b_{n}).}

The diagonal matrixdiag(a1, ...,an) isinvertibleif and only if the entriesa1, ...,an are all nonzero. In this case, we have

diag(a1,,an)1=diag(a11,,an1).{\displaystyle \operatorname {diag} (a_{1},\,\ldots ,\,a_{n})^{-1}=\operatorname {diag} (a_{1}^{-1},\,\ldots ,\,a_{n}^{-1}).}

In particular, the diagonal matrices form asubring of the ring of alln-by-n matrices.

Multiplying ann-by-n matrixA from theleft withdiag(a1, ...,an) amounts to multiplying thei-throw ofA byai for alli; multiplying the matrixA from theright withdiag(a1, ...,an) amounts to multiplying thei-thcolumn ofA byai for alli.

Operator matrix in eigenbasis

[edit]
Main articles:Transformation matrix § Finding the matrix of a transformation, andEigenvalues and eigenvectors

As explained indetermining coefficients of operator matrix, there is a special basis,e1, ...,en, for which the matrixA takes the diagonal form. Hence, in the defining equationAej=iai,jei{\textstyle \mathbf {Ae} _{j}=\sum _{i}a_{i,j}\mathbf {e} _{i}}, all coefficientsai, j withij are zero, leaving only one term per sum. The surviving diagonal elements,ai, j, are known aseigenvalues and designated withλi in the equation, which reduces toAei=λiei.{\displaystyle \mathbf {Ae} _{i}=\lambda _{i}\mathbf {e} _{i}.} The resulting equation is known aseigenvalue equation[4] and used to derive thecharacteristic polynomial and, further,eigenvalues and eigenvectors.

In other words, theeigenvalues ofdiag(λ1, ...,λn) areλ1, ...,λn with associatedeigenvectors ofe1, ...,en.

Properties

[edit]
  • Thedeterminant ofdiag(a1, ...,an) is the producta1an.
  • Theadjugate of a diagonal matrix is again diagonal.
  • Where all matrices are square,
  • Theidentity matrixIn andzero matrix are diagonal.
  • A 1×1 matrix is always diagonal.
  • The square of a 2×2 matrix with zerotrace is always diagonal.

Applications

[edit]

Diagonal matrices occur in many areas of linear algebra. Because of the simple description of the matrix operation and eigenvalues/eigenvectors given above, it is typically desirable to represent a given matrix orlinear map by a diagonal matrix.

In fact, a givenn-by-n matrixA issimilar to a diagonal matrix (meaning that there is a matrixX such thatX−1AX is diagonal) if and only if it hasnlinearly independent eigenvectors. Such matrices are said to bediagonalizable.

Over thefield ofreal orcomplex numbers, more is true. Thespectral theorem says that everynormal matrix isunitarily similar to a diagonal matrix (ifAA =AA then there exists aunitary matrixU such thatUAU is diagonal). Furthermore, thesingular value decomposition implies that for any matrixA, there exist unitary matricesU andV such thatUAV is diagonal with positive entries.

Operator theory

[edit]

Inoperator theory, particularly the study ofPDEs, operators are particularly easy to understand and PDEs easy to solve if the operator is diagonal with respect to the basis with which one is working; this corresponds to aseparable partial differential equation. Therefore, a key technique to understanding operators is a change of coordinates—in the language of operators, anintegral transform—which changes the basis to aneigenbasis ofeigenfunctions: which makes the equation separable. An important example of this is theFourier transform, which diagonalizes constant coefficient differentiation operators (or more generally translation invariant operators), such as the Laplacian operator, say, in theheat equation.

Especially easy aremultiplication operators, which are defined as multiplication by (the values of) a fixed function–the values of the function at each point correspond to the diagonal entries of a matrix.

See also

[edit]

Notes

[edit]
  1. ^Proof: given theelementary matrixeij{\displaystyle e_{ij}},Meij{\displaystyle Me_{ij}} is the matrix with only thei-th row ofM andeijM{\displaystyle e_{ij}M} is the square matrix with only theMj-th column, so the non-diagonal entries must be zero, and theith diagonal entry much equal thejth diagonal entry.
  2. ^Over more general rings, this does not hold, because one cannot always divide.

References

[edit]
  1. ^"Do Diagonal Matrices Always Commute?". Stack Exchange. March 15, 2016. RetrievedAugust 4, 2018.
  2. ^Sahami, Mehran (2009-06-15).Text Mining: Classification, Clustering, and Applications. CRC Press. p. 14.ISBN 9781420059458.
  3. ^"Element-wise vector-vector multiplication in BLAS?".stackoverflow.com. 2011-10-01. Retrieved2020-08-30.
  4. ^Nearing, James (2010)."Chapter 7.9: Eigenvalues and Eigenvectors"(PDF).Mathematical Tools for Physics. Dover Publications.ISBN 978-0486482125. RetrievedJanuary 1, 2012.

Sources

[edit]
Matrix classes
Explicitly constrained entries
Constant
Conditions oneigenvalues or eigenvectors
Satisfying conditions onproducts orinverses
With specific applications
Used instatistics
Used ingraph theory
Used in science and engineering
Related terms
Retrieved from "https://en.wikipedia.org/w/index.php?title=Diagonal_matrix&oldid=1297704246"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp