<s>
In	O
linear	B-Language
algebra	I-Language
,	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
a	O
matrix	B-Architecture
in	O
which	O
the	O
entries	O
outside	O
the	O
main	B-Algorithm
diagonal	I-Algorithm
are	O
all	O
zero	O
;	O
the	O
term	O
usually	O
refers	O
to	O
square	B-Algorithm
matrices	I-Algorithm
.	O
</s>
<s>
Elements	O
of	O
the	O
main	B-Algorithm
diagonal	I-Algorithm
can	O
either	O
be	O
zero	O
or	O
nonzero	O
.	O
</s>
<s>
An	O
example	O
of	O
a	O
2×2	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
,	O
while	O
an	O
example	O
of	O
a	O
3×3	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
.	O
</s>
<s>
An	O
identity	B-Algorithm
matrix	I-Algorithm
of	O
any	O
size	O
,	O
or	O
any	O
multiple	O
of	O
it	O
(	O
a	O
scalar	O
matrix	B-Architecture
)	O
,	O
is	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
A	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
sometimes	O
called	O
a	O
scaling	B-Algorithm
matrix	I-Algorithm
,	O
since	O
matrix	B-Architecture
multiplication	O
with	O
it	O
results	O
in	O
changing	O
scale	O
(	O
size	O
)	O
.	O
</s>
<s>
As	O
stated	O
above	O
,	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
a	O
matrix	B-Architecture
in	O
which	O
all	O
off-diagonal	O
entries	O
are	O
zero	O
.	O
</s>
<s>
However	O
,	O
the	O
main	B-Algorithm
diagonal	I-Algorithm
entries	O
are	O
unrestricted	O
.	O
</s>
<s>
The	O
term	O
diagonal	B-Algorithm
matrix	I-Algorithm
may	O
sometimes	O
refer	O
to	O
a	O
,	O
which	O
is	O
an	O
m-by-n	O
matrix	B-Architecture
with	O
all	O
the	O
entries	O
not	O
of	O
the	O
form	O
di	O
,	O
i	O
being	O
zero	O
.	O
</s>
<s>
More	O
often	O
,	O
however	O
,	O
diagonal	B-Algorithm
matrix	I-Algorithm
refers	O
to	O
square	B-Algorithm
matrices	I-Algorithm
,	O
which	O
can	O
be	O
specified	O
explicitly	O
as	O
a	O
.	O
</s>
<s>
A	O
square	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
a	O
symmetric	B-Algorithm
matrix	I-Algorithm
,	O
so	O
this	O
can	O
also	O
be	O
called	O
a	O
.	O
</s>
<s>
The	O
following	O
matrix	B-Architecture
is	O
square	O
diagonal	B-Algorithm
matrix	I-Algorithm
:	O
</s>
<s>
If	O
the	O
entries	O
are	O
real	O
numbers	O
or	O
complex	O
numbers	O
,	O
then	O
it	O
is	O
a	O
normal	B-Algorithm
matrix	I-Algorithm
as	O
well	O
.	O
</s>
<s>
In	O
the	O
remainder	O
of	O
this	O
article	O
we	O
will	O
consider	O
only	O
square	O
diagonal	B-Algorithm
matrices	I-Algorithm
,	O
and	O
refer	O
to	O
them	O
simply	O
as	O
"	O
diagonal	B-Algorithm
matrices	I-Algorithm
"	O
.	O
</s>
<s>
A	O
diagonal	B-Algorithm
matrix	I-Algorithm
can	O
be	O
constructed	O
from	O
a	O
vector	O
using	O
the	O
operator	O
:	O
</s>
<s>
The	O
same	O
operator	O
is	O
also	O
used	O
to	O
represent	O
block	O
diagonal	B-Algorithm
matrices	I-Algorithm
as	O
where	O
each	O
argument	O
is	O
a	O
matrix	B-Architecture
.	O
</s>
<s>
The	O
inverse	O
matrix-to-vector	O
operator	O
is	O
sometimes	O
denoted	O
by	O
the	O
identically	O
named	O
where	O
the	O
argument	O
is	O
now	O
a	O
matrix	B-Architecture
and	O
the	O
result	O
is	O
a	O
vector	O
of	O
its	O
diagonal	O
entries	O
.	O
</s>
<s>
A	O
diagonal	B-Algorithm
matrix	I-Algorithm
with	O
equal	O
diagonal	O
entries	O
is	O
a	O
scalar	O
matrix	B-Architecture
;	O
that	O
is	O
,	O
a	O
scalar	O
multiple	O
λ	O
of	O
the	O
identity	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
For	O
example	O
,	O
a	O
3×3	O
scalar	O
matrix	B-Architecture
has	O
the	O
form	O
:	O
</s>
<s>
The	O
scalar	O
matrices	O
are	O
the	O
center	O
of	O
the	O
algebra	O
of	O
matrices	O
:	O
that	O
is	O
,	O
they	O
are	O
precisely	O
the	O
matrices	O
that	O
commute	O
with	O
all	O
other	O
square	B-Algorithm
matrices	I-Algorithm
of	O
the	O
same	O
size	O
.	O
</s>
<s>
By	O
contrast	O
,	O
over	O
a	O
field	O
(	O
like	O
the	O
real	O
numbers	O
)	O
,	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
with	O
all	O
diagonal	O
elements	O
distinct	O
only	O
commutes	O
with	O
diagonal	B-Algorithm
matrices	I-Algorithm
(	O
its	O
centralizer	O
is	O
the	O
set	O
of	O
diagonal	B-Algorithm
matrices	I-Algorithm
)	O
.	O
</s>
<s>
That	O
is	O
because	O
if	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
has	O
then	O
given	O
a	O
matrix	B-Architecture
with	O
the	O
term	O
of	O
the	O
products	O
are	O
:	O
and	O
and	O
(	O
since	O
one	O
can	O
divide	O
by	O
)	O
,	O
so	O
they	O
do	O
not	O
commute	O
unless	O
the	O
off-diagonal	O
terms	O
are	O
zero	O
.	O
</s>
<s>
Diagonal	B-Algorithm
matrices	I-Algorithm
where	O
the	O
diagonal	O
entries	O
are	O
not	O
all	O
equal	O
or	O
all	O
distinct	O
have	O
centralizers	O
intermediate	O
between	O
the	O
whole	O
space	O
and	O
only	O
diagonal	B-Algorithm
matrices	I-Algorithm
.	O
</s>
<s>
This	O
is	O
true	O
more	O
generally	O
for	O
a	O
module	O
M	O
over	O
a	O
ring	O
R	O
,	O
with	O
the	O
endomorphism	O
algebra	O
End(M )	O
(	O
algebra	O
of	O
linear	B-Architecture
operators	I-Architecture
on	O
M	O
)	O
replacing	O
the	O
algebra	O
of	O
matrices	O
.	O
</s>
<s>
Formally	O
,	O
scalar	O
multiplication	O
is	O
a	O
linear	B-Architecture
map	I-Architecture
,	O
inducing	O
a	O
map	O
(	O
from	O
a	O
scalar	O
λ	O
to	O
its	O
corresponding	O
scalar	O
transformation	O
,	O
multiplication	O
by	O
λ	O
)	O
exhibiting	O
End(M )	O
as	O
a	O
R-algebra	O
.	O
</s>
<s>
The	O
former	O
is	O
more	O
generally	O
true	O
free	O
modules	O
,	O
for	O
which	O
the	O
endomorphism	O
algebra	O
is	O
isomorphic	O
to	O
a	O
matrix	B-Architecture
algebra	O
.	O
</s>
<s>
Multiplying	O
a	O
vector	O
by	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
multiplies	O
each	O
of	O
the	O
terms	O
by	O
the	O
corresponding	O
diagonal	O
entry	O
.	O
</s>
<s>
Given	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
and	O
a	O
vector	O
,	O
the	O
product	O
is	O
:	O
</s>
<s>
This	O
can	O
be	O
expressed	O
more	O
compactly	O
by	O
using	O
a	O
vector	O
instead	O
of	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
,	O
,	O
and	O
taking	O
the	O
Hadamard	O
product	O
of	O
the	O
vectors	O
(	O
entrywise	O
product	O
)	O
,	O
denoted	O
:	O
</s>
<s>
This	O
is	O
mathematically	O
equivalent	O
,	O
but	O
avoids	O
storing	O
all	O
the	O
zero	O
terms	O
of	O
this	O
sparse	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
This	O
product	O
is	O
thus	O
used	O
in	O
machine	O
learning	O
,	O
such	O
as	O
computing	O
products	O
of	O
derivatives	O
in	O
backpropagation	B-Algorithm
or	O
multiplying	O
IDF	O
weights	O
in	O
TF-IDF	O
,	O
since	O
some	O
BLAS	B-Application
frameworks	O
,	O
which	O
multiply	O
matrices	O
efficiently	O
,	O
do	O
not	O
include	O
Hadamard	O
product	O
capability	O
directly	O
.	O
</s>
<s>
The	O
operations	O
of	O
matrix	B-Architecture
addition	O
and	O
matrix	B-Architecture
multiplication	O
are	O
especially	O
simple	O
for	O
diagonal	B-Algorithm
matrices	I-Algorithm
.	O
</s>
<s>
Write	O
for	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
whose	O
diagonal	O
entries	O
starting	O
in	O
the	O
upper	O
left	O
corner	O
are	O
a1	O
,	O
...	O
,	O
an	O
.	O
</s>
<s>
and	O
for	O
matrix	B-Architecture
multiplication	O
,	O
</s>
<s>
The	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
invertible	O
if	O
and	O
only	O
if	O
the	O
entries	O
a1	O
,	O
...	O
,	O
an	O
are	O
all	O
nonzero	O
.	O
</s>
<s>
In	O
particular	O
,	O
the	O
diagonal	B-Algorithm
matrices	I-Algorithm
form	O
a	O
subring	O
of	O
the	O
ring	O
of	O
all	O
n-by-n	O
matrices	O
.	O
</s>
<s>
Multiplying	O
an	O
n-by-n	O
matrix	B-Architecture
from	O
the	O
left	O
with	O
amounts	O
to	O
multiplying	O
the	O
-th	O
row	O
of	O
by	O
for	O
all	O
;	O
multiplying	O
the	O
matrix	B-Architecture
from	O
the	O
right	O
with	O
amounts	O
to	O
multiplying	O
the	O
-th	O
column	O
of	O
by	O
for	O
all	O
.	O
</s>
<s>
As	O
explained	O
in	O
determining	O
coefficients	O
of	O
operator	O
matrix	B-Architecture
,	O
there	O
is	O
a	O
special	O
basis	O
,	O
,	O
for	O
which	O
the	O
matrix	B-Architecture
takes	O
the	O
diagonal	O
form	O
.	O
</s>
<s>
The	O
adjugate	O
of	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
again	O
diagonal	O
.	O
</s>
<s>
A	O
matrix	B-Architecture
is	O
diagonal	O
if	O
and	O
only	O
if	O
it	O
is	O
triangular	O
and	O
normal	B-Algorithm
.	O
</s>
<s>
A	O
matrix	B-Architecture
is	O
diagonal	O
if	O
and	O
only	O
if	O
it	O
is	O
both	O
upper	B-Algorithm
-	I-Algorithm
and	O
lower-triangular	B-Algorithm
.	O
</s>
<s>
A	O
diagonal	B-Algorithm
matrix	I-Algorithm
is	O
symmetric	B-Algorithm
.	O
</s>
<s>
The	O
identity	B-Algorithm
matrix	I-Algorithm
In	O
and	O
zero	B-Algorithm
matrix	I-Algorithm
are	O
diagonal	O
.	O
</s>
<s>
A	O
1×1	O
matrix	B-Architecture
is	O
always	O
diagonal	O
.	O
</s>
<s>
Diagonal	B-Algorithm
matrices	I-Algorithm
occur	O
in	O
many	O
areas	O
of	O
linear	B-Language
algebra	I-Language
.	O
</s>
<s>
Because	O
of	O
the	O
simple	O
description	O
of	O
the	O
matrix	B-Architecture
operation	O
and	O
eigenvalues/eigenvectors	O
given	O
above	O
,	O
it	O
is	O
typically	O
desirable	O
to	O
represent	O
a	O
given	O
matrix	B-Architecture
or	O
linear	B-Architecture
map	I-Architecture
by	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
In	O
fact	O
,	O
a	O
given	O
n-by-n	O
matrix	B-Architecture
is	O
similar	B-Algorithm
to	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
(	O
meaning	O
that	O
there	O
is	O
a	O
matrix	B-Architecture
such	O
that	O
is	O
diagonal	O
)	O
if	O
and	O
only	O
if	O
it	O
has	O
linearly	O
independent	O
eigenvectors	O
.	O
</s>
<s>
Such	O
matrices	O
are	O
said	O
to	O
be	O
diagonalizable	B-Algorithm
.	O
</s>
<s>
The	O
spectral	O
theorem	O
says	O
that	O
every	O
normal	B-Algorithm
matrix	I-Algorithm
is	O
unitarily	B-Algorithm
similar	I-Algorithm
to	O
a	O
diagonal	B-Algorithm
matrix	I-Algorithm
(	O
if	O
then	O
there	O
exists	O
a	O
unitary	B-Algorithm
matrix	I-Algorithm
such	O
that	O
is	O
diagonal	O
)	O
.	O
</s>
<s>
Furthermore	O
,	O
the	O
singular	O
value	O
decomposition	O
implies	O
that	O
for	O
any	O
matrix	B-Architecture
,	O
there	O
exist	O
unitary	B-Algorithm
matrices	I-Algorithm
and	O
such	O
that	O
is	O
diagonal	O
with	O
positive	O
entries	O
.	O
</s>
<s>
Therefore	O
,	O
a	O
key	O
technique	O
to	O
understanding	O
operators	O
is	O
a	O
change	O
of	O
coordinates	O
—	O
in	O
the	O
language	O
of	O
operators	O
,	O
an	O
integral	B-Algorithm
transform	I-Algorithm
—	O
which	O
changes	O
the	O
basis	O
to	O
an	O
eigenbasis	O
of	O
eigenfunctions	B-Algorithm
:	O
which	O
makes	O
the	O
equation	O
separable	O
.	O
</s>
<s>
An	O
important	O
example	O
of	O
this	O
is	O
the	O
Fourier	B-Algorithm
transform	I-Algorithm
,	O
which	O
diagonalizes	O
constant	O
coefficient	O
differentiation	O
operators	O
(	O
or	O
more	O
generally	O
translation	O
invariant	O
operators	O
)	O
,	O
such	O
as	O
the	O
Laplacian	O
operator	O
,	O
say	O
,	O
in	O
the	O
heat	O
equation	O
.	O
</s>
<s>
Especially	O
easy	O
are	O
multiplication	B-Algorithm
operators	I-Algorithm
,	O
which	O
are	O
defined	O
as	O
multiplication	O
by	O
(	O
the	O
values	O
of	O
)	O
a	O
fixed	O
function	O
–	O
the	O
values	O
of	O
the	O
function	O
at	O
each	O
point	O
correspond	O
to	O
the	O
diagonal	O
entries	O
of	O
a	O
matrix	B-Architecture
.	O
</s>
