矩阵运算的结合律

· · 个人记录

设有两种运算(甚至可以不是数的运算) \oplus,\otimes, 满足

(p \oplus q) \otimes r & = (p \otimes r) \oplus (q \otimes r)\\ p \oplus q &= q \oplus p\\ (p \otimes q) \otimes r &= p \otimes (q \otimes r) \end{aligned}

用这两种运算定义矩阵的运算

A \odot B = C &\Leftrightarrow C[i,j] = \bigoplus\limits_{k} (A[i,k] \otimes B[k,j])\\ \end{aligned}

则

(A \odot B) \odot C &= A \odot (B \odot C)\\ \end{aligned}

成立。

证明:

(A \odot B) \odot C &= \bigoplus\limits_k((A \odot B)[i,k] \otimes C[k,j])\\ &= \bigoplus\limits_k(\bigoplus\limits_{r} (A[i,r] \otimes B[r,k]) \otimes C[k,j])\\ &= \bigoplus\limits_k\bigoplus\limits_{r} (A[i,r] \otimes B[r,k] \otimes C[k,j])\\ &= \bigoplus\limits_r\bigoplus\limits_{k} (A[i,r] \otimes B[r,k] \otimes C[k,j])\\ &= \bigoplus\limits_r(A[i,r] \otimes(\bigoplus\limits_{k} (B[r,k] \otimes C[k,j])))\\ &= \bigoplus\limits_r(A[i,r] \otimes (B \odot C)[r,j])\\ &= A \odot (B \odot C)\\ \end{aligned}

既然两种运算只要满足上述条件,其矩阵就有结合律,

所以矩阵套矩阵的乘法甚至也有结合律。现在,你可以证明 Binet-Cauchy 定理了(逃

练习:证明矩阵树定理(大雾

应用:

令 a \oplus b = \min(a, b),a \otimes b = a + b,则对应矩阵运算具有结合律。这可以用于一些神秘问题,比如走 k 步的最短路。详见 OI-wiki。