Skip to content
Glacius
Linear algebraConcept reference

Frobenius Inner Products

The Frobenius inner product multiplies matching entries of equal-shaped matrices and sums the products into one scalar.

On this page 7 sections
  1. Overview
  2. Combine matrix contributions into one number
  3. Include every position
  4. A matrix-shaped weighted sum
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01Combine matrix contributions into one number#

The Frobenius inner product multiplies matching entries of equal-shaped matrices and sums the products into one scalar. It is the matrix counterpart of a vector dot product.

A,BF=i,jAijBij\begin{gathered}\langle A,B\rangle_F\\=\sum_{i,j} A_{ij}B_{ij}\end{gathered}

The Hadamard product gives the array of individual products. Summing that array produces the inner product. Stopping before the sum returns the wrong kind of object.

02Include every position#

Let AA have rows (1,2),(0,3)(1,-2),(0,3) and BB have rows (4,1),(5,1)(4,1),(5,-1). The entrywise products are 4,2,0,34,-2,0,-3. Their sum is 1-1.

Only summing the diagonal products would give 43=14-3=1 and miss the off-diagonal contribution of 2-2. Every position belongs in the sum, including positions outside the diagonal of a rectangular matrix.

Check your reasoning

A has rows (1,2),(0,−1); B has rows (3,−1),(4,2). Find their Frobenius inner product.

  1. A−1
  2. B1
  3. C(3,−2),(0,−2)
Show answer and explanation
−1

The products sum to 3−2+0−2=−1.

03A matrix-shaped weighted sum#

If AA contains sensitivities and BB contains small changes at matching positions, the inner product combines their signed contributions. For now, treat those matrices as supplied data; the calculus behind that interpretation has its own lesson.

You could list both matrices' entries in the same fixed order and take a vector dot product. The result would be identical. Mixing different entry orders changes the pairings and can change the scalar.

Check your reasoning

Only B₁₂ increases by 3, and A₁₂=−2. How does their inner product change?

  1. A6
  2. B−6
  3. C−2
Show answer and explanation
−6

Only one contribution changes, by −2 times 3.

The inputs must have equal shapes. A negative inner product is valid: positive and negative contributions can outweigh one another. It is not a norm or an entrywise matrix output.

Key takeaway

Compute the Frobenius inner product of equal-shaped real matrices by summing products of corresponding entries.

  • Compute the Frobenius inner product of equal-shaped real matrices by summing products of corresponding entries.

Sources & further reading

  1. [1]
  2. [2]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Frobenius Inner Products.” Math behind ML. /learn/la-frobenius-inner