> [!summary]
The diagonal matrix is a special matrix where any entries off the diagonal are zero.
>
**Key Equation:**
>
Diagonal Format:
$D = \text{diag}(d_{1},d_{2},d_{3}\dots, d_{n})$
>[!info]+ Read Time
**⏱ 1 min**
# Definition
A diagonal matrix is a [[Square Matrix|square matrix]] in which all the **entries off the main diagonal are zero**. In general, this diagonal matrix ($D$) is as follows, where $d_{n}$ can be any scalar number or zero.
$
D =
\begin{bmatrix}
d_1 & 0 & 0 & \cdots & 0 \\
0 & d_2 & 0 & \cdots & 0 \\
0 & 0 & d_3 & \cdots & 0 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
0 & 0 & 0 & \cdots & d_n
\end{bmatrix}
$
Sometimes its easier to state the values on the diagonal as $D = \text{diag}(d_{1},d_{2},d_{3}\dots, d_{n})$
# Examples
> [!example] Matrix formed for $\text{diag}(4,-2,7)$
> $
\begin{bmatrix}
4 & 0 & 0 \\
0 & -2 & 0 \\
0 & 0 & 7
\end{bmatrix}
> $
> [!example] What is the diagonal values for the given matrix
> $
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 5 & 0 & 0 \\
0 & 0 & 3 & 0 \\
0 & 0 & 0 & 9
\end{bmatrix}
> $
From looking at the matrix, the diagonal values are $\text{diag}(1,5,3,9)$
# Resources
<iframe width="560" height="315" src="https://www.youtube.com/embed/N5kRmvFXhGQ?si=gDlFzZ7eMZ2hH1Nn" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>