---
title: "Lecture 8: Algebra macierzy"
lecture_number: 8
has_solutions: true
has_exercises: true
file_format: mystnb
kernelspec:
  name: sagemath
  display_name: SageMath
---

```{include} ../_includes/sagecell-loader.md
```

# Algebra macierzy

## Definicja macierzy

:::{narration}

Niech $\kk $ będzie ustalonym ciałem $\rr$ lub $\cc$, oraz $m,n\in \nn .$
:::

:::{prf:definition}

**Macierz** {index}`macierz` o wymiarach $m\times n$ (czytaj $m$ na $n$) nad ciałem $\kk$
definiujemy jako funkcję

```{math}
\begin{aligned}
A: \{1,2, \ldots, m\} \times \{1,2, \ldots, n \}\to \kk,\qquad
  (i,j)\mapsto a_{ij}\in\kk.
\end{aligned}
```

   Macierz najczęściej przedstawia się w postaci
   tablicy


```{math}
\begin{aligned}
A =
   [a_{ij}]_{m\times n} = [a_{ij}]
   =   \Macierz{
  a_{11} & a_{12} & \ldots & a_{1n} \\
  a_{21} & a_{22} & \ldots & a_{2n} \\
  \vdots & \vdots &  & \vdots \\
  a_{m1} & a_{m2} & \ldots & a_{mn}
   }.
\end{aligned}
```

   Gdy chcemy użyć innych indeksów do zdefiniowania macierzy, możemy użyć rozleglejszego oznaczenia

```{math}
{[a_{kl}]_{k = 1,}^m}_{l =1}^n.
```

**Indeksami** {index}`macierz; indeksy`
macierzy nazywamy elementy $ i,j .$

**Wyrazami** {index}`macierz; wyrazy`
lub **elementami** {index}`macierz; elemnty`
macierzy nazywamy
wartości funkcji $A$, czyli elementy $a_{ij}.$

**$i$-tym wierszem** {index}`macierz; wiersz` macierzy $A$ nazywamy macierz
o tablicy
\quad
$
   \Macierz{a_{i1} & a_{i2} & \ldots & a_{in}}.
$

**$j$-tą kolumną** {index}`macierz; kolumna` macierzy $A$ nazywamy macierz
o tablicy
\quad
$
   \Macierz{a_{1j} \\ a_{2j} \\ \vdots \\ a_{mj}}.
$

:::

:::{narration}

**Zbiór macierzy** o
wymiarach $m\times n$ i elementach z ciała $\kk$ oznaczamy symbolem

```{math}
\MSet{m}{n}{\kk}.
```

W literaturze występują również inne oznaczenia, np.:

```{math}
\begin{aligned}
M(m\times n, \kk),\qquad
  M(m, n, \kk), \qquad
  M_\kk(m, n),\qquad \kk_n^m, \qquad etc.
\end{aligned}
```

:::

:::{prf:example}

Oto kilka przykładów macierzy (przedstawionych w postaci tablicy):

```{math}
\begin{aligned}
A & = \Macierz{\pi}\in \MSet{1}{1}{\rr}, &
  B & = \Macierz{1 & 2  & 3 & 4 & 5 & 6}\in \MSet{1}{6}{\rr}, &
  C & = \Macierz{j & -1 & e  \\ \frac 1 2 & 0 & 1-2j}\in \MSet{2}{3}{\cc}.
\end{aligned}
```

```{math}
\begin{aligned}
D & = \Macierz{1   \\ -2 \\ 3}\in \MSet{3}{1}{\rr}, &
  E & = \Macierz{0 & -1 & 2 & 0  \\ 1 & 0 & 3 & -4 \\ -2 & -3 & 0 & 5 \\ 0 & 4 & -5 & 0}
  \in \MSet{4}{4}{\cc}, &
  F & = \Macierz{0 & 1  & 2 & 0  \\ 1 & -2 & 3 & 0 \\ 2 & 3 & -4 & 0} \in \MSet{3}{4}{\cc}.
\end{aligned}
```

:::

::::{exercise}
:label: lec-08-ex-01
:class: [exercise]

Zapiszmy _explicite_ tablicę macierzy $G = \left[i + j^2\right]_{4\times 4}.$
::::

