# Frobenius inner product

In mathematics, the Frobenius inner product is a binary operation that takes two matrices and returns a scalar. It is often denoted ${\displaystyle \langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }}$. The operation is a component-wise inner product of two matrices as though they are vectors, and satisfies the axioms for an inner product. The two matrices must have the same dimension—same number of rows and columns—but are not restricted to be square matrices.

## Definition

Given two complex-number-valued n×m matrices A and B, written explicitly as

${\displaystyle \mathbf {A} ={\begin{pmatrix}A_{11}&A_{12}&\cdots &A_{1m}\\A_{21}&A_{22}&\cdots &A_{2m}\\\vdots &\vdots &\ddots &\vdots \\A_{n1}&A_{n2}&\cdots &A_{nm}\\\end{pmatrix}}\,,\quad \mathbf {B} ={\begin{pmatrix}B_{11}&B_{12}&\cdots &B_{1m}\\B_{21}&B_{22}&\cdots &B_{2m}\\\vdots &\vdots &\ddots &\vdots \\B_{n1}&B_{n2}&\cdots &B_{nm}\\\end{pmatrix}},}$

the Frobenius inner product is defined as

${\displaystyle \langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }=\sum _{i,j}{\overline {A_{ij}}}B_{ij}\,=\mathrm {Tr} \left({\overline {\mathbf {A} ^{T}}}\mathbf {B} \right)\equiv \mathrm {Tr} \left(\mathbf {A} ^{\!\dagger }\mathbf {B} \right),}$

where the overline denotes the complex conjugate, and ${\displaystyle \dagger }$ denotes the Hermitian conjugate.[1] Explicitly, this sum is

{\displaystyle {\begin{aligned}\langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }=&{\overline {A}}_{11}B_{11}+{\overline {A}}_{12}B_{12}+\cdots +{\overline {A}}_{1m}B_{1m}\\&+{\overline {A}}_{21}B_{21}+{\overline {A}}_{22}B_{22}+\cdots +{\overline {A}}_{2m}B_{2m}\\&\vdots \\&+{\overline {A}}_{n1}B_{n1}+{\overline {A}}_{n2}B_{n2}+\cdots +{\overline {A}}_{nm}B_{nm}\\\end{aligned}}}

The calculation is very similar to the dot product, which in turn is an example of an inner product.[citation needed]

### Relation to other products

If A and B are each real-valued matrices, then the Frobenius inner product is the sum of the entries of the Hadamard product. If the matrices are vectorized (i.e., converted into column vectors, denoted by "${\displaystyle \mathrm {vec} (\cdot )}$"), then

${\displaystyle \mathrm {vec} (\mathbf {A} )={\begin{pmatrix}A_{11}\\A_{12}\\\vdots \\A_{21}\\A_{22}\\\vdots \\A_{nm}\end{pmatrix}},\quad \mathrm {vec} (\mathbf {B} )={\begin{pmatrix}B_{11}\\B_{12}\\\vdots \\B_{21}\\B_{22}\\\vdots \\B_{nm}\end{pmatrix}}\,,}$${\displaystyle \quad {\overline {\mathrm {vec} (\mathbf {A} )}}^{T}\mathrm {vec} (\mathbf {B} )={\begin{pmatrix}{\overline {A}}_{11}&{\overline {A}}_{12}&\cdots &{\overline {A}}_{21}&{\overline {A}}_{22}&\cdots &{\overline {A}}_{nm}\end{pmatrix}}{\begin{pmatrix}B_{11}\\B_{12}\\\vdots \\B_{21}\\B_{22}\\\vdots \\B_{nm}\end{pmatrix}}}$

Therefore

${\displaystyle \langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }={\overline {\mathrm {vec} (\mathbf {A} )}}^{T}\mathrm {vec} (\mathbf {B} )\,.}$[citation needed]

### Properties

Like any inner product, it is a sesquilinear form, for four complex-valued matrices A, B, C, D, and two complex numbers a and b:

${\displaystyle \langle a\mathbf {A} ,b\mathbf {B} \rangle _{\mathrm {F} }={\overline {a}}b\langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }}$
${\displaystyle \langle \mathbf {A} +\mathbf {C} ,\mathbf {B} +\mathbf {D} \rangle _{\mathrm {F} }=\langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }+\langle \mathbf {A} ,\mathbf {D} \rangle _{\mathrm {F} }+\langle \mathbf {C} ,\mathbf {B} \rangle _{\mathrm {F} }+\langle \mathbf {C} ,\mathbf {D} \rangle _{\mathrm {F} }}$

Also, exchanging the matrices amounts to complex conjugation:

${\displaystyle \langle \mathbf {B} ,\mathbf {A} \rangle _{\mathrm {F} }={\overline {\langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }}}}$

For the same matrix,

${\displaystyle \langle \mathbf {A} ,\mathbf {A} \rangle _{\mathrm {F} }\geq 0}$,[citation needed]

and,

${\displaystyle \langle \mathbf {A} ,\mathbf {A} \rangle _{\mathrm {F} }=0\Longleftrightarrow \mathbf {A} =\mathbf {0} }$.

### Frobenius norm

The inner product induces the Frobenius norm

${\displaystyle \|\mathbf {A} \|_{\mathrm {F} }={\sqrt {\langle \mathbf {A} ,\mathbf {A} \rangle _{\mathrm {F} }}}\,.}$[1]

## Examples

### Real-valued matrices

For two real-valued matrices, if

${\displaystyle \mathbf {A} ={\begin{pmatrix}2&0&6\\1&-1&2\end{pmatrix}}\,,\quad \mathbf {B} ={\begin{pmatrix}8&-3&2\\4&1&-5\end{pmatrix}},}$

then

{\displaystyle {\begin{aligned}\langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }&=2\cdot 8+0\cdot (-3)+6\cdot 2+1\cdot 4+(-1)\cdot 1+2\cdot (-5)\\&=21.\end{aligned}}}

### Complex-valued matrices

For two complex-valued matrices, if

${\displaystyle \mathbf {A} ={\begin{pmatrix}1+i&-2i\\3&-5\end{pmatrix}}\,,\quad \mathbf {B} ={\begin{pmatrix}-2&3i\\4-3i&6\end{pmatrix}},}$

then

{\displaystyle {\begin{aligned}\langle \mathbf {A} ,\mathbf {B} \rangle _{\mathrm {F} }&=(1-i)\cdot (-2)+2i\cdot 3i+3\cdot (4-3i)+(-5)\cdot 6\\&=-26-7i,\end{aligned}}}

while

{\displaystyle {\begin{aligned}\langle \mathbf {B} ,\mathbf {A} \rangle _{\mathrm {F} }&=(-2)\cdot (1+i)+(-3i)\cdot (-2i)+(4+3i)\cdot 3+6\cdot (-5)\\&=-26+7i.\end{aligned}}}

The Frobenius inner products of A with itself, and B with itself, are respectively

${\displaystyle \langle \mathbf {A} ,\mathbf {A} \rangle _{\mathrm {F} }=2+4+9+25=40}$${\displaystyle \qquad \langle \mathbf {B} ,\mathbf {B} \rangle _{\mathrm {F} }=4+9+25+36=74.}$