> 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/no/matematikk/04-matrices.md).

# Matriser

## amsmath-omgivelser for matriser

Den `amsmath` pakken gir kommandoer for å sette matriser med ulike skilletegn. Når du har lastet inn `\usepackage{amsmath}` i preamblen kan du bruke følgende omgivelser i matematikkomgivelsene dine:

| Type                                   | LaTeX-markering                                       | Gjengis som                                         |
| -------------------------------------- | ----------------------------------------------------- | --------------------------------------------------- |
| Vanlig                                 | `\begin{matrix} 1 & 2 & 3\\ a & b & c \end{matrix}`   | $$\begin{matrix}1 & 2 & 3\a & b & c\end{matrix}$$   |
| <p>Parenteser;<br>runde parenteser</p> | `\begin{pmatrix} 1 & 2 & 3\\ a & b & c \end{pmatrix}` | $$\begin{pmatrix}1 & 2 & 3\a & b & c\end{pmatrix}$$ |
| <p>Klammer;<br>hakeparenteser</p>      | `\begin{bmatrix} 1 & 2 & 3\\ a & b & c \end{bmatrix}` | $$\begin{bmatrix}1 & 2 & 3\a & b & c\end{bmatrix}$$ |
| <p>Klammer;<br>krøllparenteser</p>     | `\begin{Bmatrix} 1 & 2 & 3\\ a & b & c \end{Bmatrix}` | $$\begin{Bmatrix}1 & 2 & 3\a & b & c\end{Bmatrix}$$ |
| Loddrette streker                      | `\begin{vmatrix} 1 & 2 & 3\\ a & b & c \end{vmatrix}` | $$\begin{vmatrix}1 & 2 & 3\a & b & c\end{vmatrix}$$ |
| Doble loddrette streker                | `\begin{Vmatrix} 1 & 2 & 3\\ a & b & c \end{Vmatrix}` | $$\begin{Vmatrix}1 & 2 & 3\a & b & c\end{Vmatrix}$$ |

Hvis du trenger å lage matriser med ulike [avgrensere](/latex/no/matematikk/03-brackets-and-parentheses.md), kan du legge dem til manuelt i en vanlig `matrix`. For eksempel:

| LaTeX-markering                                                                | Gjengis som                                                                |
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| `\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$$ |

## Matriser på linje

Når du setter matematikk på linje, kan de vanlige `matrix` omgivelsene ovenfor se for store ut. Det kan være bedre å bruke `smallmatrix` i slike situasjoner, selv om du må legge til din egen [avgrensere](/latex/no/matematikk/03-brackets-and-parentheses.md).

```latex
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent Prøver å sette en matrise på linje her:
 $\begin{pmatrix}
  a & b\\
  c & d
\end{pmatrix}$,
men den ser for stor ut, så la oss prøve
$\big(\begin{smallmatrix}
  a & b\\
  c & d
\end{smallmatrix}\big)$
i stedet.
\end{document}
```

[Åpne dette `smallmatrix` eksemplet i 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)

Følgende bilde viser resultatet som ble produsert av eksemplet ovenfor:

![Amsmatrix.png](/files/1fa8f9ed6ba42d2b5278b7731c5383a24aaa6f1c)

Den `mathtools` pakken tilbyr `psmallmatrix`, `bsmallmatrix` osv.-omgivelser for enkelhets skyld.

## Videre lesning

* [Matematiske uttrykk](/latex/no/matematikk/01-mathematical-expressions.md)
* [Klammer og parenteser](/latex/no/matematikk/03-brackets-and-parentheses.md)
* [Justere ligninger med amsmath](/latex/no/matematikk/06-aligning-equations-with-amsmath.md)
* [Visningsstil i matemodus](/latex/no/matematikk/10-display-style-in-math-mode.md)
* [Den ikke helt korte introduksjonen til LaTeX2ε](http://www.ctan.org/tex-archive/info/lshort/)
* [dokumentasjon for amsmath-pakken](http://texdoc.net/pkg/amsmath)
* [dokumentasjon for mathtools-pakken](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/no/matematikk/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.