```{code-cell} sage
:tags: [remove-input]
from myst_nb import glue
from IPython.display import Math

G = matrix(QQ, 4, 4, lambda i, j: (i+1)+(j+1)^2)

body_01 = DisplayMatrix(G)
content = rf"""
G = {body_01}
"""
glue('sageglue_matrx_01', Math(r"\begin{aligned}" + content + r"\end{aligned}"), display=False)
```

:::{answer}
:class: [solution] dropdown

```{glue} sageglue_matrx_01
```

:::

## Ważne przykłady macierzy

:::::{container} side-by-side
::::{container} column-two-third
:::{prf:definition}

**Macierzą zerową** {index}`macierz; zerowa` o wymiarach $m$ na $n$ nazywamy tą,
której wszystkie wyrazy są równe 0
i oznaczamy symbolem

$$
\oo \qquad \text{lub dla większej jasności} \qquad \oo_{m\times n}.
$$

:::
::::

::::{container} column-one-thirds
:::{prf:example}

$$
\oo_{3\times 4} = \Macierz{0 & 0 & 0 & 0 \\ 0&0&0&0 \\ 0&0&0&0}
% \in \MSet{3}{4}{\rr}
$$
:::
::::
:::::

:::::{container} side-by-side
::::{container} column-two-third
:::{prf:definition}

**Macierzą kwadratową** {index}`macierz; kwadratowa`
(stopnia $n$ lub wymiaru $n$)
nazywamy macierz $A$ o wymiarach $n\times n .$
:::
::::

::::{container} column-one-thirds
:::{prf:example}

$$
\Macierz{1 & -1 & 0 \\ 2&\pi&1 \\ 0&30&-4}
% \in \MSet{3}{3}{\rr}
$$
:::
::::
:::::

:::::{container} side-by-side
::::{container} column-two-third
:::{prf:definition}

**Główną przekątną** {index}`macierz; przekątna główna`
lub **diagonalą** {index}`macierz; diagonala`
macierzy kwadratowej $A = [a_{ij}]_{n\times n}$
nazywamy uporządkowany układ

$$
\Brack{a_{11}, a_{22}, \ldots , a_{nn}}.
$$
:::
::::

::::{container} column-one-thirds
:::{prf:example}

$$
\Macierz{\underline 1 & -1 & 0 \\ 2&\underline \pi &1 \\ 0&30&\underline{-4}}
$$
:::
::::
:::::

:::::{container} side-by-side
::::{container} column-two-third
:::{prf:definition}

**Macierzą diagonalną** {index}`macierz; diagonalna`
nazywamy macierz kwadratową, której wszystkie wyrazy poza diagonalą
są zerowe. Przyjmujemy oznaczenie

$$
\operatorname{diag}(a_{11}, a_{22}, \ldots , a_{nn}) = \Macierz{
   a_{11} & 0 & \ldots & 0 \\
   0 & a_{22} & \ldots & 0 \\
   \vdots & \vdots &  & \vdots \\
   0 & 0 & \ldots & a_{nn}
}.
$$
:::
::::

::::{container} column-one-thirds
:::{prf:example}

$$
\begin{aligned}
\Macierz{-1 & 0 & 0 \\ 0& 2 j & 0 \\ 0&0& 3}
\\
\diag(-1,2j,3)
\end{aligned}
$$
:::
::::
:::::

:::::{container} side-by-side
::::{container} column-two-third
:::{prf:definition}

**Macierzą jednostkową** {index}`macierz; jednostkowa`
wymiaru $n$ nazywamy macierz diagonalną

$$
I_n = \diag(1,1,\ldots, 1)=\Macierz{
   1 & 0 & \ldots & 0 \\
   0 & 1 & \ldots & 0 \\
   \vdots & \vdots &  & \vdots \\
   0 & 0 & \ldots & 1
}.
$$
:::
::::

::::{container} column-one-thirds
:::{prf:example}

$$
I_3 = \Macierz{1 & 0 & 0 \\ 0& 1 & 0 \\ 0&0& 1}
% \in \MSet{3}{3}{\cc}
$$
:::
::::
:::::

:::::{container} side-by-side
::::{container} column-two-third
:::{prf:definition}

