Diagonal matrix
A diagonal matrix is a square matrix whose entries outside the main diagonal are zero.
Quantum Programming in Depth
A diagonal matrix is a square matrix whose entries outside the main diagonal are zero.
- How it is used
- Represents phase oracles and CS-decomposition components without mixing computational-basis states.
- How deep it goes
- Explains diagonal entries through single-qubit phase action, arbitrary-size CS constraints, and oracle behavior.
- Examples
- Uses C and S matrices, a single-qubit phase operation, and an oracle marking 001 and 110.
- What you can do after
- Evaluate/understand which basis-state amplitudes a diagonal quantum operation phases or sign-flips.
Read how Quantum Programming in Depth explains diagonal matrix →
Math and Architectures of Deep Learning
A square matrix whose only possibly nonzero entries are on the main diagonal.
- How it is used
- Supports diagonalization, coordinate rotation, quadratic-form analysis, and later PCA reasoning.
- How deep it goes
- Defines the structure and works through eigenvector-based diagonalization and geometric transformation, without developing numerical stability details.
- Examples
- Uses the ellipse 5x² + 6xy + 5y² = 20, its matrix [[5,3],[3,5]], and a 45° eigenvector rotation.
- What you can do after
- Apply PyTorch eigenvalue computation to rotate a symmetric quadratic form into diagonal, axis-aligned coordinates.
Read how Math and Architectures of Deep Learning explains diagonal matrix →
Also covered in
What to know first
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
Related concepts
- degree matrixincludes · A degree matrix is a diagonal graph matrix whose entries record the number or total weight of connections incident to each node.
- arraykind of · An array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- covariance matrixconfigured by · A covariance matrix is a square matrix whose diagonal entries are variances and whose off-diagonal entries are pairwise covariances among variables.
- Gaussian eliminationproduced by · Gaussian elimination is a procedure that applies elementary row operations to transform a linear system or matrix into an equivalent triangular or row-reduced form.
Questions about diagonal matrix
What is diagonal matrix?
A diagonal matrix is a square matrix whose entries outside the main diagonal are zero.
Which Manning books explain diagonal matrix?
Quantum Programming in Depth and Math and Architectures of Deep Learning.
What should I know before learning diagonal matrix?
Manning books that teach diagonal matrix usually introduce array and identity matrix first.
What is the difference between diagonal matrix and antidiagonal matrix?
A diagonal matrix is a square matrix whose entries outside the main diagonal are zero. An antidiagonal matrix is a matrix whose potentially nonzero entries lie on the diagonal running from the upper right to the lower left.
What kinds of diagonal matrix are there?
Kinds of diagonal matrix include degree matrix.
What is diagonal matrix a kind of?
Diagonal matrix is a kind of multiplexer. A multiplexer is a quantum conditional-operation pattern that applies different operations to target qubits according to the values of condition qubits.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

