> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/math/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/math/linear/matrix/op/mult.md).

# 矩陣乘法

[線代](/math/linear.md) ⟩ [矩陣](/math/linear/matrix.md) ⟩ [運算](/math/linear/matrix/op.md) ⟩ 矩陣乘法

## 🔰 定義 <a href="#def" id="def"></a>

{% hint style="success" %}
當Ａ為 $$m\times p$$ 矩陣、Ｂ為 $$p\times n$$ 矩陣時，我們定義<mark style="color:yellow;">**兩個矩陣相乘**</mark>的結果為一個 $$m\times n$$ 矩陣：

* $$AB= \begin{bmatrix} a\_{11} & a\_{12} & \cdots & a\_{1p} \ a\_{21} & a\_{22} & \cdots & a\_{2p} \ \vdots & \vdots &        & \vdots \ a\_{m1} & a\_{m2} & \cdots & a\_{mp} \end{bmatrix} ; \begin{bmatrix} b\_{11} & b\_{12} & \cdots & b\_{1n} \ b\_{21} & b\_{22} & \cdots & b\_{2n} \ \vdots & \vdots &        & \vdots \ b\_{p1} & b\_{p2} & \cdots & b\_{pn} \end{bmatrix} = \begin{bmatrix} c\_{11} & c\_{12} & \cdots & c\_{1n} \ c\_{21} & c\_{22} & \cdots & c\_{2n} \ \vdots & \vdots &        & \vdots \ c\_{m1} & c\_{m2} & \cdots & c\_{mn} \end{bmatrix}$$&#x20;

其中：

* &#x20;$$c\_{ij}=(\mathbf{AB})*{{\color{blue}{i}}{\color{red}{j}}}   = a*{i1}b\_{1j} + a\_{i2}b\_{2j} + \cdots + a\_{ip}b\_{pj}$$
* $$c\_{ij}= \mathbf{A}*{{\color{blue}{i}}\*}\mathbf{B}*{\*\color{red}{j}}$$ （ :star: 相當於「$$\mathbf{A}$$ 第 $$i$$ <mark style="color:yellow;">列</mark>」與「$$\mathbf{B}$$ 第 $$j$$ <mark style="color:yellow;">行</mark>」做[內積](/math/linear/vec/op/dot.md):exclamation:）
  {% endhint %}

<figure><img src="/files/P2HSYQnXvbJvUFPBl3NL" alt=""><figcaption><p>矩陣乘法定義</p></figcaption></figure>

{% tabs %}
{% tab title="🔴 主題" %}

* [「分割式」乘法](/math/linear/matrix/op/mult/split-table.md)
* [「表格疊加」法](/math/linear/matrix/op/mult/outer-product/sum-of-outer-products.md)
* [「分組式」乘法](/math/linear/matrix/op/mult/by-groups.md)
* [「塊狀」乘法](/math/linear/matrix/op/mult/by-blocks.md)
* [反矩陣](/math/linear/matrix/op/mult/inverse.md)
  {% endtab %}

{% tab title="🗺️ 圖表" %} <img src="/files/ro4IMX06Hp0UYawQhUEz" alt="矩陣乘法概念圖" class="gitbook-drawing">
{% endtab %}

{% tab title="🧨 雷區" %}
{% hint style="danger" %}
$$\mathbf{A}$$ 的<mark style="color:yellow;">**行數**</mark>與 $$\mathbf{B}$$ 的<mark style="color:yellow;">**列數**</mark><mark style="color:red;">**必須一樣**</mark>，才能做<mark style="color:purple;">**矩陣乘法**</mark>:exclamation:
{% endhint %}
{% endtab %}

{% tab title="👥 相關" %}

* 向量 ⟩ [內積](/math/linear/vec/op/dot.md)&#x20;
* Desmos ⟩ [矩陣](/math/tool/desmos/expr/matrix.md)
* GGB ⟩ [矩陣](/math/tool/ggb/matrix.md) &#x20;
  {% endtab %}

{% tab title="🛠 工具" %}

* [Desmos Calculator](https://www.desmos.com/matrix?lang=zh-TW)
  {% endtab %}

{% tab title="📗 參考" %}

* [ ] Mathematics for 3D Game Programming & Computer Graphics (2nd Edition, 2004) &#x20;
  {% endtab %}
  {% endtabs %}

## 🔸 矩陣乘法性質引理 <a href="#lemma" id="lemma"></a>

1. [外積](/math/linear/matrix/op/mult/outer-product.md)
2. [(uv)^T = v^T u^T](/math/linear/matrix/op/mult/outer-product/outer-product.md)
3. [矩陣乘積為外積之和](/math/linear/matrix/op/mult/outer-product/sum-of-outer-products.md)

## 🔸 性質 <a href="#prop" id="prop"></a>

<table><thead><tr><th width="100" data-type="number">#</th><th width="437">🔸 性質</th><th width="100">🎖 證明</th></tr></thead><tbody><tr><td>1</td><td><mark style="color:red;"><strong>類結合律</strong></mark>：<span class="math">{\color{orange}k} (\mathbf{AB}) =  ({\color{orange}k}\mathbf{A)B} =  \mathbf{A} ({\color{orange}k}\mathbf{B})</span></td><td><img src="/files/9pIHGpzaFOoruzXAQAHm" alt="" data-size="line"></td></tr><tr><td>2</td><td><mark style="color:yellow;"><strong>結合律</strong></mark>： <span class="math">\mathbf{(AB)C} = \mathbf{A(BC)}</span></td><td></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lochiwei.gitbook.io/math/linear/matrix/op/mult.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