**Macierzą górną trójkątną** {index}`macierz; górna trójkątna`
(odpowiednio **dolną trójkątną** {index}`macierz; dolna trójkątna`)
nazywamy macierz kwadratową, której wszystkie wyrazy
poniżej diagonali (odpowiednio powyżej diagonali) są zerowe, czyli postaci

$$
\begin{array}{cc}
\Macierz{
   a_{11} & a_{12} & \ldots & a_{1n} \\
   0      & a_{22} & \ldots & a_{2n} \\
   0      & 0      &        & a_{3n} \\
   \vdots & \vdots &        & \vdots \\
   0      & 0      & \ldots & a_{nn}
},
&
\Macierz{
   a_{11}    & 0      & 0      & \ldots & 0      \\
   a_{21}    & a_{22} & 0      & \ldots & 0      \\
   \vdots    & \vdots &        &        & \vdots \\
   a_{n1}    & a_{n2} & a_{n3} & \ldots & a_{nn}
}. \\
\text{(górna trójkątna)} & \text{(dolna trójkątna)}
\end{array}
$$
:::
::::

::::{container} column-one-thirds
:::{prf:example}

$$
\begin{array}{cc}
\Macierz{-1 & 2 & 0 \\ 0& 1 & -2+j \\ 0&0& \pi}
\\
\text{(górna trójkątna)}
\\
\\
\Macierz{-1 & 0 & 0 \\ 1& 0 & 0 \\ -\pi & j& 4}
\\
\text{(dolna trójkątna)}
\end{array}
$$

:::
::::
:::::

:::::{container} side-by-side
::::{container} column-two-third
:::{prf:definition}

**Macierzą blokową** {index}`macierz; blokowa`
nazywamy macierz kwadratową wymiaru $n$, dla której istnieje $k\in\nn$, że
wszystkie wyrazy
poniżej $k$-tej kolumny i do $k$-tego wiersza są zerowe lub
do $k$-tej kolumny i od $k$-tego wiersza są zerowe,
czyli postaci

```{math}
:label: eq-Blokowa

\Macierz{ B & C   \\ \oo & E}
\qquad\text{lub}\qquad
\Macierz{ B & \oo \\ D & E},
```

gdzie $B \in \MSet{k}{k}{\kk}$, $C \in \MSet{k}{(n-k)}{\kk}$,
$D \in \MSet{(n-k)}{k}{\kk}$, $E \in \MSet{(n-k)}{(n-k)}{\kk} .$
:::
::::

::::{container} column-one-thirds
:::{prf:example}

$$
\begin{aligned}
\Macierz{1 & 2 & | & 0 & 2 \\ 1 & 1 & | & 3 & 2 \\ \hline
0   & 0 & | & 1 & -2         \\ 0 & 0 &| & 2 & -2 }
% \in \MSet{4}{4}{\rr}
\\
\\
\Macierz{0 & 0 & 1 & | & 0 \\ 1 & 2 & 3 & | & 0 \\ 2& 3& 1 & | & 0 \\ \hline
2   & -1 & 0 & | & -2 }
\end{aligned}
$$
:::
::::

:::::


## Dodawanie macierzy

:::{narration}

Rozważmy przestrzeń macierzy $\MSet{m}{n}{\kk}.$
:::

:::{prf:definition}

**Dodawanie macierzy** {index}`macierz; dodawanie`
$+ : \MSet{m}{n}{\kk}\times \MSet{m}{n}{\kk} \to \MSet{m}{n}{\kk}$
zdefiniowane jest przez

```{math}
\begin{aligned}
[a_{ij}]_{m\times n} +  [b_{ij}]_{m\times n} = [a_{ij} +
  b_{ij} ]_{m\times n}.
\end{aligned}
```

:::

:::{prf:example}

Dla przykładu

```{math}
\begin{aligned}
\Macierz{1 & -2 & j \\ 1 + 2j & 0 & \pi} +
  \Macierz{-2 + j & j & 1 \\  0 & 7 & -2\pi} =
  \Macierz{-1 +j & -2+j & j+1 \\ 1+2j & 7 & -\pi}.
\end{aligned}
```

:::

:::{prf:remark}

