> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/ja/shu-xue/04-matrices.md).

# 行列

## amsmath の行列環境

この `amsmath` パッケージは、異なる区切り記号を使って行列を組版するためのコマンドを提供します。いったん読み込めば `\usepackage{amsmath}` プリアンブルで読み込んでおけば、数式環境で以下の環境を使えます：

| 種類                   | LaTeX マークアップ                                          | 次のようにレンダリングされます                                     |
| -------------------- | ----------------------------------------------------- | --------------------------------------------------- |
| 通常                   | `\begin{matrix} 1 & 2 & 3\\ a & b & c \end{matrix}`   | $$\begin{matrix}1 & 2 & 3\a & b & c\end{matrix}$$   |
| <p>丸括弧；<br>丸かっこ</p>  | `\begin{pmatrix} 1 & 2 & 3\\ a & b & c \end{pmatrix}` | $$\begin{pmatrix}1 & 2 & 3\a & b & c\end{pmatrix}$$ |
| <p>角括弧；<br>四角かっこ</p> | `\begin{bmatrix} 1 & 2 & 3\\ a & b & c \end{bmatrix}` | $$\begin{bmatrix}1 & 2 & 3\a & b & c\end{bmatrix}$$ |
| <p>波括弧；<br>中かっこ</p>  | `\begin{Bmatrix} 1 & 2 & 3\\ a & b & c \end{Bmatrix}` | $$\begin{Bmatrix}1 & 2 & 3\a & b & c\end{Bmatrix}$$ |
| 縦棒                   | `\begin{vmatrix} 1 & 2 & 3\\ a & b & c \end{vmatrix}` | $$\begin{vmatrix}1 & 2 & 3\a & b & c\end{vmatrix}$$ |
| 二重縦棒                 | `\begin{Vmatrix} 1 & 2 & 3\\ a & b & c \end{Vmatrix}` | $$\begin{Vmatrix}1 & 2 & 3\a & b & c\end{Vmatrix}$$ |

異なる [区切り記号を](/latex/ja/shu-xue/03-brackets-and-parentheses.md)区切り記号を使った行列を作成する必要がある場合は、通常の `行列`。たとえば:

| LaTeX マークアップ                                                                   | 次のようにレンダリングされます                                                            |
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| `\left\lceil \begin{matrix} 1 & 2 & 3\\ a & b & c \end{matrix} \right\rceil`   | $$\left\lceil\begin{matrix}1 & 2 & 3\a & b & c\end{matrix}\right\rceil$$   |
| `\left\langle \begin{matrix} 1 & 2 & 3\\ a & b & c \end{matrix} \right\rvert`  | $$\left\langle\begin{matrix}1 & 2 & 3\a & b & c\end{matrix}\right\rvert$$  |
| `\left\langle \begin{matrix} 1 & 2 & 3\\ a & b & c \end{matrix} \right\rangle` | $$\left\langle\begin{matrix}1 & 2 & 3\a & b & c\end{matrix}\right\rangle$$ |

## インライン行列

インライン数式を組版する場合、通常の `行列` 上記の環境は大きすぎるように見えることがあります。代わりに `smallmatrix` このような場合にはこちらを使うとよいでしょう。ただし、自分で [区切り記号を](/latex/ja/shu-xue/03-brackets-and-parentheses.md).

```latex
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent ここでインライン行列を組版してみます：
 $\begin{pmatrix}
  a & b\\
  c & d
\end{pmatrix}$,
しかし大きすぎるので、代わりに
$\big(\begin{smallmatrix}
  a & b\\
  c & d
\end{smallmatrix}\big)$
を代わりに使います。
\end{document}
```

[この `smallmatrix` Overleaf 上の例を開く](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=amsmath+matrix+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cnoindent+Trying+to+typeset+an+inline+matrix+here%3A%0A+%24%5Cbegin%7Bpmatrix%7D%0A++a+%26+b%5C%5C+%0A++c+%26+d%0A%5Cend%7Bpmatrix%7D%24%2C++%0Abut+it+looks+too+big%2C+so+let%27s+try+%0A%24%5Cbig%28%5Cbegin%7Bsmallmatrix%7D%0A++a+%26+b%5C%5C%0A++c+%26+d%0A%5Cend%7Bsmallmatrix%7D%5Cbig%29%24+%0Ainstead.%0A%5Cend%7Bdocument%7D)

次の画像は、上の例によって生成された出力を示しています：

![Amsmatrix.png](/files/95e3f5fe8795bf5796fa7305bfd4aef5c3bc1fdf)

この `mathtools` パッケージは `psmallmatrix`, `bsmallmatrix` などの環境を便宜上提供しています。

## さらに読む

* [数式](/latex/ja/shu-xue/01-mathematical-expressions.md)
* [角括弧と丸括弧](/latex/ja/shu-xue/03-brackets-and-parentheses.md)
* [amsmath を使った方程式の整列](/latex/ja/shu-xue/06-aligning-equations-with-amsmath.md)
* [数式モードでの表示スタイル](/latex/ja/shu-xue/10-display-style-in-math-mode.md)
* [LaTeX2εへのそれほど短くない入門](http://www.ctan.org/tex-archive/info/lshort/)
* [amsmath パッケージのドキュメント](http://texdoc.net/pkg/amsmath)
* [mathtools パッケージのドキュメント](http://texdoc.net/pkg/mathtools)


---

# 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, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/ja/shu-xue/04-matrices.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