Dodawanie nie jest zdefiniowane dla macierzy o różnych wymiarach. Przykładowo
nie możemy dodać do siebie żadnej pary spośród macierzy:

```{math}
\begin{aligned}
\Macierz{2 & 3},\, \Macierz{-1 \\ 2}, \, \Macierz{1 & -2 \\ 1 & 2}.
\end{aligned}
```

:::

## Mnożenie macierzy przez skalar

:::{narration}

Rozważmy przestrzeń macierzy $\MSet{m}{n}{\kk}.$
:::

:::{prf:definition}

**Mnożenie macierzy przez skalar** {index}`macierz; mnożenie przez skalar`
$\cdot : \kk \times \MSet{m}{n}{\kk} \to \MSet{m}{n}{\kk}$
zdefiniowane jest przez

```{math}
\begin{aligned}
\alpha \cdot [a_{ij}]_{m\times n} = [\alpha
  \cdot a_{ij} ]_{m\times n}.
\end{aligned}
```

:::

:::{prf:example}

Dla przykładu

```{math}
\begin{aligned}
-\frac 1 2 \cdot \Macierz{4 & -2 & 2j -1 \\ 3 + 2j & 0 & 2\pi} =
  \Macierz{-2 & 1 & \frac 1 2 - j \\ -\frac 3 2 - j & 0 & -\pi}.
\end{aligned}
```

:::

::::{prf:theorem}

Dla dowolnych macierzy $A,B\in \MSet{m}{n}{\kk}$ i dowolnych
skalarów $\alpha, \beta\in\kk$ zachodzą następujące równości:

:::{container} columns-2-auto

1. $A+ (B + C) = (A+B) + C$
2. $A+ B = B +A$
3. $\oo_{m\times n} + A = A + \oo_{m\times n} = A$
4. $A + (-1)\cdot A = (-1)\cdot A + A = \oo_{m\times n}$
5. $(\alpha + \beta) \cdot A = \alpha \cdot A + \beta \cdot A$
6. $\alpha \cdot (A+B) = \alpha \cdot A + \alpha \cdot B$
7. $\alpha\cdot   (\beta\cdot A) =  (\alpha\cdot\beta)\cdot A$
8. $1 \cdot A = A .$

:::

::::

:::{prf:corollary}

Z powyższego twierdzenia otrzymujemy, że
$((\MSet{m}{n}{\kk}, +), \kk, \cdot)$
jest przestrzenią liniową nad $\kk .$
:::

## Mnożenie macierzy

:::{narration}

Rozważmy przestrzenie macierzy $\MSet{m}{p}{\kk}$ i $\MSet{p}{n}{\kk}.$
:::

:::::{prf:definition}

::::{container} side-by-side
:::{container} column-half

**Iloczyn macierzy** {index}`macierz; iloczyn`

$$\cdot : \MSet{m}{p}{\kk}\times \MSet{p}{n}{\kk} \to \MSet{m}{n}{\kk}$$

zdefiniowane jest przez

$$
[a_{ij}]_{m\times p} \cdot  [b_{ij}]_{p\times n}
= \left[c_{ij} =  \sum_{k=1}^p a_{ik}\cdot b_{kj} \right]_{m\times n}.
$$

:::

:::{container} column-half

$$
\begin{aligned}
                   & \Macierz{
                     b_{11}             & \ldots             & \underline{b_{1j}} & \ldots             & b_{1n} \\
{b_{21}}           & \ldots             & \underline{b_{2j}} & \ldots             & b_{2n} \\
\vdots             &                    & \vdots             &                    & \vdots \\
b_{p1}             & \ldots             & \underline{b_{pj}} & \ldots             & b_{pn}
}
\\
%     \qquad
\Macierz{
  %                a_{11} & a_{12} & \ldots & a_{1p} \\
\vdots             & \vdots             &                    & \vdots                      \\
\underline{a_{i1}} & \underline{a_{i2}} & \ldots             & \underline{a_{ip}}          \\
\vdots             & \vdots             &                    & \vdots                      \\
%                a_{m1} & a_{m2} & \ldots & a_{mp}
}
%     \cdot
%     =
                   & \Macierz{
                     %                c_{11} & \ldots & {c_{1j}} & \ldots & c_{1n} \\
\vdots             &                    & \vdots             &                    & \vdots \\
{c_{i1}}           & \ldots             & \underline{c_{ij}} & \ldots             & c_{in} \\
\vdots             &                    & \vdots             &                    & \vdots \\
%                c_{m1} & \ldots & {c_{mj}} & \ldots & c_{mn}
}
\end{aligned}
$$

:::
::::
:::::

::::{exercise}
:label: lec-08-ex-02
:class: [exercise]

Niech $\displaystyle A = \Macierz{2 & -1}$ i $\displaystyle B = \Macierz{1 \\ -2} .$
Obliczmy $A\cdot B$ i $B\cdot A .$

:::{note}
:class: [see-problem]

Pomoże rozwiązać {numref}`prob-10-ex-01`, {numref}`prob-10-ex-06`.
:::

::::

:::{solution-without-reference}
:class: [solution] dropdown

1. Wykonujemy działanie $A\cdot B$:

   ```{math}
   \begin{aligned}
   & \Macierz{ 1 \\ -2}
    \\
    \Macierz{ 2 & -1} & \Macierz{ 2 \cdot 1  + (-1)\cdot (-2)} = \Macierz{4} = AB
   \end{aligned}
   ```

2. Wykonujemy działanie $B\cdot A$:

   ```{math}
   \begin{aligned}
   & \Macierz{ 2   \  & -1}
    \\
    \Macierz{ 1\\ -2} & \Macierz{ 1 \cdot 2 & 1 \cdot (-1) \\ -2\cdot 2 & -2\cdot(-1)}
    = \Macierz{2 & -1  \\ -4 & 2 } = BA
   \end{aligned}
   ```

:::

:::{prf:remark}

Iloczyn nie jest zdefiniowany dla macierzy $A$ i $B$,
jeśli liczba kolumn $A$ jest różna od liczby wierszy $B .$
:::

::::{exercise}
:label: lec-08-ex-03
:class: [exercise]

Pomnóżmy (jeśli to możliwe) dowolną parę (w dowolnej kolejności) macierzy spośród:
\quad

```{math}
\begin{aligned}
A= \Macierz{1 &2 & 3 },\quad
  B=\Macierz{-1 & 1\\ 2 & -1}, \quad
  C=\Macierz{1 & -2 & 0 \\ 1 & 0  & 2}.
\end{aligned}
```

:::{note}
:class: [see-problem]

Pomoże rozwiązać {numref}`prob-10-ex-01`, {numref}`prob-10-ex-06`.
:::

::::

:::{solution-without-reference}
:class: [solution] dropdown

Nie można pomnożyć: $A B, \  A C, \ B A, \ C A, \ C B .$

```{math}
\begin{aligned}
& \Macierz{
  1   \   & -2  \  & 0 \\
  1  \ & 0  \   & 2}
  \\
  \Macierz{-1  & 1   \\ 2 & -1} &
  \Macierz{
  -1\cdot 1 + 1\cdot 1 & -1 \cdot(-2) + 1\cdot 0 & -1 \cdot 0 + 1\cdot 2 \\
  2\cdot 1 - 1\cdot 1  & 2 \cdot (-2) - 1\cdot 0 & 2\cdot 0 - 1\cdot 2
  }
  = \Macierz{0 & 2   & 2 \\ 1 & -4 & -2} = BC
\end{aligned}
```

:::

:::{prf:theorem}

Dla dowolnych macierzy $A \in \MSet{m}{ n}{\kk}$,
$B, B_1, B_2\in \MSet{n}{p}{\kk}$,
$C\in \MSet{p}{r}{\kk}$ i dowolnego
skalara $\alpha \in\kk$ zachodzą następujące równości:

1. $A\cdot (B \cdot C) = (A\cdot B )\cdot C$
2. $A\cdot (B_1 + B_2) = A\cdot B_1 + A\cdot B_2$
3. $(B_1 + B_2)\cdot C = B_1\cdot C + B_2\cdot C$
4. $A\cdot I_n = I_m\cdot A = A$
5. $\alpha\!\cdot\!(A\!\cdot\! B) = (\alpha\!\cdot\! A)\!\cdot\! B = A\!\cdot\!(\alpha\!\cdot\! B) .$
:::

:::{prf:remark}

Dla $A, B\in\MSet{n}{n}{\kk}$ na ogół
$
\quad A\cdot B \neq B\cdot A.
$
:::

:::::{prf:example}

Dla $ A = \Macierz{1 & 1 \\ -1 & -1},\, B=\Macierz{1 & 2 \\ 3 & 4}$ mamy:

::::{container} side-by-side
:::{container} column-half

```{math}
\begin{aligned}
& \Macierz{ 1 & 2 \\ 3 & 4}
 \\
 \Macierz{1 & 1   \\ -1 & -1} & \Macierz{4 & 6 \\ -4 & -6} = AB
\end{aligned}
```

:::

:::{container} column-half

```{math}
\begin{aligned}
& \Macierz{1 & 1 \\ -1 & -1}
 \\
 \Macierz{1 & 2  \\ 3 & 4} & \Macierz{ -1 & -1 \\ -1 & -1} = BA
\end{aligned}
```

:::
::::
:::::

:::{prf:remark}

Jeśli $A\cdot B = \oo$, to **nie możemy** z tego wnioskować, że $A = \oo \vee B = \oo.$
:::

:::{prf:example}

Dla $ A = \Macierz{-2 & 1 \\ 0 & 0},\ B = \Macierz{1 & 2 \\ 2 & 4}$
mamy

```{math}
\begin{aligned}
& \Macierz{ 1 & 2 \\ 2 & 4}
  \\
  \Macierz{-2  & 1   \\ 0 & 0 } & \Macierz{-2 + 2 & -4 + 4 \\ 0 + 0 & 0 + 0}
  = \Macierz{0 & 0   \\ 0 & 0} = AB.
\end{aligned}
```

Zatem $A B = \oo$, ale **nie jest prawdą**, że $A = \oo \vee B = \oo.$

:::

:::{prf:definition}

Dla macierzy kwadratowej $A \in \MSet{n}{n}{\kk}$
oraz $\ell\in\nn_2$
przyjmujemy, że
\qquad
$\displaystyle A^\ell =  \underbrace{A\cdot A\cdot \ldots \cdot A}_{\ell \text{ czynników}} .$
:::

## Transpozycja macierzy

:::{narration}


:::

:::::{prf:definition}
::::{container} side-by-side
:::{container} column-half

**Macierz transponowaną** {index}`macierz; transponowana`
macierzy $A=[a_{ij}]_{m\times n}$
definiujemy jako macierz
$$A^T=[a_{ji}]_{n\times m}.$$
% dla dowolnych $i\in\{1,\ldots,m\}$,  $j\in\{1,\ldots n\} .$\\
%Macierz transponowaną macierzy $A$ oznaczamy symbolem $A^T .$

% \begin{remark}
Innymi słowy
kolumnami macierzy transponowanej $A^T$ są wiersze macierzy $A$
i równoważnie
wierszami macierzy transponowanej $A^T$ są kolumny macierzy $A$
% \end{remark}

:::

:::{container} column-half

$$
\begin{aligned}
  \Macierz{
  a_{11}             & \ldots & a_{1n}                               \\
  \vdots             &        & \vdots                               \\
  \underline{a_{i1}} & \ldots & \underline{a_{in}}                   \\
  \vdots             &        & \vdots                               \\
  a_{m1}             & \ldots & a_{mn}
  }^T
  %     \cdot
  =
  \Macierz{
  a_{11}             & \ldots & \underline{a_{i1}} & \ldots & a_{m1} \\
    %                 \vdots & & \vdots &  & \vdots \\
    %                {c_{i1}} & \ldots & \underline{c_{ij}} & \ldots & c_{in} \\
  \vdots             &        & \vdots             &        & \vdots \\
  a_{1n}             & \ldots & \underline{a_{in}} & \ldots & a_{mn}
  }
\end{aligned}
$$

:::
::::
:::::

:::{prf:example}

Dla przykładu:

1. $ \Macierz{1 & 2 & 3}^T = \Macierz{1 \\ 2 \\ 3}$
2. $ \Macierz{1 \\ -1 \\ 4}^T = \Macierz{1 & -1 & 4}$
3. $ \Macierz{1 & 2 & -1 \\ -2 & j & 4}^T = \Macierz{1 & -2 \\ 2 & j \\ -1 & 4}$
4. $ \Macierz{0 & -1 & 2 \\ -3 & 4 & -5 \\ j & 2j & 3j}^T = \Macierz{0 & -3 & j \\ -1 & 4 & 2j \\ 2 & -5 & 3j } .$
:::

:::{prf:theorem}

Dla dowolnych macierzy $A, A_1, A_2 \in \MSet{m}{ n}{\kk}$,
$B \in \MSet{n}{p}{\kk}$
i dowolnego skalara $\alpha \in\kk$ zachodzą następujące równości:

1. $(A_1 + A_2)^T = A_1^T+A_2^T$
2. $(A^T)^T = A$
3. $(\alpha A)^T = \alpha A^T$
4. $(A\cdot B)^T = B^T \cdot A^T .$
:::

```{code-cell} sage
:tags: [remove-input]
A = matrix([[1 , 1], [-1 , 0]])
B = matrix([[-1 , 0], [1 , -1]])
```

```{code-cell} sage
:tags: [remove-input]
from myst_nb import glue
from IPython.display import Math

body_01 = DisplayMatrix(A)
body_02 = DisplayMatrix(B)
content = rf"""
A = {body_01},\ B = {body_02}
"""
glue('sageglue_8_0', Math(r"\begin{aligned}" + content + r"\end{aligned}"), display=False)
```

```{code-cell} sage
:tags: [remove-input]
from myst_nb import glue
from IPython.display import Math

body_01 = DisplayMatrix(A.transpose())
content = rf"""
A^T =  {body_01}
"""
glue('sageglue_8_1', Math(r"\begin{aligned}" + content + r"\end{aligned}"), display=False)
```

```{code-cell} sage
:tags: [remove-input]
from myst_nb import glue
from IPython.display import Math

body_01 = DisplayMatrix(B.transpose())
content = rf"""
B^T =  {body_01}
"""
glue('sageglue_8_2', Math(r"\begin{aligned}" + content + r"\end{aligned}"), display=False)
```

```{code-cell} sage
:tags: [remove-input]
from myst_nb import glue
from IPython.display import Math

body_01 = DisplayMatrix(A.transpose() * B.transpose())
content = rf"""
A^T \cdot B^T = {body_01}
"""
glue('sageglue_8_3', Math(r"\begin{aligned}" + content + r"\end{aligned}"), display=False)
```

```{code-cell} sage
:tags: [remove-input]
from myst_nb import glue
from IPython.display import Math

body_01 = DisplayMatrix(B.transpose() * A.transpose())
content = rf"""
B^T \cdot A^T = {body_01}
"""
glue('sageglue_8_4', Math(r"\begin{aligned}" + content + r"\end{aligned}"), display=False)
```

```{code-cell} sage
:tags: [remove-input]
from myst_nb import glue
from IPython.display import Math

body_01 = DisplayMatrix(A * B)
content = rf"""
A\cdot B = {body_01}
"""
glue('sageglue_8_5', Math(r"\begin{aligned}" + content + r"\end{aligned}"), display=False)
```

```{code-cell} sage
:tags: [remove-input]
from myst_nb import glue
from IPython.display import Math

body_01 = DisplayMatrix((A * B).transpose())
content = rf"""
(A \cdot B)^T = {body_01}
"""
glue('sageglue_8_6', Math(r"\begin{aligned}" + content + r"\end{aligned}"), display=False)
```

:::::{prf:example}

Niech {glue:}`sageglue_8_0`.
Wówczas:

::::{container} side-by-side
:::{container} column-one-thirds

{glue:}`sageglue_8_1`
{glue:}`sageglue_8_2`
:::

:::{container} column-one-thirds

{glue:}`sageglue_8_3`

{glue:}`sageglue_8_4`
:::

:::{container} column-one-thirds

{glue:}`sageglue_8_5`
{glue:}`sageglue_8_6` .
:::
::::

Widzimy, że $(A\cdot B)^T = B^T \cdot A^T \neq A^T \cdot B^T .$
:::::
